Text plugin for Zdog
npm install zfont
A text plugin for the Zdog 3D engine! Renders TrueType fonts via Typr.js | jaames.github.io/zfont
Features | Caveats | Demo | Installation | Usage | API | Zdog.Font | Zdog.Text | Zdog.TextGroup | Todo | Building
* Built on top of Typr.js, which supports a wide range of .ttf and .otf fonts with speed and grace
* Less than 14kB minified and gzipped
* No need to worry about waiting for fonts to load; text automatically pops into existence once the font is ready
* Includes support for multiline text
* Update font, text, color, alignment, etc at any time
* Bonus utilities for measuring text, waiting for font load & more!
* You have to provide a .ttf to use yourself; it isn't possible to use system fonts
* Character range is limited to whichever glyphs are supported by your chosen font, and font stacks/fallbacks aren't supported yet
A live demo can be found here, there's also some more in-depth examples on Codepen!
``bash`
$ npm install zfont --save
If you are using a module bundler like Webpack or Rollup, import Zfont into your project:
`javascript
// Using ES6 module syntax
import Zfont from 'zfont';
// Using CommonJS modules
const Zfont = require('zfont');
`
`html`
When manually including the library like this, it will be globally available on window.Zfont
Development version
Uncompressed at around 75kB, with source comments included
Production version
Minified to 45kB
Then add it to the
of your page with a