Hello,<br>when rendering the following japanese utf-8 layout "おろしポン酢" with PANGO_GRAVITY_EAST, the pdf result is just the first char (CASE define) while the image result is the entire string.<br>i certainly missed something but what ? or is this a bug?<br>
thanks in advance<br>Tristan<br><br>========================================<br>#include <pango/pangocairo.h><br>#include <cairo/cairo.h><br>#include <cairo/cairo-pdf.h><br><br>#define CASE<br><br>int<br>
main (int argc, char *argv[])<br>{<br><br> cairo_surface_t *surface;<br> cairo_t *cr;<br><br> #ifdef CASE<br> surface = cairo_pdf_surface_create ("hello.pdf",2000,2000);<br> #else<br> surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 2000, 2000);<br>
#endif<br><br> cr = cairo_create (surface);<br> <br> PangoFontDescription *font_description;<br> PangoLayout *layout;<br> PangoContext *context;<br><br> font_description = pango_font_description_new ();<br>
pango_font_description_set_family (font_description, "serif");<br> pango_font_description_set_weight (font_description, PANGO_WEIGHT_BOLD);<br> pango_font_description_set_absolute_size (font_description, 100 * PANGO_SCALE);<br>
<br> layout = pango_cairo_create_layout (cr);<br> pango_layout_set_font_description (layout, font_description);<br> pango_layout_set_text (layout, "おろしポン酢", -1);<br><br> //for vertical text<br> context=pango_layout_get_context(layout);<br>
pango_context_set_base_gravity(context,PANGO_GRAVITY_EAST); <br> pango_context_set_gravity_hint(context, PANGO_GRAVITY_HINT_STRONG);<br> pango_layout_context_changed(layout);<br> <br> cairo_set_source_rgb (cr, 0.0, 1.0, 1.0);<br>
cairo_paint (cr);<br><br> cairo_set_source_rgb (cr, 0.0, 0.0, 1.0);<br> cairo_move_to (cr, 1000.0, 1000.0);<br><br> /* Inform Pango to re-layout the text with the new transformation */<br> pango_cairo_update_layout (cr, layout);<br>
<br> pango_cairo_show_layout (cr, layout);<br><br> g_object_unref (layout);<br> pango_font_description_free (font_description);<br><br> #ifdef CASE<br> cairo_show_page(cr);<br> #else<br> cairo_surface_write_to_png (surface, "hello.png");<br>
#endif<br><br> cairo_destroy (cr);<br> cairo_surface_destroy (surface);<br><br> return 0;<br>}<br>