[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Freetype] Line space calculation in FT 1
From: |
Rob Kramer |
Subject: |
Re: [Freetype] Line space calculation in FT 1 |
Date: |
Thu, 22 Apr 2004 23:00:57 +0800 |
User-agent: |
KMail/1.6.1 |
Hi Antoine,
On Thursday 22 April 2004 05:48 pm, Antoine Leca wrote:
> > I hope this mailing list is still alive.. :)
>
> Yes, because it is used for FT2 as well ;-)
Wow, thanks for the detailed help!
> However, you should really think about switching to FT2: FT1 is not really
> maintained, only the obvious bugs are corrected.
I'm stuck with FT1 for historical reasons on this one..
> FT1 is Truetype only. Hence baseline distance is much easier to sort out,
> there is less possible variation.
"easy" isn't the word I would use, seeing what follows. :)
Does FT2 take care of this sort of rather horrible calculations?
> Basically, you should follow Microsoft's rules here:
> <URL:http://www.microsoft.com/typography/OTSPEC/recom.htm>
Thanks!
> prop->os2->sTypoAscender - prop->os2->sTypoDescender +
> prop->os2->sTypoLineGap
> However, for reasons known only to themselves, Windows designers did use a
> formula a bit more complex:
> <CITE>
> prop->os2->usWinAscent + prop->os2->usWinDescent
> + MAX(0, prop->os2->sTypoLineGap
> - ((prop->os2->usWinAscent + prop->os2->usWinDescent)
> - (prop->horizontal->Ascender - prop->horizontal->Descender)))
> </CITE>
So, I should always use the latter formula?
> Beware on the units: os2 fields are integers, horizontal ones are
> fixed-point!
If that's the case, how come the values are the same as in os2?
(gdb) p *fp.os2
$3 = {version = 0, xAvgCharWidth = 476, usWeightClass = 700, usWidthClass = 5,
<snip>
usFirstCharIndex = 32, usLastCharIndex = 64258, sTypoAscender = 935,
sTypoDescender = -200, sTypoLineGap = 85, usWinAscent = 1191,
usWinDescent = 506, ulCodePageRange1 = 0, ulCodePageRange2 = 0}
(gdb) p *fp.horizontal
$4 = {Version = 65536, Ascender = 935, Descender = -200, Line_Gap = 85,
<snip>
Does the horizontal.Version == 0xffff mean it's not valid perhaps?
For the sake of a little experiment, let's use these values to calculate the
BTBD:
external leading = max (0, 85 - ((1191 + 506) - (935 + 200))) = 0.
BTBD = 1191 + 506 + 0 = 1697
Is that correct? To me it feels dodgy that the external leading is zero.. How
do I convert the 1697 to a number of pixels?
> When there is no OS/2 table (prop->os2->version == 0xFFFF), or when only
> the original OS/2-flavour is available (68-byte format; they are not
> handled correctly by FreeType; since nobody asks, this is not a problem in
> practice), the only remaining way is the traditional Apple one,
How would one know if it's an original OS/2 flavoured table?
Cheers!
Rob
--
Gods don't kill people, people with gods kill people.