[cairo] cairo + pango + vertical text
kalle.vahlman at gmail.com
Wed Oct 31 02:21:51 PDT 2007
2007/10/31, Nguyen Vu Hung <vuhung16plus at gmail.com>:
> I've tried the following code, but the text "hihi" didn't get rotated.
> pango_context_set_base_gravity ( context, PANGO_GRAVITY_SOUTH);
The documentation pointed to above states:
"Gravity of normal Latin text is south."
So you are getting what you asked for, normally orientated latin text.
You are not rotating the output of the layout either as far as I can
tell, there's no cairo_rotate visible in the code excerpt.
Now, if you want this (a layout rotated 90 degrees clockwise):
you'll probably want to use GRAVITY_EAST (to rotate the glyphs
counter-clockwise). This alone won't suffice though, since this is
latin script and thus will be handled with the SOUTH rotation
automatically unless you set the gravity hint to
PANGO_GRAVITY_HINT_STRONG to force the gravity setting for latin text
So the code looks something like:
context = pango_layout_get_context (layout);
pango_context_set_base_gravity (context, PANGO_GRAVITY_EAST);
cairo_move_to (cr, x, y);
cairo_rotate(cr, 90 / (180.0 / G_PI));
pango_cairo_show_layout (cr, layout);
Hope this helps.
Kalle Vahlman, zuh at iki.fi
Powered by http://movial.fi
Interesting stuff at http://syslog.movial.fi
More information about the cairo