[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Freefont-bugs] a comparison of FreeMono.ttf versions of 2003-06-24
From: |
James Cloos |
Subject: |
Re: [Freefont-bugs] a comparison of FreeMono.ttf versions of 2003-06-24 and 2008-03-24 |
Date: |
Wed, 09 Apr 2008 13:59:51 -0400 |
User-agent: |
Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.60 (gnu/linux) |
>>>>> "Steve" == Steve White <address@hidden> writes:
Steve> I also tried the minspace option, and could never get it to do anything.
Steve> Can you point us to documentation?
I think the code snippit from libXft said it all. With minspace=true
libXft uses accent+descent to determine the line height, otherwise it
uses freetype's metrics.height value.
Hmm. I should've quoted a bit more:
,----[ excerpt from libXft/src/xftfreetype.c ]
| descent = -(face->size->metrics.descender >> 6);
| ascent = face->size->metrics.ascender >> 6;
| if (fi->minspace)
| height = ascent + descent;
| else
| height = face->size->metrics.height >> 6;
`----
So, then, the question is what freetype uses to define the members of
the metrics struct.
face is an FT_Face. From freetype.h I see that the size member's
metrics member is an FT_Size_Metrics struct.
>From freetype.h itself:
/* ascender :: The typographic ascender of the face, */
/* expressed in font units. For font formats */
/* not having this information, it is set to */
/* `bbox.yMax'. Only relevant for scalable */
/* formats. */
/* */
/* descender :: The typographic descender of the face, */
/* expressed in font units. For font formats */
/* not having this information, it is set to */
/* `bbox.yMin'. Note that this field is */
/* usually negative. Only relevant for */
/* scalable formats. */
/* */
/* height :: The height is the vertical distance */
/* between two consecutive baselines, */
/* expressed in font units. It is always */
/* positive. Only relevant for scalable */
/* formats. */
/* */
For a TTF font, the next thing to check is freetype2/src/sfnt/sfobjs.c
where there is this comment:
/* XXX: Computing the ascender/descender/height is very different */
/* from what the specification tells you. Apparently, we */
/* must be careful because */
/* */
/* - not all fonts have an OS/2 table; in this case, we take */
/* the values in the horizontal header. However, these */
/* values very often are not reliable. */
/* */
/* - otherwise, the correct typographic values are in the */
/* sTypoAscender, sTypoDescender & sTypoLineGap fields. */
/* */
/* However, certain fonts have these fields set to 0. */
/* Rather, they have usWinAscent & usWinDescent correctly */
/* set (but with different values). */
/* */
/* As an example, Arial Narrow is implemented through four */
/* files ARIALN.TTF, ARIALNI.TTF, ARIALNB.TTF & ARIALNBI.TTF */
/* */
/* Strangely, all fonts have the same values in their */
/* sTypoXXX fields, except ARIALNB which sets them to 0. */
/* */
/* On the other hand, they all have different */
/* usWinAscent/Descent values -- as a conclusion, the OS/2 */
/* table cannot be used to compute the text height reliably! */
/* */
/* The ascender/descender/height are computed from the OS/2 table */
/* when found. Otherwise, they're taken from the horizontal */
/* header. */
/* */
and this chunk of code:
,----[ excerpt from freetype2/src/sfnt/sfobjs.c ]
| root->ascender = face->horizontal.Ascender;
| root->descender = face->horizontal.Descender;
|
| root->height = (FT_Short)( root->ascender - root->descender +
| face->horizontal.Line_Gap );
`----
So the difference in using minspace=true is that the Line_Gap isn't
included in the computation.
AFAICT the current freetype code (I looked at cvs) uses the hhea table
for all three of those values.
-JimC
--
James Cloos <address@hidden> OpenPGP: 1024D/ED7DAEA6
- Re: [Freefont-bugs] a comparison of FreeMono.ttf versions of 2003-06-24 and 2008-03-24, (continued)
- Re: [Freefont-bugs] a comparison of FreeMono.ttf versions of 2003-06-24 and 2008-03-24, Steve White, 2008/04/12
- Re: [Freefont-bugs] a comparison of FreeMono.ttf versions of 2003-06-24 and 2008-03-24, James Cloos, 2008/04/08
- [Freefont-bugs] Re: a comparison of FreeMono.ttf versions of 2003-06-24 and 2008-03-24, Joe Wells, 2008/04/08
- Re: [Freefont-bugs] Re: a comparison of FreeMono.ttf versions of 2003-06-24 and 2008-03-24, James Cloos, 2008/04/10
- Re: [Freefont-bugs] a comparison of FreeMono.ttf versions of 2003-06-24 and 2008-03-24, Steve White, 2008/04/09
- Re: [Freefont-bugs] a comparison of FreeMono.ttf versions of 2003-06-24 and 2008-03-24,
James Cloos <=
Re: [Freefont-bugs] a comparison of FreeMono.ttf versions of 2003-06-24 and 2008-03-24, Steve White, 2008/04/05