You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When encoding a subset of a font with set variations, I get
TypeError: First argument to DataView constructor must be an ArrayBuffer
at new DataView (<anonymous>)
at new $1ed46182c1410e1d$export$9b4f661deaa36c3e (.\node_modules\restructure\dist\main.cjs:111:21)
at $2784eedf0b35a048$export$2e2bcd8739ae039.encodeSimple (.\node_modules\fontkit\dist\main.cjs:12138:22)
at $fe042f4b88f46896$export$2e2bcd8739ae039._addGlyph (.\node_modules\fontkit\dist\main.cjs:12179:36)
at $fe042f4b88f46896$export$2e2bcd8739ae039.encode (.\node_modules\fontkit\dist\main.cjs:12209:43)
at Object.<anonymous> (.\index.js:23:22)
at Module._compile (node:internal/modules/cjs/loader:1191:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1245:10)
at Module.load (node:internal/modules/cjs/loader:1069:32)
at Function.Module._load (node:internal/modules/cjs/loader:904:12)
Code to reproduce:
varfontkit=require('fontkit');varfs=require('fs');// load file osans.ttf into a buffer synchonouslyvarbuffer=fs.readFileSync('osans.ttf');// open a font synchronouslyvarfont=fontkit.create(buffer).getVariation({wght: 800,wdth: 75});// layout a string, using default shaping features.// returns a GlyphRun, describing glyphs and positions.varrun=font.layout('hello world!');// create a font subsetvarsubset=font.createSubset();run.glyphs.forEach(function(glyph){subset.includeGlyph(glyph);});letbuffer2=subset.encode();fs.writeFileSync('subset.ttf',buffer2);
This is likely due to EncodeStream taking not the length directly, but an Uint8Array (or at least I think so, I'm not completely sure).
I think it could be fixed by changing
When encoding a subset of a font with set variations, I get
Code to reproduce:
(osans.ttf is the open sans font file obtained from https://fonts.google.com/specimen/Open+Sans)
This is likely due to EncodeStream taking not the length directly, but an Uint8Array (or at least I think so, I'm not completely sure).
I think it could be fixed by changing
fontkit/src/glyph/TTFGlyphEncoder.js
Line 127 in a5fe0a1
To
Or something like this
The text was updated successfully, but these errors were encountered: