freetype-devel
[Top][All Lists]
Advanced

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

[Devel] Freetype & Ascent


From: Ken Hancock
Subject: [Devel] Freetype & Ascent
Date: Wed, 19 May 2004 17:17:25 -0500

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





reply via email to

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