[cairo] Backwards glyphs?

Carl Worth cworth at cworth.org
Wed Oct 22 12:11:20 PDT 2008

On Wed, 2008-10-22 at 11:50 -0300, Ian Britten wrote:
> - Configuring a Cartesian (lower-left origin) world transform on it.

I presume this is something like:

	cairo_translate (cr, 0, height);
	cairo_scale (cr, 1.0, -1.0); 

or so?

> Generally, everything is working as expected with my rendering.
> Lines, polygons, and images all draw correctly.  Even for the glyphs,
> they're at the correct position, with the specified size, colour, etc.
> It's just that the individual glyphs are backwards... :(

A transformation like the above would be expected to invert your glyphs,
yes, (vertically, not horizontally).

> Am I expected to muck about with cairo_set_font_matrix(), even for
> simple rendering?  I was hoping just setting the size+position would
> result in the correct output...

Well, define "simple rendering" I guess. You're the one going outside
cairo's default coordinate system. ;-)

So, cairo_set_font_matrix with a matrix that will again invert the Y
axis would be one way to solve this, yes. Another possibility would be
to draw your glyphs with something like this:

	cairo_move_to (cr, x, y);
	cairo_save (cr);
	cairo_scale (cr, 1.0, -1.0);
	cairo_show_text (cr, "text here");
	cairo_restore (cr);

Hopefully that's still simple enough and saves you having to muck with
the font matrix.

I've not tested this, so if it doesn't work then blame me for typing too


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.cairographics.org/archives/cairo/attachments/20081022/1b5eb7f7/attachment.pgp 

More information about the cairo mailing list