Creates signed distance fields out of OpenType/TrueType fonts
npm install @mapka/font-sdfGenerates Signed Distance Field glyphsets from OpenType fonts. Generated glyphs are stored in protobuf.
This is fork of fontnik with some changes.
``sh`
npm install @mapka/font-sdf
or
yarn add @mapka/font-sdf
`ts
import {
fontToGlyphs,
readFont.
decode
} from "@mapka/glyph-pbf";
// Read a font saved as a PBF and decode it.
const sdf = readFileSync("fonts/OpenSans-Regular.pbf");
const pbf = decode(sdf);
// Read a font and generate glyphs for the range 0-255.
const font = readFont("fonts/OpenSans-Regular.ttf");
const buffer = fontToGlyphs(font, 0, 255);
``