[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Freetype] Unexpected advance values
From: |
Werner LEMBERG |
Subject: |
Re: [Freetype] Unexpected advance values |
Date: |
Thu, 22 Jul 2004 06:21:14 +0200 (CEST) |
> I am running my trial with a string of 50 "i".
>
> - Font is Century Schoolbook L Roman
> - Both GhostScript and Freetype2 load the font from the file
> c059013l.pfb
> - I print the kerning, it's always 0
> - xfig sets the string width to 3000, which makes an advance of 60
> per i
> - Freetype2 reports a width of 55 and an advance.x of 63 (which is
> 5% too much).
Hmm, looking into the metrics file c059013l.afm (which FreeType
doesn't use if not explicitly loaded with FT_Attach_File), I see that
there is indeed no kerning between pairs of `i', and that the
horizontal advance value of `i' is 315 font units -- the same value is
actually used in the PFB file. With 12pt at 1200dpi and 1000 font
units per em (as the default in Type 1 fonts), this makes
12 * 1200
--------- / 1000 * 315 = 63
72
Having 50 `i' glyphs, this makes 50 * 63 = 3150. In the unlikely case
that I have to remove the left side bearing from the first `i' (18
font units) and the right side bearing from the last `i' (26 font
units), I get 3150 - 8.8 = 3141.2.
Testing with gs, I get the following:
> gs
AFPL Ghostscript 8.14 (2004-02-20)
Copyright (C) 2004 artofcode LLC, Benicia, CA. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
GS>(CenturySchL-Roma) findfont
Loading CenturySchL-Roma font from
/usr/local/share/ghostscript/fonts/c059013l.pfb...
2235788 901660 1442288 145674 1 done.
GS<1>12 1200 72 div mul scalefont
GS<1>setfont
GS>(i) stringwidth
GS<2>stack
-0.0
62.9991
As you can see, `gs' also returns 63 as the string width of the
glyph `i'. For 50 `i', I get 3149.96 as the result of the
`stringwidth' operator.
I have never used xfig so I can't comment.
Werner