[cairo] Backwards glyphs?

Ian Britten britten at caris.com
Tue Oct 28 04:38:02 PDT 2008

Ian Britten wrote:
>> A transformation like the above would be expected to invert your glyphs,
>> yes, (vertically, not horizontally).
> Ya, and *if* they were upside down, then that would be my primary
> suspect.  However, they are right-side-up, just backwards, which is
> what has me scratching my head as to why...

Ok, I think I finally see what's going on here...

The starting point was noticing that my call to device_to_user_distance()
was returning a *negative* distance (for a positive input).  I guess this
was due to me passing in my distance as the Y parameter, rather than the
X parameter (Remember that I'm working in Cartesian space, so my Y axis
is flipped, as far a Cairo is concerned).
I'll admit I had never thought about a *distance* method returning a
negative value, but live-and-learn, I guess...

Next, I was passing that (negative) distance into set_font_size(), which
accepted it without complaint.  I'm guessing that it just set the given
value into its matrix, and since the value was negative, ended up
reversing my characters.
[ I'd maybe suggest that a convenience method like set_font_size()
should maybe require a positive input size, but that's just my $0.02 ]

Anyways, straightening that out [ And adding in a
cairo_scale(cr, 1.0, -1.0) as suggested by Carl - Thanks! ] now has my
characters drawing both forward, and upright!  :)

Now to get them positioned correctly... (The 'scale' call seems to have
moved them too, not just scaled them... :( )  Then on to find out why
the rendered size isn't correct...  Ah well - One thing at a time! :)


More information about the cairo mailing list