fix font crash

This commit is contained in:
daniel-j 2018-03-14 21:02:15 +01:00
parent 56ad15d8b0
commit 80512e657b

View file

@ -10,7 +10,7 @@ async function subsetFont (fontPath, glyphs, options = {}) {
let fontdata = Buffer.from(fontPath, 'binary') let fontdata = Buffer.from(fontPath, 'binary')
let type = fileType(fontdata) let type = fileType(fontdata)
if (type && type.mime === 'font/ttf') { if (type && type.mime === 'font/ttf') {
data = fontdata data = fontdata.buffer
} else { } else {
if (!isNode || !options.local) { if (!isNode || !options.local) {
data = await fetch(fontPath, 'arraybuffer') data = await fetch(fontPath, 'arraybuffer')