Skip to content
Modules for simplifying fonts into arrays of vertex lists
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
bin
lib
README.md
package.json
yaml2scad.js

README.md

spaggers

This is a collection of converters to the font format used by Spiff.scad.

yaml2scad.js

A node.js script for converting a YAML-based definition of glyph points to a Spiff.scad-compatible font. Takes the input filename as the first command line parameter and the output filename as the second command line parameter.

Expected YAML format

  • name: The name of the font (eg. Spiff Sans). Output as comment.
  • author, version: Also output as comments. Pretty self-explanatory.
  • prefix: The name of the variable to assign the font to.
  • glyphs: Mapping of glyphs to point definitions. Glyph definitions can be represented as an object with paths and width values, or as just the content of the paths value (in which case the width will be calculated as the rightmost-point in the paths). paths can be represented as a single path or array of paths (if the glyph is constructed of multiple paths), and each individual path can be represented as either an array of point coordinate pair arrays (eg. [[2,2],[2,4],[4,4],[4,2]]) or a string separating each coordinate by space or comma, a la SVG (eg. "2,2 2,4 4,4 4,2").
  • noglyph: The fallback glyph to use.

See spiffsans.yaml for an example.

Example usage

node bin/yaml2scad.js spiffsans.yaml spiffsans.scad

Coming soon

A browser-based SVG font converter (and maybe a browser implementation of yaml2scad).

Something went wrong with that request. Please try again.