From 236439bf6e2231434e123b02610489995e6e1ea9 Mon Sep 17 00:00:00 2001 From: multipleof4 Date: Sun, 9 Nov 2025 12:24:51 -0800 Subject: [PATCH] Refactor: Smoothen A/a geometry & spacing --- src/glyphs/A.js | 69 ++++++++++++++++++++++++++----------------------- 1 file changed, 37 insertions(+), 32 deletions(-) diff --git a/src/glyphs/A.js b/src/glyphs/A.js index b07b9a3..cb2886b 100644 --- a/src/glyphs/A.js +++ b/src/glyphs/A.js @@ -1,52 +1,57 @@ -const makeGlyph = (opentype, name, unicode, cmds, adv) => - new opentype.Glyph({ - name, - unicode, - advanceWidth: adv, - path: cmds(new opentype.Path()) - }); +const makeGlyph=(opentype,name,unicode,cmds,adv)=> + new opentype.Glyph({name,unicode,advanceWidth:adv,path:cmds(new opentype.Path())}); -export const glyphA = (opentype, adv) => +export const glyphA=(opentype,adv)=> makeGlyph( opentype, "A", "A".codePointAt(0), - (p) => { - p.moveTo(50, 0); - p.lineTo(280, 700); - p.lineTo(320, 700); - p.lineTo(550, 0); - p.lineTo(480, 0); - p.lineTo(430, 180); - p.lineTo(170, 180); - p.lineTo(120, 0); + p=>{ + const l=90,r=510,ap=700,barY=280,stem=70,innerTop=630; + p.moveTo(l,0); + p.lineTo(l+stem,0); + p.lineTo(300,innerTop); + p.lineTo(r-stem,0); + p.lineTo(r,0); + p.lineTo(320,ap); + p.lineTo(280,ap); p.close(); - p.moveTo(195, 240); - p.lineTo(405, 240); - p.lineTo(300, 620); + p.moveTo(190,barY); + p.lineTo(410,barY); + p.lineTo(390,340); + p.lineTo(210,340); p.close(); return p; }, adv ); -export const glypha = (opentype, adv) => +export const glypha=(opentype,adv)=> makeGlyph( opentype, "a", "a".codePointAt(0), - (p) => { - p.moveTo(510, 0); - p.lineTo(510, 480); - p.lineTo(300, 480); - p.curveTo(180, 480, 90, 380, 90, 240); - p.curveTo(90, 100, 180, 0, 300, 0); + p=>{ + const x=300,yBase=-10; + const bowlTop=460,asc=480; + const rOuter=210,rInner=145; + p.moveTo(x+rOuter,yBase+80); + p.curveTo(x+rOuter,yBase+10,x+80,yBase-40,x,yBase-40); + p.curveTo(x-120,yBase-40,x-210,yBase+50,x-210,yBase+210); + p.curveTo(x-210,yBase+370,x-120,bowlTop,x,bowlTop); + p.curveTo(x+85,bowlTop,x+155,bowlTop-45,x+190,bowlTop-110); + p.lineTo(x+190,asc-30); + p.lineTo(x+250,asc-30); + p.lineTo(x+250,0); + p.lineTo(x+190,0); + p.lineTo(x+190,60); + p.curveTo(x+150,yBase+10,x+85,yBase-10,x,yBase-10); p.close(); - p.moveTo(300, 60); - p.curveTo(210, 60, 150, 130, 150, 240); - p.curveTo(150, 350, 210, 420, 300, 420); - p.lineTo(450, 420); - p.lineTo(450, 60); + p.moveTo(x,yBase+40); + p.curveTo(x+95,yBase+40,x+150,yBase+115,x+150,yBase+210); + p.curveTo(x+150,yBase+305,x+95,bowlTop-40,x,bowlTop-40); + p.curveTo(x-95,bowlTop-40,x-150,yBase+305,x-150,yBase+210); + p.curveTo(x-150,yBase+115,x-95,yBase+40,x,yBase+40); p.close(); return p; },