Re: reverse of finding text extents
Maarten Bosmans <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <CA+CvcKSEUjjqR5O3oH7C5gdU5z-O61+tfT4E4PQc2UHtROek7w@mail.gmail.com> |
2011/9/11 Roman Beslik <[email protected]>: > Hello. > For some text T and some number S, how can I determine the longest prefix T' > of T such that the width of the image of T' is less than S? The practical > aim is to break T into lines which fit in a rectangle. How about letting Pango take care of this all? Line breaking algorithms are not really trivial to get right, so you better not implement this yourself. The cairo text functions aren't called *toy* text interface for nothing, once you want more advanced text handling (e.g. line breaking, proper international text support with font fallback), you really should use pango. Maarten -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo