Bitmap Provider#

The bitmap provider defines simple bitmap glyphs - glyphs from textures. It references a single PNG file and declares a "charlist", which is a list of strings.

The characters inside each string entry inside the charlist will be mapped to the corresponding positions in the referenced file.

_images/anatomy.svg

The anatomy of a glyph#

Structure#

{
    "type": "bitmap",
    "file": "minecraft:font/ascii.png",
    "ascent": 7,
    "height": 8,
    "chars": [
        "                ",
        "                ",
        " !\"#$%&'()*+,-./",
        "0123456789:;<=>?",
        "@ABCDEFGHIJKLMNO",
        "PQRSTUVWXYZ[\\]^_",
        "`abcdefghijklmno",
        "pqrstuvwxyz{|}~\u0000",
        "                0",
        "              £  ƒ",
        "      ªº  ¬   «»",
        "░▒▓│┤╡╢╖╕╣║╗╝╜╛┐",
        "└┴┬├─┼╞╟╚╔╩╦╠═╬╧",
        "╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀",
        "             ∅∈ ",
        "≡±≥≤⌠⌡÷≈°∙ √ⁿ²■ "
    ]
}

Height#

The height field is the scale of the resulting glyph.

This scale should generally match the a glyph's individual height, or be a power of it.

While heights outside of this recommended range are allowed and are valid, mcfonts will warn about their presence, and the resulting glyphs declared inside the provider will appear warped.

The height field is optional. When not put, it defaults to 8, regardless of the underlying texture resolution.

Ascent#

The ascent field is the amount of vertical shifting is applied to the glyph.

This should be height - (number of pixels from bottom of glyph to the top of the baseline). The baseline in a glyph is the line where the descender begins.

For example, in the lowercase letter y, the bottom end of the y extends past the baseline. In Vanilla, when the height is 8, the ascent is 7.

Charlist#

The chars field (also called the charlist) is a list of strings that map texture glyphs to Unicode characters. The length of the strings inside this list must all be equal. The length of the list itself controls how Minecraft divides the texture vertically. The length of the strings inside the list controls how Minecraft divides the texture horizontally.

Warped charlist#

When the length of either the list or the strings is not a divisor of the resource's dimensions, it can result in unexpected division of glyphs.

For all of the below examples, assume the resource is this:

_images/basegrid.png

The resource referenced. It is a 4x2 grid of colored boxes.#

Consider these cases:

[
    "ABCD",
    "EFGH"
]
_images/basegridlines.png

An expected result, the resource is divided correctly.#


[
    "ABCDEFGH"
]
_images/basegridwarph.png

If the length of the charlist is 1 line, the resource will be divided vertically 1 time.#


[
    "A",
    "B",
    "C",
    "D",
    "E",
    "F",
    "G",
    "H"
]
_images/basegridwarpv.png