Closed timmyL17 closed 3 months ago
Can you reproduce this here? Noting that this may be related to https://github.com/diegomura/react-pdf/issues/2675
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:
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.
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 becauserestructure
does not support thex-mac-roman
encoding. Perhaps fontkit should depend strictly onrestructure
v3.0.0 untilrestructure
updates?https://github.com/foliojs/restructure/issues/60#issue-2224034510