adobe-fonts / source-han-sans

Source Han Sans | 思源黑体 | 思源黑體 | 思源黑體 香港 | 源ノ角ゴシック | 본고딕
Other
14.36k stars 1.3k forks source link

Variable TTF has different HHEA ascender/descender values than OTF #457

Open alvinhochun opened 1 year ago

alvinhochun commented 1 year ago

Prerequisites

Description

From https://github.com/adobe-fonts/source-han-sans/releases/download/2.004R/SourceHanSans-VF.zip, the TTF versions of the font contains different HHEA ascender and descender values than that of OTF versions.

TTF has ascender, descender = 1000, -200:

$ ttx -o - -y 0 -t hhea Variable/OTC/SourceHanSans-VF.ttf.ttc
Dumping "Variable/OTC/SourceHanSans-VF.ttf.ttc" to "<stdout>"...
<?xml version="1.0" encoding="UTF-8"?>
<ttFont sfntVersion="\x00\x01\x00\x00" ttLibVersion="4.42">

Dumping 'hhea' table...
  <hhea>
    <tableVersion value="0x00010000"/>
    <ascent value="1000"/>
    <descent value="-200"/>
    <lineGap value="0"/>
    <advanceWidthMax value="3000"/>
    <minLeftSideBearing value="-991"/>
    <minRightSideBearing value="-519"/>
    <xMaxExtent value="2930"/>
    <caretSlopeRise value="1"/>
    <caretSlopeRun value="0"/>
    <caretOffset value="0"/>
    <reserved0 value="0"/>
    <reserved1 value="0"/>
    <reserved2 value="0"/>
    <reserved3 value="0"/>
    <metricDataFormat value="0"/>
    <numberOfHMetrics value="65532"/>
  </hhea>

</ttFont>

OTF has ascender, descender = 1160, -288:

$ ttx -o - -y 0 -t hhea Variable/OTC/SourceHanSans-VF.otf.ttc
Dumping "Variable/OTC/SourceHanSans-VF.otf.ttc" to "<stdout>"...
<?xml version="1.0" encoding="UTF-8"?>
<ttFont sfntVersion="OTTO" ttLibVersion="4.42">

Dumping 'hhea' table...
  <hhea>
    <tableVersion value="0x00010000"/>
    <ascent value="1160"/>
    <descent value="-288"/>
    <lineGap value="0"/>
    <advanceWidthMax value="3000"/>
    <minLeftSideBearing value="-991"/>
    <minRightSideBearing value="-519"/>
    <xMaxExtent value="2930"/>
    <caretSlopeRise value="1"/>
    <caretSlopeRun value="0"/>
    <caretOffset value="0"/>
    <reserved0 value="0"/>
    <reserved1 value="0"/>
    <reserved2 value="0"/>
    <reserved3 value="0"/>
    <metricDataFormat value="0"/>
    <numberOfHMetrics value="65532"/>
  </hhea>

</ttFont>

ttx is from fonttools 4.42.1.

punchcutter commented 1 year ago

Yes, it was reported https://github.com/google/fonts/pull/5338 a while ago. It's fixed in the Noto hotfix and will be fixed in the next update here.