[cairo] Writing vertical text using pangocairo

Michael Gurnett gurnett at macbat.com
Thu Apr 14 23:27:36 PDT 2011


Have been trying to write vertical text like this

H
e
l
l
o

using pangocairo on win32, but am having absolutely no luck at all. The code I'm using is the following


PangoLayout *layout= pango_cairo_create_layout (cr);
PangoContext*  context = pango_layout_get_context(layout);

PangoFontDescription *font_description;

 pango_context_set_gravity_hint(context,PANGO_GRAVITY_HINT_STRONG);
 pango_context_set_base_gravity(context,PANGO_GRAVITY_EAST);
 font_description =pango_font_description_from_string("Micr 27");
 pango_layout_set_font_description(layout,font_description);

pango_font_description_free(font_description);
pango_layout_context_changed(layout);
pango_layout_set_markup(layout,"Hello",-1);

cairo_translate(cr,60,20);
cairo_set_source_rgb(cr, 0.0, 0.0, 0.0);

cairo_rotate(cr,M_PI/2);
pango_cairo_update_context(cr,context);
pango_cairo_show_layout (cr, layout);

g_object_unref (layout);


With Pango_GRAVITY_SOUTH everything works fine, but as soon as I change this I get squares. Looked at a bunch of example (linux based) and these don't seem to work in my case either. Am I missing a step that is required for windows to get this working.


Thanks

Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20110415/778de3cd/attachment.html>


More information about the cairo mailing list