Table of contents
- Table of contents
- Font Metadata
- Aseprite Metadata
- Known issues
- Design Principles
- License (GPL-3.0-only)
npm i mem-font
See the changelog for release notes.
- *.ttf: TrueType font file. The format is
mem-<variable width>-<width>x<height>where "variable width" is
propfor proportional or
monofor monospaced, and width and height are cel width and height in pixels. Files containing "-aseprite" in their name have their kerning multiplied for correct rendering in Aseprite.
- *.json: font metadata (kerning and other metrics for games).
- *-sheet.png: 1x spritesheet (for games)
- *-sheet.json: 1x Aseprite metadata (for games)
- *.sfd: FontForge file (mostly for debugging the TTF).
- *-10x-sheet.png: 10x spritesheet (mostly for demoing in the readme and easier diffing).
- *-10x-sheet.json: Aseprite metadata for the 10x spritesheet.
- *.ttfdump: True Type Font File Dumper dumps for each TTF (for debugging and tracking changes). Files containing "-aseprite" in their name have their kerning multiplied for correct rendering in Aseprite.
All characters in each font set appear below. Blank cels are missing (undefined) characters. The fonts are ordered from greatest to least line height with tie breakers going to greatest width then proportional font.
mem mono 4x4
mem mono 3x3
Additional information for the font including name, kerning, and other layout metrics.
Additional information spritesheet interpretation. See the aseprite-atlas definition.
- Aseprite kerning is strange. As a workaround, Aseprite-specific files are generated with the kerning multiplied by the cell height. It's also quite possible this font has incorrect kerning.
- Sprite sheet dimensions are not powers of two.
- Live Server now appears unmaintained. Caching must be disabled via browser Dev Tools for changes to appear.
See the to-do for more issues.
- Excellent high- and low-scale readability, smoothness (pixel clustering), and visual consistency of the whole character set at the expense of form adherence for individual characters. For example, the lowercase o could be rounder but this comes at the cost of making the font noisier and it is very legible square rather than round. As a counterexample, the lowercase p could be smoother but then it looks too similar to the lowercase o so some exceptions are made.
- Favor 3x5 pixels for every capital character.
- Favor 3x4 pixels for every lowercase character.
- Every numeric is the same width and height, 3x5 pixels, so that countdowns don't shift.
- The preferred inflection for lowercase is one pixel from the top, for the sake of e. Everything else is two pixels from the top.
- The font is sans so avoid serifs.
- The font is light so avoid pixel doubling.
The development workflow is based around the
start NPM script:
npm -s start
However, you must manually call
npm -s run build to see any font changes.
i: install project dependencies.
t: run all tests. See tests.
run format: apply lint fixes automatically where available.
version: increment the version and publish a new release. See versioning.
💡 Tip: add
-s to omit verbose command echoing. E.g.,
npm -s i or
npm -s run format.
Undocumented scripts are considered internal utilities and not expressly supported workflows.
- Font metadata JSON is type-checked with TypeScript to ensure it conforms to the shape expected.
- Additional properties can leak in but the advertised API must be true.
Aseprite is open-source and excellent for pixel graphics. A big chunk of this repo is making a workflow from Aseprite through FontForge.
GIMP was used up through v4.0.0 but I like Aseprite a lot better for pixeling.
- Aseprite v1.2.20-x64
- FontForge v20190801
- Potrace v1.16
- True Type Font File Dumper (ttfdump) v2019.20190605.51237-3build2
You can install the latter three on Ubuntu with
sudo apt install fontforge potrace texlive-binaries.
Image diffing with Git is useful for verifying changes but requires a custom configuration. One possible setup is described in git-diff-img
Testing the TTF
On Ubuntu, symlink the TTFs in dist to ~/.fonts. You may need to regenerate your
font cache depending on the change made:
fc-cache -f -v. The latter seems
necessary for GIMP (and takes effect on next any text layout change) but not
Aseprite which references the TTF files directly.
- Creating a Pixel Font for Your Game
- FontForge Documentation
- FontForge Python Scripting
- FontForge Bitmap Strikes Documentation
© Stephen Niedzielski.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.