mirror of
https://github.com/multipleof4/stain.otf.git
synced 2026-01-14 00:27:55 +00:00
Fix: Use glyphs array instead of addGlyph
This commit is contained in:
@@ -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`);
|
||||||
|
|||||||
Reference in New Issue
Block a user