xmlgraphics-fop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Manuel Mall ...@arcus.com.au>
Subject Re: svn commit: r406917 - in /xmlgraphics/fop/trunk: src/java/org/apache/fop/fonts/truetype/TTFFile.java status.xml
Date Wed, 17 May 2006 00:02:52 GMT
On Tuesday 16 May 2006 19:58, Jeremias Maerki wrote:
> 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:
> http://people.apache.org/~jeremias/fop/font-metrics-sandbox.fop.trunk
> http://people.apache.org/~jeremias/fop/font-metrics-sandbox.fop.trunk
>.after.pdf 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... :-)

Your fix triggered me looking into the specs and some actual ttf files 
and I can't make proper sense of it all as well. The whole vertical 
font metrics area seem to be quite messy, see for example: 

I don't know anything about LaTeX. Does it understand TrueType fonts? If 
so would it be worthwhile to check its source code?

Also do we know what Foray Fonts does?

Until someone comes up with a better (cleaner?) solution to determine 
the actual baseline position for a given truetype / opentype font your 
patch looks good to me.

> Jeremias Maerki


View raw message