Newest version of restructure doesn't support all string encodings
timmyL17 opened this issue ยท 6 comments
It appears that the newest version of restructure
does not support all string encodings. When I tried to open a font file on my mac, the font name fields were all null because restructure
does not support the x-mac-roman
encoding. Perhaps fontkit should depend strictly on restructure
v3.0.0 until restructure
updates?
Can you reproduce this here? Noting that this may be related to diegomura/react-pdf#2675
Repro!
var fontkit = require('fontkit');
// open a font synchronously
var font = fontkit.openSync('src/arial-bold.ttf');
// layout a string, using default shaping features.
// returns a GlyphRun, describing glyphs and positions.
var run = font.layout('hello world!');
// get an SVG path for a glyph
var svg = run.glyphs[0].path.toSVG();
// create a font subset
var subset = font.createSubset();
run.glyphs.forEach(function(glyph) {
subset.includeGlyph(glyph);
});
console.log('name:'+font.getName());
console.log('fullname:'+font.fullName);
let buffer = subset.encode();
console.dir({buffer});
fullnae is Arial Bold
under restructure@3.0.0, null for restructure@3.0.1
also repro:
- clone fontkit
npm i
npm t
(passes)npm i --save restructure@3.0.1
npm t
(fails)
Here https://github.com/foliojs/fontkit/blob/master/src/tables/name.js#L13
Is where random encodings are passed to restructure.
Thanks, you beat me to it. That was essentially my repro. I should have posted it at the beginning.
Fixed by foliojs/restructure#62