GtkPrint PangoLayout extents



Hi,

I am trying to use the new GtkPrint from GTK 2.10. I am creating a pango
layout from the cairo reference, setting the font and text and calling
pango_layout_get_pixel_extents. This seems to work well, except that the
returned width seems to be about twice of what it is printed either on
preview or in the output page in the printer.

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

Here's the exact code I am using:

PangoLayout *layout = gtk_print_context_create_pango_layout (job->pc);
PangoRectangle ink;
PangoRectangle log;

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

pango_layout_context_changed (layout);

pango_layout_get_pixel_extents (layout, &ink, &log);

g_object_unref (layout);

return ink.width;

Francisco


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