npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

px2bfm

v1.0.2

Published

Parse pixels to BitFontMaker2 JSON font format

Downloads

2

Readme

Parse pixels to BitFontMaker2 JSON font format

Travis npm From Pittsburgh With Love

Pixels 2 BitFontMaker2 (aka px2bfm) is a simple command line tool with the intention of allowing you to use your desired pixel editor to draw font glyphs, creating compatible BitFontMaker2 JSON, and allowing you to import it to generate a new bitmap font. This doesn't replace the app, just supports it.

Table of Contents

Installation

This package requires npm and node.js. If you don't have npm or node.js on your local machine, check out this guide on getting setup.

$ npm install --global px2bfm

Alternative Installation

If you don't feel like installing it globally via npm, you can clone this repo and run the script directly:

$ ./bin/px2bfm

Usage

$ px2bfm --help

  Usage: px2bfm [options] <file>

  Parse pixels to BitFontMaker2 JSON font format
  For more info visit https://github.com/sprngr/px2bfm

  Options:

    -v, --version              output the version number
    -f, --fontname <fontname>  add name of the font
    -c, --creator <creator>    add name of the font creator
    -h, --help                 output usage information

The fontname and creator arguments are optional, but you'll probably want to set that at some point.

Example:

$ px2bfm yourFileHere.png
# Output: {A lot of JSON}

To get this into a file:

$ px2bfm yourFileHere.png > bfm2.json # Or whatever you want to call it

To put it on the clipboard to paste into the textfield on the web app:

MacOS

$ px2bfm yourFileHere.png | pbcopy

Windows

# I'm pretty sure this is a standard tool
$ px2bfm yourFileHere.png | clip

Linux

# Let's be honest, if you're on linux you're a pro at this so why do I need to tell you
$ px2bfm yourFileHere.png | xclip

Important Notes

Using one of the font templates provided (or your own, as long as it fits within required dimensions), create a pixel font.

Sprite sheets must have a width of 208px to maintain some parity with the layout of BitFontMaker2. The height of the file must be a power of 16 (default is 128px), this will allow for future support of extended character sets.

Be sure to use black (hex #000000 / rgba 0, 0, 0) for glyph pixels, the image parser only cares about those. Any other colors & alpha values are ignored.

Each glyph must fit within a 16x16 pixel block, this is required by the web app.

Example Sprite Sheet & Output

Input

Output

{
	"33": [0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 0, 8, 0, 0, 0, 0],
	"34": [0, 0, 0, 0, 20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0],
	"35": [0, 0, 0, 0, 0, 40, 40, 124, 40, 124, 40, 40, 0, 0, 0, 0],
	...
	"name": "PixelFont",
	"copy": "PixelFontMaker",
	"letterspace": "64",
	"basefont_size": "357",
	"basefont_left": "62",
	"basefont_top": "0",
	"basefont": "None",
	"basefont2": ""
}

Character Support

Currently this supports the first set of 104 characters on BitFontMaker2:

# Set 1
ABCDEFGHIJKLM
NOPQRSTUVWXYZ
abcdefghijklm
nopqrstuvwxyz
0123456789!"#
$%&'()*+,-./:
;<=>?@[\]^_`{
|}~¡¢£€¤¥¦§¨©

Extended character support is planned for the future, as well as the additional 90 character slots allowed.

Download Template

Font template includes guides. The blue dotted line creates the grid of 16x16 blocks, the red lines are the baseline like in the web app.

Downloads

License

MIT © Michael Springer 2018

BitFontMaker2 is the property of Pentacom.