Skip to content

Commit 56b2736

Browse files
committed
test: add test case
1 parent ab793d3 commit 56b2736

File tree

5 files changed

+56
-1
lines changed

5 files changed

+56
-1
lines changed

lib/ttf/tables/os2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ function createOS2Table(font) {
6868
// Spec: https://docs.microsoft.com/en-us/typography/opentype/spec/os2#uswinascent
6969
// ufo2ft: https://github.com/googlefonts/ufo2ft/blob/a5267d135d5a8dba7e6a5d3ac44139afa6159429/Lib/ufo2ft/fontInfoData.py#L245-L246
7070
buf.writeInt16(font.ascent + font.lineGap); // usWinAscent(Windows ascender), Fallback to ascender + typoLineGap.
71-
71+
7272
// Spec: https://docs.microsoft.com/en-us/typography/opentype/spec/os2#uswindescent
7373
// ufo2ft: https://github.com/googlefonts/ufo2ft/blob/a5267d135d5a8dba7e6a5d3ac44139afa6159429/Lib/ufo2ft/fontInfoData.py#L254
7474
buf.writeInt16(Math.abs(font.descent)); // usWinDescent(Windows descender), Fallback to descender.

test/fixtures/arrow.ttf

0 Bytes
Binary file not shown.

test/fixtures/shenheweitongguo.ttf

0 Bytes
Binary file not shown.

test/fixtures/yezi.svg

Lines changed: 29 additions & 0 deletions
Loading

test/test.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,3 +271,29 @@ describe('test wuxushenhe.svg', function () {
271271
assert.strictEqual(tables.head.xMax, 2045);
272272
});
273273
});
274+
275+
describe('test yezi.svg', function () {
276+
var src = fs.readFileSync(path.join(__dirname, 'fixtures/yezi.svg'), 'utf-8');
277+
var tables = parseFont(src).tables;
278+
279+
// Use font data generated by nanoemoji for comparison.
280+
it('head.xMin', function () {
281+
// 9235 is wrong
282+
assert.strictEqual(tables.head.xMin, 481);
283+
});
284+
285+
it('head.yMin', function () {
286+
// -11936 is wrong
287+
assert.strictEqual(tables.head.yMin, 458);
288+
});
289+
290+
it('head.xMax', function () {
291+
// 30060 is wrong
292+
assert.strictEqual(tables.head.xMax, 993);
293+
});
294+
295+
it('head.yMax', function () {
296+
// -9161 is wrong
297+
assert.strictEqual(tables.head.yMax, 745);
298+
});
299+
});

0 commit comments

Comments
 (0)