Legacy Unicode provider¶
Danger
This provider is deprecated in Minecraft and should not be used. The unihex provider is its replacement.
The legacy unicode provider maps characters to glyphs in a cookie-cutter, template-based way.
The value of its type field is "legacy_unicode".
Its priority is 0.
It stores bitmap glyphs.
It only supports characters up to U+FFFF.
Structure¶
{
"type": "legacy_unicode",
"template": resource location,
"sizes": resource location
}
- template¶
Template resource location to collection of texture files. The placeholder
%smust be present in this value.
- sizes¶
Resource location to a binary size describing the left and right bearings of each glyph. By default, called
glyph_sizes.bin.
Templating¶
Textures are loaded using the template value as a placeholder template.
The value of the magic string %s changes, so multiple files can be loaded with only a uniform file name change.
Template texture files are a grid of 16x16 glyphs, so each holds 256 glyphs.
The placeholder %s is replaced with page numbers.
A page number is equal to a BMP (not beyond U+FFFF) character's high byte.
For instance, the character U+2AFA ⫺ would have a page number of 2a (always lowercase).
Therefore, if template was "page_%s.png", the file page_22.png (if it exists) would hold the glyph textures
for the character from U+2200 ∀ to U+22FF ⋿.
For example, this is the default texture for page 00:
At the top left is U+0000 NULL,
followed at its right by U+0001 START OF HEADING,
across and down ending at U+00FF LATIN SMALL LETTER Y WITH DIAERESIS.
Glyph sizes binary¶
The file referenced by sizes has a simple binary format.
Each individual byte stores the bearings of a particular character.
Bytes correspond directly to a character's codepoint;
A with codepoint U+0041, so the byte at offset 0x41 would store the bearings for A.
In each byte, the high nibble [1] records the starting position, while the lower nibble records the ending position in the 16-pixel wide grid.
So, the byte at offset 0x45FA with value 0x2E would
set the bearings for the character U+45FA 䗺 as left 2 and right 14, respectively.
The file must be 65,535 bytes long (0xFFFF). For this reason, it cannot support any character outside of U+FFFF.
API¶
mcfonts.provider.legacy_unicode.LegacyUnicodeProvider