Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes issue #340 #341

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/tables/vhea.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
28 changes: 28 additions & 0 deletions test/vhea.js
Original file line number Diff line number Diff line change
@@ -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.');
});
});