Re: Pango tab stops



On 04/01/2009 07:27 PM, Ian Puleston wrote:
Hi,

Hi Ian,


I want to use a PangoTabArray to pass tab stop settings to a print function
along with text to be sent to a printer. The idea is that the caller passes
the pre-set PangoTabArray, and the print function then calls
pango_layout_set_tabs to add it to the PangoLayout created via
gtk_print_context_create_pango_layout.

But there seems to be a problem with setting the tabs correctly for the
resolution (dpi) of the printer. With a PangoTabArray the tabs are specified
in either pixels or Pango units, and to use either to set tag stops at fixed
distances requires knowledge of the resolution of the device, but the code
requesting the print cannot know that (the user has not even selected a
printer yet).

No it doesn't. The cairo PS/PDF/SVG surfaces use Postscript points as their device "pixel". That is, for positioning purposes, 72dpi is all you care about. The actual resolution of the printer printing them is irrelevant.

Makes sense?

behdad


Two solutions that I can see are 1) define the API to accept tabs set for a
300 dpi printer and have it internally multiple them up or down if necessary
once the print device has been selected, or 2) pass the tab settings in a
generic array or list and create the PangoTabArray internally once the print
device has been selected.

Neither is particularly neat, so I'm wondering if there may be some existing
structure or API somewhere in GTK or the other components for passing tab
stops in units such as inches, mm, etc.?

Ian




_______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list



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