[cairo] Font matrix difference between 1.0.4 & 1.2.0

Behdad Esfahbod behdad at behdad.org
Thu Jul 13 14:41:48 PDT 2006


On Thu, 2006-07-13 at 17:01 -0400, Jan Slupski wrote:
> Hi list,
> 
> I found the change in Cairo's behavior between 1.0.4 and 1.2.0 related
> to text handling.
> 
> Basically I'm trying to use the matrix to setup text rotation.
> 
> I use following code:
>    cairo_move_to()
>    cairo_matrix_init_identity(&matrix);
> 
>    //rotate around text center
>    cairo_matrix_translate(&matrix, size.width/2, -size.height/2);
>    cairo_matrix_rotate(&matrix, 90/180.*3.1415926);
>    cairo_matrix_translate(&matrix, -size.width/2, size.height/2);
> 
>    cairo_matrix_scale(&matrix, fontsize, fontsize);
>    cairo_set_font_matrix(cr, &matrix);
> 
>    cairo_show_text (cr, string);
> 
> 
> While this code used to work with cairo 1.0.4, it does not in 1.2.0
> anymore. Seems like the rotation(?) translation(?) is applied to 
> every letter separately.
> 
> Is this intentional?

Yes and no.  The font matrix should not be used to create a rotated-text
effect.  For that, the ctm should be used (normal cairo_rotate).
However, the output you have attached doesn't look good.  I'm
investigating.

behdad

> Samples and the example code attached.
> 
> Thanks,
> Jan Slupski
> 
>     _  _  _  _  _____________________________________________
>     | |_| |\ |  S L U P S K I             jslupski at juljas.net
>   |_| | | | \|                             http://juljas.net/
> _______________________________________________ cairo mailing list cairo at cairographics.org http://cairographics.org/cgi-bin/mailman/listinfo/cairo
-- 
behdad
http://behdad.org/

"Commandment Three says Do Not Kill, Amendment Two says Blood Will Spill"
        -- Dan Bern, "New American Language"



More information about the cairo mailing list