diff --git a/src/tables/vhea.js b/src/tables/vhea.js index 004cdf93..e668a5a7 100644 --- a/src/tables/vhea.js +++ b/src/tables/vhea.js @@ -2,11 +2,11 @@ import * as r from 'restructure'; // Vertical Header Table export default new r.Struct({ - version: r.uint16, // Version number of the Vertical Header Table + version: r.fixed32, // Version number of the Vertical Header Table ascent: r.int16, // The vertical typographic ascender for this font descent: r.int16, // The vertical typographic descender for this font lineGap: r.int16, // The vertical typographic line gap for this font - advanceHeightMax: r.int16, // The maximum advance height measurement found in the font + advanceHeightMax: r.uint16, // The maximum advance height measurement found in the font minTopSideBearing: r.int16, // The minimum top side bearing measurement found in the font minBottomSideBearing: r.int16, // The minimum bottom side bearing measurement found in the font yMaxExtent: r.int16, diff --git a/test/vhea.js b/test/vhea.js new file mode 100644 index 00000000..c19da29e --- /dev/null +++ b/test/vhea.js @@ -0,0 +1,28 @@ +import assert from 'assert'; +import * as fontkit from 'fontkit'; + +describe('vhea table test', function () { + const font = fontkit.openSync(new URL('data/NotoSansCJK/NotoSansCJKkr-Regular.otf', import.meta.url)); + + it('should retrieve vhea table correctly', function () { + const actualVheaObject = font.vhea; + + const expectedVheaObject = { + version: 1.0625, + ascent: 500, + descent: -500, + lineGap: 0, + advanceHeightMax: 3000, + minTopSideBearing: -1002, + minBottomSideBearing: -677, + yMaxExtent: 2928, + caretSlopeRise: 0, + caretSlopeRun: 1, + caretOffset: 0, + metricDataFormat: 0, + numberOfMetrics: 65167, + }; + + assert.deepStrictEqual(actualVheaObject, expectedVheaObject, 'The vhea table does not match the expected format.'); + }); +});