Skip to content

Commit 51c177e

Browse files
authored
Upgrade node-canvas dependency and test (#60)
* install font to make a direct comparison * upgrade canvas
1 parent 0600475 commit 51c177e

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

.github/workflows/node.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,8 @@ jobs:
1515
- name: Install dependencies
1616
run: npm ci
1717

18+
- name: Install CJK font
19+
run: wget https://github.com/googlefonts/noto-cjk/raw/main/Sans/OTF/SimplifiedChinese/NotoSansCJKsc-Regular.otf -O /usr/share/fonts/NotoSansCJKsc-Regular.otf && fc-cache -fv
20+
1821
- name: Run tests
1922
run: npm test

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"index.d.ts"
3434
],
3535
"devDependencies": {
36-
"canvas": "3.1.2",
36+
"canvas": "^3.2.0",
3737
"eslint": "^9.32.0",
3838
"eslint-config-mourner": "^4.1.0",
3939
"eslint-plugin-html": "^8.1.3",

test/test.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,11 @@ test('does not return negative-width glylphs', () => {
106106
assert.equal(glyph.width, 6); // zero-width glyph with 3px buffer
107107
});
108108

109-
/*
110109
test('renders Chinese and Japanese versions of characters', () => {
111-
const sdf1 = new MockTinySDF({lang: 'zh'});
110+
// assumes Noto Sans CJK SC font is installed
111+
const sdf1 = new MockTinySDF({fontFamily: 'Noto Sans CJK SC', lang: 'zh'});
112112
const glyph1 = sdf1.draw('门');
113-
const sdf2 = new MockTinySDF({lang: 'ja'});
113+
const sdf2 = new MockTinySDF({fontFamily: 'Noto Sans CJK SC', lang: 'ja'});
114114
const glyph2 = sdf2.draw('门');
115115
assert.notDeepStrictEqual(glyph1.data, glyph2.data);
116116
});
117-
*/

0 commit comments

Comments
 (0)