freetype-devel
[Top][All Lists]
Advanced

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

Re: [ft-devel] Variable fonts: hhea/typo/win metrics interpreted differe


From: Nikolaus Waxweiler
Subject: Re: [ft-devel] Variable fonts: hhea/typo/win metrics interpreted differently for instances compared to static fonts?
Date: Tue, 18 Dec 2018 16:42:33 +0000

Thanks Alexei for chiming in at
https://github.com/googlei18n/fontmake/issues/492#issuecomment-448249543.

> The following seems to be different: hhea does not seem to be used in VF. 
> Compare and decide which one is correct.
>
> https://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree/src/truetype/ttgxvar.c#n1365
> https://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree/src/sfnt/sfobjs.c#n1670

The OpenType spec says nothing variation specific about hhea/typo/win
metrics, except that hhea vmetrics don't seem to be supported by the
`MVAR` in that only win and typo metrics have `MVAR` tags:

- 
https://docs.microsoft.com/en-us/typography/opentype/spec/hhea#39hhea39-table-and-opentype-font-variations
- https://docs.microsoft.com/en-us/typography/opentype/spec/mvar#value-tags
- https://docs.microsoft.com/en-us/typography/opentype/spec/os2#stypoascender
- https://docs.microsoft.com/en-us/typography/opentype/spec/os2#uswinascent

Regarding ascender, descender and height calculation in sfobjs.c and
ttgxvar.c: the math seems to be the same:

- hhea: ascender 983, descender -217, line gap 0 -> total height 1200 fU
- typo: ascender 739, descender -217, line gap 244 -> total height 1200 fU
- win: ascender 983, descender 217, line gap 0 -> total height 1200 fU

For static fonts, FT uses hhea metrics: `root->height = root->ascender
- root->descender + face->horizontal.Line_Gap;` or `983 - (- 217) + 0
= 1200`
For instances, it uses typo metrics: `root->height = root->ascender -
root->descender + face->os2.sTypoLineGap;` or `739 - (-217) + 244 =
1200`

Will look into this deeper later.



reply via email to

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