Hershey is a library for generating vector paths for the single line Hershey Font, which can be used for vector applications like rendering technical annotations on a WebGL canvas using Three.js.
You can download the font and find the format description here: https://emergent.unpythonic.net/software/hershey
Only the Roman Simplex font is supported, which includes the following characters:
abcdefghijklmnopqrstuvwxyz
ABCDEFGHIJKLMNOPQRSTUVWXYZ
.,:;!?"°$/()|-+='#&\_*[]{}<>~%@
This library will generate a set of vector paths for a string of characters. The bounds will also be included for us in justification, but the default output is that the text will be centered both horizontally and vertically.
For example:
$ npm install hershey
$ node
> const hershey = require('hershey')
> hershey.stringToPaths('AH')
{
"bounds": {
"minY":-9,
"maxY":12,
"minX":-20,
"maxX":20
},
"paths":[
[[-11,12],[-19,-9]],
[[-11,12],[-3,-9]],
[[-16,-2],[-6,-2]],
[[2,12],[2,-9]],
[[16,12],[16,-9]],
[[2,2],[16,2]]
]
}
will generate the following vector paths:
Also see test/functional/index.js for an SVG implementation in React.
See HERSHEY-LICENSE and CODE-LICENSE