Feat: Add basic author metadata to font

This commit is contained in:
2025-11-09 12:28:39 -08:00
parent 58e03692b7
commit 27f133f7ae

View File

@@ -36,6 +36,7 @@ const outDir = path.join(__dirname, "..", "dist");
if(!fs.existsSync(outDir))fs.mkdirSync(outDir,{recursive:true}); if(!fs.existsSync(outDir))fs.mkdirSync(outDir,{recursive:true});
const familyName="Stain"; const familyName="Stain";
const styleName="Regular";
const unitsPerEm=1000; const unitsPerEm=1000;
const ascender=800; const ascender=800;
const descender=-200; const descender=-200;
@@ -49,8 +50,9 @@ const mkGlyph = (name, unicode, adv, pathFn) =>
path:pathFn(new opentype.Path()) path:pathFn(new opentype.Path())
}); });
const glyphSpace = mkGlyph("space", " ".codePointAt(0), 260, (p) => p); const glyphSpace=mkGlyph("space"," ".codePointAt(0),260,p=>p);
const glyphPeriod = mkGlyph("period", ".".codePointAt(0), 260, (p) => { const glyphPeriod=mkGlyph("period","."
.codePointAt(0),260,p=>{
p.moveTo(80,0); p.moveTo(80,0);
p.lineTo(80,120); p.lineTo(80,120);
p.lineTo(180,120); p.lineTo(180,120);
@@ -118,11 +120,12 @@ const glyphList = [
const font=new opentype.Font({ const font=new opentype.Font({
familyName, familyName,
styleName: "Regular", styleName,
unitsPerEm, unitsPerEm,
ascender, ascender,
descender, descender,
glyphs: glyphList glyphs:glyphList,
copyright:"Author: Anon"
}); });
const buf=Buffer.from(font.toArrayBuffer()); const buf=Buffer.from(font.toArrayBuffer());