On 5/26/05, Werner LEMBERG <[EMAIL PROTECTED]> wrote: > > > I have compiled a file documenting different metrics I have come > > across (see attached rtf.) > > Nice! Note that FreeType tries to hide (resp. unify) the various > metrics definitions as much as possible.
Any particular reasons for this? As far as I could tell the metrics definitions I could find are slightly different from each other. > > 1. What is the best way to get the ascent and descent values for Latin > > characters? (effectively 'A' to 'Z' and 'a' to 'z'.) > > This is only 52 glyphs. Simply get the metrics of them and do the > calculation by yourself! BTW, there is another complication: Many > glyphs have some vertical `overshoot' so that they are slightly larger > than the (global) ascent value of the font. This is an optical > correction normally done for glyphs with round shapes at the top or > bottom. Examples are glyph `o' or `m'. I have done this. Attached are the two metrics I got. I have 2 more questions regarding this: 1. There is discrepancy between the calculated metrics (under DIY) and those retrieved from the OpenType OS2 Table. i.e. If I compare winAscender/winDescender with Latin-1 in the Times New Roman, or the ascender under OS2 table and DIY in the New Courier. Do you know why? 2. This _really_ puzzles me. I call FT_Set_Pixel_Sizes to set the character dimensions of the desired face object (in the way shown in the attached source code.) But if I sum up any pairs of ascender/descender none of them are close to the set size. Do you know why? > > 2. What is "AFM file" as mentioned in sTypoAscender and sTypoDescender > > documentation? > > Adobe Font Metrics files are text files which accompany Type 1 > PostScript fonts (which don't contain metrics information). On > Windows box you'll sometimes fine PFM files which are something > similar. > > > Werner Thanks very much again for your help Werner. Your responses have been very helpful. Anson
Font file = C:\Documents and Settings\AnsonT\My
Documents\freetype-2.1.9\MyDemo\Debug\NCRRRU.TTF
Total # of glyphs = 609
Pixel size wanted = 30
From OpenType OS2 Table
ascender = 18 (from sTypoAscender)
descender = 6 (from sTypoDescender)
line gap = 0 (from sTypoLineGap)
WinAscent = 25 (from usWinAscent)
WinDescent = 9 (from usWinDescent)
From DIY (looping/rendering glyphs on our own)
ascender = 19 (from 'd' code=0x64)
descender = 6 (from 'p' code=0x70)
Basic Latin Ascent = 19 ('A' - 'Z', 'a' - 'z')
Basic Latin Descent = 6
Latin-1 Ascent = 25 (0x0080 - 0x00FF)
Latin-1 Descent = 7
Latin Extended A Ascent = 25 (0x0100 - 0x017F)
Latin Extended A Descent = 7
Latin Extended B Ascent = 29 (0x0180 - 0x024F)
Latin Extended B Descent = 3
Latin Extended Additional Ascent = 24 (0x1E00 - 0x1EFF)
Latin Extended Additional Descent = 6
Max Ascent = 29 (0x0000 - 0xFFFF)
Max Descent = 9Font file = c:\winnt\fonts\times.ttf
Total # of glyphs = 1296
Pixel size wanted = 34
From OpenType OS2 Table
ascender = 24 (from sTypoAscender)
descender = 7 (from sTypoDescender)
line gap = 5 (from sTypoLineGap)
WinAscent = 30 (from usWinAscent)
WinDescent = 7 (from usWinDescent)
From DIY (looping/rendering glyphs on our own)
ascender = 24 (from 'd' code=0x64)
descender = 7 (from 'p' code=0x70)
Basic Latin Ascent = 24 ('A' - 'Z', 'a' - 'z')
Basic Latin Descent = 7
Latin-1 Ascent = 31 (0x0080 - 0x00FF)
Latin-1 Descent = 8
Latin Extended A Ascent = 31 (0x0100 - 0x017F)
Latin Extended A Descent = 8
Latin Extended B Ascent = 35 (0x0180 - 0x024F)
Latin Extended B Descent = 7
Latin Extended Additional Ascent = 31 (0x1E00 - 0x1EFF)
Latin Extended Additional Descent = 7
Max Ascent = 35 (0x0000 - 0xFFFF)
Max Descent = 12
metrics.cpp
Description: Binary data
_______________________________________________ Freetype mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/freetype
