freefont-bugs
[Top][All Lists]
Advanced

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

[Freefont-bugs] FreeFont face-level height metric


From: Michael T. Dean
Subject: [Freefont-bugs] FreeFont face-level height metric
Date: Wed, 18 Jul 2007 16:27:29 -0400
User-agent: Thunderbird 2.0.0.0 (X11/20070524)

I have been working on the MythTV project ( http://www.mythtv.org/ ).
Included in the MythTV distribution are copies of three of the fonts
from the FreeFont package (FreeMono, FreeSans, and FreeSansBold), which
are used for display of captions and subtitles and for creation of menus
for DVD's.

For years, we had been using an old version of the fonts (i.e. FreeSans
marked Revision 0.15) from 2002-03-05 or before.  Recently, we updated
the fonts (FreeSans marked Revision 1.76) to gain some of the more
recently added glyphs (i.e. those for musical symbols).

In all the locations where the font is used, we lay out the text using
FreeType.  The C++ code used for captions and subtitles has full access
to FreeType, so for calculating the line height, we find the difference
between the max ascent and max descent for the glyphs in use on that
line, and the lines are properly spaced.

The code used to create DVD's, on the other hand, is written in Python.
The Python code uses Python Imaging Library (PIL) to access the TrueType
font, glyphs, and metrics.  Unfortunately, PIL provides only limited
support for FreeType metrics.  It does not support accessing glyph-level
metrics (FT_Glyph_Metrics), so we had been using the face-level height
(from FT_Size_Metrics).

This approach worked well with the old version of the font.  When we
requested a 19-pixel tall font, the "line" height reported by the face
was 22 pixels (allowing appropriate inter-line spacing).  However, after
upgrading the font version, we've noticed that the new face height for
the same 19-pixel tall font is 36 pixels, which would require
overlapping "text boxes" to provide the desired intra-line spacing.

The difference is due to the change in the values of the OS/2 metrics.
The metrics were previously specified, but in the new version have been
changed to 0.  If I change the values to equal the scaled values from
the previous version (scaled to accommodate the change of Em Size from
1000 to 2048), the face metrics stay the same.  The behavior of the font
with the old metrics is much more in keeping with that of other fonts
(such as Bitstream Vera and Red Hat Liberation).

The values I used for the metrics in FreeSans are:

Typo Ascent Offset: 700
Typo Descent Offset: -530
Typo Line Gap: 185
HHead Ascent Offset: -700
HHead Descent Offset: 530
HHead Line Gap: 185

with "Is Offset" checked for all values for which the setting is available.

As we would prefer not using a custom version of the fonts (keeping our
version identical to "upstream"), I was hoping someone could clarify
that the changes to the face metrics were intended. If they are not
intended, I would be happy to modify the sfd files for you (or send you
the list of values for each font).

Also, is the change of the OS/2 Sub/Super Superscript Offset Y to 0
intended?  It was 200 (same as Size Y) for all the old versions of
fonts.  (This one doesn't affect us, but I noticed the difference when
looking into the issue that does affect us.)  The values in the TTF
don't seem to be the same as those in the SFD, so this may be an export
issue, rather than a design issue.

Thanks for your time and for the great work on the font.

Mike Dean




reply via email to

[Prev in Thread] Current Thread [Next in Thread]