らんだむな記憶

blogというものを体験してみようか!的なー

縦メトリクス(2)

https://docs.microsoft.com/ja-jp/typography/opentype/spec/os2
https://docs.microsoft.com/ja-jp/typography/opentype/spec/hhea

OS/2.sTypoAscenderOS/2.sTypoDescender:
これらはCJKフォントでは縦書きのideographic em-boxのtopとbottomを意図するので

OS/2.sTypoAscender = 880
OS/2.sTypoDescender = -120

https://docs.microsoft.com/ja-jp/typography/opentype/spec/recom
によると

sTypoAscender is used to determine the optimum offset from the top of a text frame to the first baseline.

とある。
また、同ページの内容よりsTypoLineGapは概ね20% of the emに近いであろうことが示唆されている。

OS/2.usWinAscentOS/2.usWinDescent:
Windowsのフォントの高さとデフォルトのline spacing(行送り)を計算するために使われる。
なんかそのわりにはそういう計算は非推奨とあるような・・・。
hhea.ascenderhhea.descender:
ベースラインからの一番高いascenderと一番低いdescenderへの距離。
line spacingについては

The typographic ascender, descender and line gap fields in conjunction with unitsPerEm should be used for this purpose.

とあるが、sTypoAscenderとsTypoDescenderはちょっと違う目的もあるので、hhea.ascenderとhhea.descenderが本来はその役目を担っているのか?
とは言え、なんかあまりusWinAscent, usWinDescentとの差異も見えにくく

hhea.ascender = OS/2.usWinAscent
hhea.descender = - OS/2.usWinDescent

が手堅そうにも感じる。

なんてことを考えつつ
https://github.com/adobe-fonts/source-han-serif/raw/release/SourceHanSerifReadMe.pdf
'OS/2' Table Overridesを見ると、案外そういうことかもしれない。

This is for the benefit of applications that use these values for determining default leading.

一方、
http://typedrawers.com/discussion/1605/os-2-fsselection-usetypometrics
を見るとOS/2.fsSelectionUSE_TYPO_METRICS bit

If set, it is strongly recommended to use OS/2.sTypoAscender - OS/2.sTypoDescender + OS/2.sTypoLineGap as a value for default line spacing for this font.

をセットすると、DirectWriteなどに影響が出て、

Specifically, you have the "USE_TYPO_METRICS" flag set in the OS/2 table (under fsSelection) which instructs the renderer to use the sTypo* metrics instead of the usWin* metrics. My suspicion is that Word2016 respects that flag, whereas Word2011 does not.

となるようだ。Word 2016とWord 2011での挙動差を埋めるにはこのbitはOFFのほうが良いのかもしれない。

・・・見ていると頭がおかしくなりそうだ・・・。
https://glyphsapp.com/tutorials/vertical-metrics
もふくめるとカオス・・・。