mirror of
https://github.com/multipleof4/stain.otf.git
synced 2026-01-14 00:27:55 +00:00
Refactor I/i: Simple vertical strokes
This commit is contained in:
@@ -1,44 +1,10 @@
|
||||
const makeGlyph = (opentype, name, unicode, cmds, adv) =>
|
||||
new opentype.Glyph({
|
||||
name,
|
||||
unicode,
|
||||
advanceWidth: adv,
|
||||
path: cmds(new opentype.Path())
|
||||
});
|
||||
|
||||
export const glyphI = (opentype, adv) =>
|
||||
makeGlyph(
|
||||
opentype,
|
||||
"I",
|
||||
"I".codePointAt(0),
|
||||
(p) => {
|
||||
p.moveTo(270, 0);
|
||||
p.lineTo(270, 700);
|
||||
p.lineTo(330, 700);
|
||||
p.lineTo(330, 0);
|
||||
p.close();
|
||||
return p;
|
||||
},
|
||||
adv
|
||||
);
|
||||
|
||||
export const glyphi = (opentype, adv) =>
|
||||
makeGlyph(
|
||||
opentype,
|
||||
"i",
|
||||
"i".codePointAt(0),
|
||||
(p) => {
|
||||
p.moveTo(270, 0);
|
||||
p.lineTo(270, 480);
|
||||
p.lineTo(330, 480);
|
||||
p.lineTo(330, 0);
|
||||
p.close();
|
||||
p.moveTo(270, 580);
|
||||
p.lineTo(270, 660);
|
||||
p.lineTo(330, 660);
|
||||
p.lineTo(330, 580);
|
||||
p.close();
|
||||
return p;
|
||||
},
|
||||
adv
|
||||
);
|
||||
const mk=(o,n,u,d,w)=>new o.Glyph({name:n,unicode:u,advanceWidth:w,path:d(new o.Path())});
|
||||
export const glyphI=(o,w)=>mk(o,"I",73,p=>{
|
||||
p.moveTo(260,0);p.lineTo(260,700);p.lineTo(340,700);p.lineTo(340,0);p.close();
|
||||
return p;
|
||||
},w);
|
||||
export const glyphi=(o,w)=>mk(o,"i",105,p=>{
|
||||
p.moveTo(260,0);p.lineTo(260,480);p.lineTo(340,480);p.lineTo(340,0);p.close();
|
||||
p.moveTo(260,600);p.lineTo(260,680);p.lineTo(340,680);p.lineTo(340,600);p.close();
|
||||
return p;
|
||||
},w);
|
||||
|
||||
Reference in New Issue
Block a user