Coder Social home page Coder Social logo

bmfont-lato's Introduction

bmfont-lato

experimental

Lato packed as a BMFont JSON object, so it can be required for testing.

This also exports an images field, which is an array of ndpack-images parallel to the pages array.

var Lato = require('bmfont-lato')

//do something with the ndarrray image
var shape = Lato.images[0].shape.slice(0, 3))

//e.g. image shape is 512x512x4
console.log(shape)

//BMFont fields..
console.log(Lato.info)
console.log(Lato.chars)
console.log(Lato.kernings)

Since all glyphs have been packed into a single image, the paths and images array will have a length of 1.

The ndarray image contains 4 Lato Regular fonts packed with gdx-fontpack, each of which can be required separately:

  • require('bmfont-lato/16')
  • require('bmfont-lato/24')
  • require('bmfont-lato/32')
  • require('bmfont-lato/64')

The default exported font is 32 (the size is in px).

URI

You can also just grab the data URI like so:

  • require('bmfont-lato/image-uri')

Usage

NPM

Build

See package.json scripts on how to build. You need these tools:

npm install ndpack-image bmfont2json module-exports -g

Then:

#first you need to build an atlas with your tool of choice
# ...

#then pack it with ndpack-image
npm run pack

#then export all fonts as CommonJS
npm run fonts

License

MIT, see LICENSE.md for details.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.