Skip to content

Commit 3002ef8

Browse files
author
Olivier Bonnaure
committed
feat : add gen_metrics.js to generate font metrics
1 parent 44bd096 commit 3002ef8

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

gen_metrics.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const opentype = require('opentype.js');
2+
3+
opentype.load(process.argv[2], function (err, font) {
4+
var codes = {}
5+
6+
for(let i = 32; i < 257; i++) {
7+
codes[i] = font.getAdvanceWidth(String.fromCharCode(i), 1000)
8+
}
9+
console.log(JSON.stringify(codes))
10+
})

0 commit comments

Comments
 (0)