dynotype

0.2.0 • Public • Published

Warning: This is pre-release, experimental software!

dynotype is a specialized sprite sheet generator and typesetter, designed to feed bitmap text rendering systems. This module is not capable of rendering text on its own, and should be paired with loopin-dynotype.

Quick Walkthrough

Given the following configuration file ...

# Name of the font sheet. This will be used for yaml, png and html file. 
name: hello-example
 
# Glyphs to include in the sheet. 
glyphs: Hello, world! 👍 😁
size: 48
fonts: 
  family: 'Lobster'
    # CSS for individual fonts needs a bit of tweaking. 
    css: |
      top: 6px;
      left: 6px;
 
# Set the background. In real-world usage,  
# transparent would better, 
# but this will show up in markdown. 
css: |
  body {
    background: #004
  }  

... and running from the command line ...

dynotype example/hello.yaml

... dynotype will produce this image ...

example output image from configuration above

... along with metadata describing the sprite sheet. The sheet can now be loaded in javascript and typeset.

const Dynotype = require('dynotype')
const dyno = new Dynotype()
await dyno.load('hello-example.yaml')
 
let line = dyno.line('Hello, world!')
// `line` will now contain placement of each
// glyph of the string above, using actual 
// character widths!

Installation

dynotype should be installed globally for command line use.

PhantomJS is required for sheet generation.

ImageMagick is required for blurring.

The following is for OSX, using the Homebrew package manager.

brew install phantomjs imagemagick
npm install -g dynotype

Usage

Multiple Fonts

const dyno = new Dynotype( {
  glyphs: 'First Second Font,!',
  fonts: [
    { family: 'Roboto' },
    { family: 'Lobster' }
  ]
})
 
await dyno.refresh()
 
let line = dyno.line( 'First Font, ', { font: 1 }, 'Second Font!' )

Future

  • More thorough documentation.
  • Publishing of downstream modules.
  • Support for icon libraries font-awesome and weathericons.
  • Text rendering.
  • More advanced typesetting.
  • Support for images.

Thanks

Development of dynotype, as well as other interesting, open source creative coding software, is supported by HFour.

Package Sidebar

Install

npm i dynotype

Weekly Downloads

0

Version

0.2.0

License

MIT

Unpacked Size

28.1 kB

Total Files

17

Last publish

Collaborators

  • koopero