Problems printing from a wide PangoLayoutLine



> -----Original Message-----
> From: Ian Puleston [mailto:ian underpressuredivers com]
> 
> I'm have an application that uses GTK and print pages to a printer with
> text overlaid in a grid using pango/cairo and GtkPrintOperation etc.
> This works great, but I am currently updating it to do some more with
> that and have hit a couple of problems with things that don't seem to
> be working as they should. These are happening with a Windows build
> with GTK 2.22.1, Pango 1.28.3 and Cairo 1.10.2 - I haven't tried to see
> if the same happens in a Linux build.

The other problem I am having is that I now need to print to a page in
landscape format and with narrow margins. I set the margins to 0.25" via
gtk_page_setup_set_top_margin() etc. I then draw the grid up to those
margins and it all prints fine, all the way up to the margins. But when I
print text onto the page, words at the right side are dropped and not
printed, even though they are well inside the right 0.25" margin. It looks
like words that would end within about 0.75" of the right-edge don't get
printed.

My "draw-page" signal handler needs to print each line individually so it
uses pango_layout_get_line_readonly() to pull the lines out of the layout
one by one, and pango_cairo_show_layout_line() to draw each.

Some debug g_print statements show that the PangoLayoutLine passed to
pango_cairo_show_layout_line() does contain the full text, but
pango_cairo_show_layout_line() does not print all of it, dropping words from
the end of the longer lines.

I wondered if the problem could be due to word-wrap since it seems to drop
entire words, but adding a call to pango_layout_set_width to make sure wrap
if off (width=-1) and setting the layout wrap mode to PANGO_WRAP_CHAR had no
effect.

Anyone see any reason for this other than a bug in
pango_cairo_show_layout_line()?

Ian



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