Skip to content
This repository has been archived by the owner on Jun 8, 2021. It is now read-only.

Why does Layout::set_text need a length argument? #61

Closed
johncf opened this issue Apr 15, 2017 · 15 comments
Closed

Why does Layout::set_text need a length argument? #61

johncf opened this issue Apr 15, 2017 · 15 comments

Comments

@johncf
Copy link

johncf commented Apr 15, 2017

Can't the length be calculated within Layout::set_text?

@GuillaumeGomez
Copy link
Member

GuillaumeGomez commented Apr 15, 2017

It's part of the things we need to improve. However I was certain that we removed the next argument if it was an integer and the current one was a string. Did I miss something @EPashkin?

@mjkillough
Copy link

I can't see any code in GIR that would do that, but I might be looking for the wrong thing.

I can see that CssProvider.load_from_data() is implemented manually in order to hide its length parameter. Would it be appropriate to do something similar here, or is a generic solution in GIR preferable? I'd be happy to have a go at fixing this in either case.

@EPashkin
Copy link
Member

It still under construction gtk-rs/gir#376
I think we accept manual version until issue fixed.

@mjkillough
Copy link

I see gtk-rs/gir#376 is in progress, so I think it's fine to wait for it to be done automatically.

@sdroege
Copy link
Member

sdroege commented Jun 19, 2017

This is not covered unfortunately because the array-length annotation is missing in Pango. Someone should file a bug in Bugzilla to get this added, or I'll do it if nobody else is faster.

@EPashkin
Copy link
Member

Maybe we need add config override for array-length?

@sdroege
Copy link
Member

sdroege commented Jun 19, 2017

That would make sense (and is relatively simple), yes. Nonetheless all these things should be reported to the respective C libraries.

@sdroege
Copy link
Member

sdroege commented Jun 21, 2017

https://bugzilla.gnome.org/show_bug.cgi?id=784021
IMHO we should just patch the Pango .gir file instead of adding configuration. Configuration only makes sense for things that can't be expressed by the .gir file.

@EPashkin
Copy link
Member

Currently we strong against patching .gir files as it will be replaced by next update.
Or we need patching mechanism that works good with xml files.

@sdroege
Copy link
Member

sdroege commented Jun 21, 2017

Next upstream release would ideally have these changes so no patching would be needed after an update.

@EPashkin
Copy link
Member

Maybe but I don't want look change in big xml and think, fixed it actually or not :(

@sdroege
Copy link
Member

sdroege commented Jun 21, 2017

The changes between versions are not actually very big usually, unless you skip many major versions. When doing GStreamer releases, I usually go through the diff of the .gir files and it was a manageable task so far. Usually there are not many changes/additions to already existing types.

Problem I see with a configuration is that it "makes lazy", and then the annotations are never fixed in the C libraries and every binding ships its own configuration around for these bugs.

@sdroege
Copy link
Member

sdroege commented Jun 22, 2017

See gtk-rs/gir#387 (comment) . Needs manual bindings for these functions that take a string+length, or return a string+length

@mjkillough
Copy link

🎉 It looks like this is fixed in the latest pango release: LayoutExt::set_text(&str)

@GuillaumeGomez
Copy link
Member

Then let's close it. :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants