Re: GtkPrint PangoLayout extents



> Is this correct or is there a better way to figure out the text extents when
> using Pango?

try using the ink extents variant.

That's exactly what I have been using but my experience shows that it seems to be about twice as big in width than I expected:


gtk_print_context_create_pango_layout (pc);

pango_layout_set_font_description (layout, current_font);
pango_layout_set_text (layout, text, -1);

pango_layout_context_changed (layout);

pango_layout_get_extents (layout, &ink, &log);

g_object_unref (layout);

return (gdouble)ink.width / PANGO_SCALE;

This code above returns widths about twice as expected. Dividing by 2 produces better results that closely resemble what I expected.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]