Fix: Use glyphs array instead of addGlyph

This commit is contained in:
2025-11-09 08:58:32 -08:00
parent b19dcf3751
commit 4236fbb5a9

View File

@@ -18,24 +18,24 @@ const ascender = 800;
const descender = -200; const descender = -200;
const advanceWidth = 600; const advanceWidth = 600;
const glyphs = [
glyphA(opentype, advanceWidth),
glypha(opentype, advanceWidth),
glyphB(opentype, advanceWidth),
glyphb(opentype, advanceWidth),
glyphC(opentype, advanceWidth),
glyphc(opentype, advanceWidth)
];
const font = new opentype.Font({ const font = new opentype.Font({
familyName, familyName,
styleName: "Regular", styleName: "Regular",
unitsPerEm, unitsPerEm,
ascender, ascender,
descender, descender,
glyphs: [] glyphs
}); });
const addGlyph = (g) => font.addGlyph(g);
addGlyph(glyphA(opentype, advanceWidth));
addGlyph(glypha(opentype, advanceWidth));
addGlyph(glyphB(opentype, advanceWidth));
addGlyph(glyphb(opentype, advanceWidth));
addGlyph(glyphC(opentype, advanceWidth));
addGlyph(glyphc(opentype, advanceWidth));
const otfBuffer = Buffer.from(font.toArrayBuffer()); const otfBuffer = Buffer.from(font.toArrayBuffer());
const baseName = "Stain"; const baseName = "Stain";
const otfPath = path.join(outDir, `${baseName}.otf`); const otfPath = path.join(outDir, `${baseName}.otf`);