Re: layout units in UnixPangoGraphics

From: Tomas Frydrych <tf_at_o-hand.com>
Date: Sat Oct 21 2006 - 19:53:11 CEST

Hi Martin,

msevior@physics.unimelb.edu.au wrote:
> The UnixGraphics code works by allocating a font at 1440 DPI and doing all
> layout calculations at that resolution.
>
> The PangoGraphics code does not appears to do this. Instead you scale up
> from the current font to the layout resolution.

> This defeats the purpose of the of the high resolution font and explains
> the small discrepencies (of the order of 1%) between the calculated text
> widths for screen layout and print layout.
>
> I suggest that we also allocate a layout resolution font at 1440 dpi xft
> font for both screen and printing and do all our width and height
> calculations on the 1440 dpi font, then scale it down to screen and print
> resolution.

We do not control the dpi Pango works with. I assume that you suggest
using a big font at the default resolution, and using its metrics in
place of the actual font? (That is what the old graphics class does, it
works with dpi of 72).

It might be worth a try, but with Pango things are more complicated than
with the old graphics class. For one the glyph metric consist of three
rather than one value, and also the metric is context sensitive, so we
cannot cache it on per-font basis as we do in the UnixGraphics. So we
would either have to store two sets of metric for each run, adding 12
bytes / character to our memory consumption (and as the metric is stored
inside larger structures it would be involved swapping them anyway), or
scale the metric on every draw; the latter might or might not be a big deal.

The other issue doing this is that we invariably end up with inferior
screen rendering, as the screen font will not match the metric forced on
it. I have been seeing differences in metric for individual glyphs
greater than 1%, and from the win32 experience, these differences can be
quite significant, to the point of affecting usability (e.g., gaps
between characters that look like a space). I suppose the big question
is whether by WYSIWYG we mean that the printer output matches correct
screen rendering, or the that the screen matches correct printer output,
for we are always trading one for the other. My personal preference is
for the former, as I spent more time editing documents on screen than
reading them in print.

Tomas
Received on Sat Oct 21 19:54:09 2006

This archive was generated by hypermail 2.1.8 : Sat Oct 21 2006 - 19:54:10 CEST