字體操作JavaScript庫:Plumin.js
Plumin.js 是一個用在瀏覽器和 Node.js 上對字體進行操作的 JavaScript 庫,示例代碼:
(function(p) {var font = new p.Font({ familyName: 'Demo', ascender: 800, descender: -100 }), a = new p.Glyph({ name: 'a', unicode: 'a', advanceWidth: 496 }), i = new p.Glyph({ name: 'i', unicode: 'i', advanceWidth: 268 }), o = new p.Glyph({ name: 'o', unicode: 'o', advanceWidth: 536 }), shape;
// a contour shape = new p.Path.RegularPolygon({ center: [268, 124], sides: 3, radius: 248 }); shape.rotate(180, [268, 124]); shape.scale(1, 1.4, [268, 0]); a.addContour(shape);
// i contour shape = new p.Path.Rectangle({ point: [60, 0], size: [140, 500] }); i.addContour(shape);
// o contour shape = new p.Path.Ellipse({ point: [50, 0], size: [436, 510] }); o.addContour(shape);
font.addGlyphs([ a, i, o ]); font.updateOTCommands() .addToFonts();
})(plumin.paper);</pre>