Skip to content

Latest commit

 

History

History
30 lines (24 loc) · 1.05 KB

samsa-core.md

File metadata and controls

30 lines (24 loc) · 1.05 KB

Samsa-Core (samsa-core.js)

Samsa-Core is the JavaScript library at the heart of Samsa. There are two fundamental classes: SamsaFont and SamsaGlyph, with properties and methods described below for parsing variable fonts (VFs), creating VF instances, converting glyph outlines to SVG, and exporting static TTFs.

These functions are used in the graphical tool Samsa-GUI, the command-line utility Samsa-CLI and the polyfill demo Samsa-Polyfill.

References

Code Examples

A SamsaFont can be initialised in any of the following ways:

//from a URL
let vf = new SamsaFont({
  fontFamily: "FontNameShouldGoHere",
  url: "fonts/Sans_Variable.ttf",
  callback: function (font) {}
});

//from a font file upload
let vf = new SamsaFont({
  arrayBuffer: e.target.result,
  inFile: file.name,
  filesize: file.size, //Optional
  date: file.lastModified, //Optional
  callback: function (font) {}
});