freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Devel] Freetype & Ascent


From: Keith Trummel
Subject: RE: [Devel] Freetype & Ascent
Date: Mon, 28 Jun 2004 13:35:26 -0700

I was searching my old email to see if anyone responded to this, but I
couldn't find a response.  

I am encountering a similar problem.  I have a font where the ascender and
descender are 0, but in the OS/2 metric table they seem to be correct.  So I
also was wondering why despite the comments the code to use the OS/2 info is
commented out.

I also noticed that that code appears to be wrong in a couple of ways.
First, I would think the check should be:

        if ( face->os2.version != 0xFFFF && root->ascender == 0 )

instead of:

        if ( face->os2.version != 0xFFFFU && root->ascender )

Also I think the root->descender should be set as follows:

        root->descender =  face->os2.sTypoDescender;

instead of:

          root->descender = -face->os2.sTypoDescender;

and then the height computed using the negative of the descender.

Keith Trummel

-----Original Message-----
From: Ken Hancock [mailto:address@hidden
Sent: Wednesday, May 19, 2004 3:17 PM
To: address@hidden
Subject: [Devel] Freetype & Ascent


I noticed the following code in sfobjs.c is commented out:

        /* 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.    */

Is sTypoAscender (caps height) exposed anywhere?  I would think that it's
required for proper center justification since as far as I can tell
diacriticals and decenders are normally not taken into account when
determining the center position of text in a bounding box.

penPos.y = (bounds.bottom - bounds.top) / 2 +   // center of bounding box
                (pix_height * sTypoAscender / 2) -      // move down by caps
height
                (pix_height * face->ascent)             // move back up to
top of glyph bounding box

Arial, for example sets the following values:

  Ascent: 1854
 Descent:  434
Em Squre: 2048
 Leading:   67

OS/2 metric table:
 Typographic
     Ascent: 1491 (caps height of 'A')
    Descent:  431
   Line Gap:  307

     Windows
     Ascent: 1854
    Descent:  434


_______________________________________________
Devel mailing list
address@hidden
http://www.freetype.org/mailman/listinfo/devel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]