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: Behdad Esfahbod
Subject: Re: [ft-devel] Variable fonts: hhea/typo/win metrics interpreted differently for instances compared to static fonts?
Date: Tue, 18 Dec 2018 12:53:35 -0500

On Tue, Dec 18, 2018 at 11:43 AM Nikolaus Waxweiler <address@hidden> wrote:
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:

The reasoning for that was that varfonts should set OS/2 useTypoMetrics bit on and as such only one set of values need variation.  I would say if that bit is off then the respective MVAR tags should be applied to hhea values.

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

_______________________________________________
Freetype-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/freetype-devel


--
behdad
http://behdad.org/

reply via email to

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