Re: points, pixels, fonts and pango



On Sun, 2007-05-13 at 16:38 -0700, Pawel S. Veselov wrote:
[...]
- what is the Pango font size, and is it portable across rendering engines ?
  Now, that really to me seems to be a very basic question that I can't find
  any easy answer for :). The common definition of a font size seems to vary
  from a measurement of a specific letter, to the actual distance between max
  ascent and max descent. Pango's font size doesn't seem to be the later at
  least...

Usually font size is none of the above, but font "design size".

With metal fonts, where each letter was cast onto a piece of metal
used for printing, the letter didn't generally go all the way to the
top or the bottom of the piece of type.  As a result, the tallest
letter and the lowest descender and the widest letter form an
imaginary rectangle called the font bounding box, which is what
you're interested in, and traditionally this had to be smaller than
the type size, partly because the raised letters weren't perfectly
vertical, but had sloping sides, as otherwise bits would break off
during printing!

Finding a (font, size) pair such that the maximum extents fit into a
certain box is probably best done with binary search, I'm afraid.
Don't forget to leave a full pixel between your text and the box, so
they don't run into each other, and also don't forget that, for
example, for Western fonts, an E with a circumflex accent (Ê) is
taller than the cap height of the font, and if the font supports
non-Western scripts such as Devanagari or Arabic, there may be
even more room needed.

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org




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