-
Notifications
You must be signed in to change notification settings - Fork 0
Font
This page contains information about the font used by Turmitor, how it is used, and how it can be changed.
Warning
The font format is going to change in the future. I will be moving to a more flexible format that will allow for more than just 6x9 fonts. This will be a breaking change, so be prepared for it, if you are relying on the font format in its current form. Jump to the Future Changes section for more information.
The font file extension is fbmp
, which stands for "Font BMP". This is because
the font is stored in an extremely basic bitmap format.
The format of the font file is as follows:
- The first 4 bytes are a string literal "FBMP".
- The next 2 bytes are the width of the font (
<I2
). We store this since we save bits in the font data, and the last byte of each row may not be full. - The remaining bytes are the font data. One bit per pixel, with a '1' being a foreground color and a '0' being a background color.
Currently, each character in the font is expected to be 6x9 pixels, with a 1-pixel gap between each pixel (including at the edges of the font).
As stated in the warning above, I will be moving to a more flexible format. The format will remain fairly simple, but will contain information about character sizes and spacing, as well as space for flags and other metadata.
- The first 4 bytes will be a string literal "FBMP".
- The next byte stores flags (see below).
- The next byte stores metadata length (
<B
) (currently 4, as it excludes this byte and the previous flags byte). - The next 2 bytes will be the width of the font (
<I2
). - The next 1 byte is the edge padding of the font (
<B
). - The next 1 byte is the character spacing of the font (
<B
). - The remaining bytes are the font data. One bit per pixel, with a '1' being a foreground color and a '0' being a background color.
The flags byte will contain information about the font. No flags currently exist, but I am leaving this open for future expansion.
Currently, you can change the font, it is just required to follow the format
specified above. The font is stored in data/font.fbmp
, just replace that file
with your own font file.