xmlgraphics-fop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremias Maerki <...@jeremias-maerki.ch>
Subject Re: svn commit: r406917 - in /xmlgraphics/fop/trunk: src/java/org/apache/fop/fonts/truetype/TTFFile.java status.xml
Date Tue, 16 May 2006 11:58:39 GMT
Some background on my latest change. I found out that certain TrueType
fonts were off vertically inside their line area. It turned out it has
to do with different interpretations of the "ascender" and descender"
values which are part of font metrics and which FOP uses to determine
the baseline placement. FOP currently works with the assumption that the
ascender+descender fit into the "em box". However, in some TrueType
fonts the ascender is sometimes given as the maximum elevation of a font
which can go way beyond the em box. BTW, this is always true for
Java2D/AWT which makes determining the baseline difficult. I've recently
implemented similar "hacks" in the AWT font metrics adapter which I'll
commit shortly.

You can see the effect of rev 406917 here:
The second and third lines are painted using TrueType fonts, the first
is a base 14 font and the last a Type 1 font.

IMO, my change is an improvement but not a clean fix. I think TrueType
has better information on the baseline somewhere (havn't found it, yet).
I didn't look closer into the cases where multiple accents are stacked
on a glyph. That's basically the reason why the fonts can go beyond the
em box. At some point we may need to revisit our model of line building
to accomodate these glyphs. I guess I have to buy a book about
typography one day... :-)

On 16.05.2006 13:45:01 jeremias wrote:
> Author: jeremias
> Date: Tue May 16 04:44:57 2006
> New Revision: 406917
> URL: http://svn.apache.org/viewcvs?rev=406917&view=rev
> Log:
> Improved baseline detection in TTFReader for TrueType fonts. Ascender and descender values
were sometimes not in line with FOP's expectations.
> Changed some log output from debug to trace level.
> Modified:
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/truetype/TTFFile.java
>     xmlgraphics/fop/trunk/status.xml

Jeremias Maerki

View raw message