Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/greggman/font-utils
Some font utils I wrote to generate fonts for gamemaker
https://github.com/greggman/font-utils
deltarune fonts gamemaker gamemaker-studio-2
Last synced: 3 days ago
JSON representation
Some font utils I wrote to generate fonts for gamemaker
- Host: GitHub
- URL: https://github.com/greggman/font-utils
- Owner: greggman
- Created: 2019-01-15T07:10:12.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-11-17T22:16:47.000Z (12 months ago)
- Last Synced: 2024-04-14T06:08:09.978Z (7 months ago)
- Topics: deltarune, fonts, gamemaker, gamemaker-studio-2
- Language: C
- Homepage:
- Size: 3.29 MB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Some font utils used in a gamemaker project
Note I'm dumping these here as a place to back them up.
If you find them useful good for you but don't expect
any support.They will not work out of the box. In particular the fonts
used are not included.# Gamemaker Issues
The problems with gamemaker and fonts
1. gamemaker requires all glyphs to be the same height.
So a period (.) takes the same vertical space as the letter B
2. gamemaker doesn't understand that glyphs can be larger than their font size
In other words you set a font size for 20 pixels but some glyphs might actually
extend above the top of a 20 pixel tall area as well as belowThe tools below, you give them a font-size (the size the render the glyphs),
a glyph-height (the size to make the box the glyph will be put inside),
and a y-offset (how many pixels down from the top of the box to start rendering)There's an option passed in, error-on-crop, that basically makes the generator
fail if any glyph extends out of the box. Looking at the error messages you can
tell if you need more space above (in which case make y-offset bigger) or more
space below (in which case make glyph-height bigger). Of course whenever you
make y-offset bigger you move all the glyphs down in their box so you probably
have to make glyph-height bigger on those cases.The only other thing I think is not clear maybe is font-index. Some .ttf files have
multiple fonts inside. Here they are references by index. If you double click a .ttf
file a viewer will come up and you can prev/next to see the fonts and figure out
the index.# prerequisites
* Windows 10 (otherwise you need to build font-altas-generator-freetype2)
* Install node.js from https://nodejs.org
* setup your folders like this+-somefolder
+-fonts (contents of fonts.zip)
+-build-new/yourproject (gamemaker project)* open a node command prompt (or some command prompt with node.js in your path)
cd fonts/gen-font
npm install
cd ../fonts/make-fonts
npm install# To generate the fonts
cd fonts
node make-fonts/make-fonts.jsIf you only want to generate some fonts you can add --font=substr as in
node make-fonts/make-fonts.js --font=tiny
which will only generate fonts with the word "tiny" in them
# make-fonts/make-fonts.js
This is effectively just a batch file but using JavaScript so I can filter etc.
It calls `node ../gen-font/gen-font.jsIf you look inside you'll see settings for each font. Example
{
fontName: "Name of Font",
font: "Fonts-for-Gregg/Name Of Font.ttf",
glyphHeight: 14,
fontSize: 10,
yOffset: 1,
light: true,
alphaMin: 10,
alphaMax: 144,
debugColor: "0x0000FF",
outputName: "fnt_ja_small",
},Most of the options are passed to gen-font.js an so are more documented there
# gen-font/gen-font.js
This calls the font generator, read the output and copies the results into
the gamemaker folders.# font-atlas-generator-freetype2
This is a C/C++ app that uses FreeType2 (a font library) to try to generate a font.
It saves out a .png file and a .json file with data about the glphys it wrote.