Re: Stretching a text to a certain width of height



On 12/11/2009 08:20 AM, Damien Boucard wrote:
Hello,

I would like to know if it is possible to give an arbitrary width or
height and automatically compute the correct font size which fits to the
given constraint.

Presently, I increment the font size iteratively until the text width is
over the wanted width. But this workaround is very slow and unusable
when I do it on many text items. I guess there is a cleaner method to do
this...

Using pangocairo, turn metrics-hinting off, then do the layout at a nominal size, take the extents, do a cairo_scale(), and draw again. Has worked fine for me.

behdad


Thank you for your help,

Damien.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]