[cairo] scale with text

Emmanuel Pacaud emmanuel.pacaud at lapp.in2p3.fr
Sat Feb 17 12:55:08 PST 2007


Le samedi 17 février 2007 à 21:03 +0100, Tobias Ceglarek a écrit :
> Hello again,
> 
> thanks for your  guesses ;-) I will try to further specify my question.
> 
> How can I zoom the cairo surface with all its elements (text, paths, ..)
> keeping the ratios of sizes?
> 
> For example: If there is a text with width=80 in a rectangular path with
> width=100, after scaling with 2.0 i want to have the same ratio so that
> the text has a width of 160 and the path a width of 200. The ratio is
> 80/100=160/200=0.8.

pango cairo does that fine, even with hinted glyphs and hinted metrics.
Glyph spacing is not always nice, but at least text extents is
proportional to the scale factor.

I don't know how exactly behaves cairo text rendering, but you may try:

 cairo_font_options_set_hint_style (cr, CAIRO_HINT_STYLE_NONE);
 cairo_font_options_set_hint_metrics (cr, CAIRO_HINT_METRICS_OFF);

	Emmanuel.




More information about the cairo mailing list