On Mon, 5 Feb 2024 10:21:38 -0600 David Grubb <davidanthonygr...@gmail.com> said:
> Hi everybody, > > I'm hacking on a small project and I'm curious about some of the attributes > of the TextBlock object that I'm not understanding from the documents. Is > it possible to programmatically detect the geometry of the rendered text > within a TextBlock? > > Say, I have a non-monospaced font, I've loaded some string content and want > to know how much of the allotted TextBlock that's filled. Or, I want to > know things like whether the text has overflowed and ellipsis are now being > applied, that kind of thing. > > I thought that's what evas_object_textblock_size_formatted_get() and > evas_object_textblock_size_native_get() were about but I just get values of > zero for the Evas_Coords I pass in. these will flow the text given the current object SIZE - so generally width. native size == without width reflow - so it'll be the size purely on any formatting in the textblock. it may be very wide if you have lines with now explicit linebrakes etc. - so this width would be the width you need to have no ... or not line wrap reflow. it also will give you the height as well without any reflow. the formatted size is the size after reflow and ... given the current geometry (ie resize the textblock to some width and height - generally height is not relevant here as width controls reflow etc.). so what you do is you will resize the textblock to a given width - then query the formatted size, then probably resize the height to the formatted height and now you know the height range you need - and possibly width too (resize to the formatted width - or leave it at current width to have left/right align do what you expect them to). this is what edje does with textblock parts for you ... and then elm's entry wraps this up also with a scroller to handle scrolling - it'll also handle resizing when width changes to handle all this reflow etc. > Cheers, > Dave. > > _______________________________________________ > enlightenment-devel mailing list > enlightenment-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel > -- ------------- Codito, ergo sum - "I code, therefore I am" -------------- Carsten Haitzler - ras...@rasterman.com _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel