Providers¶
Providers are the core part of Minecraft fonts. Providers are discrete components that individually map characters to glyphs. They are isolated and don't normally interact with each other, so they are easily removed, added, swapped, and modified.
In mcfonts, providers are given a high degree of independence and inversion of control: implementations decide the specific best way to do something from a broad range of possibilities.
Different providers use different formats and methods of constructing characters.
The types are:
In JSON¶
Providers are specified inside of a font's JSON file. Each item of the root's providers array is a provider object.
A font is essentially a list of providers, both conceptually and literally.
Providers are chiefly identified by the value of the type field.
It is always present on all provider objects; if an item in the providers array lacks this key,
then it is not a valid provider.
Below is a simple example with one provider with a filter applied:
{
"providers": [
{
"type": "space",
"filter": {
"jp": false
},
"advances": {
" ": 4,
"\u200c": 0,
"a": -8
}
}
]
}
The single provider happens to be the space provider, one of the more simple ones, although any provider could be in its place (and any number of them could exist in this array).
This specific provider has only one provider-specific field: advances.
It is an object, with keys of characters matching to values of space width.
In this instance:
U+0020 SPACEhas a width of 4U+200C ZERO WIDTH NON-JOINER(ZWNJ) has a width of 0U+0061 LATIN SMALL LETTER Ahas a width of -8
The remaining filter field declares that this provider will only be active when
the value of the Japanese Glyph Variants button in-game is OFF.
Filters¶
Filters are settings that define when a provider is "enabled". It is optional, but supported for any provider.
Fig. 1 The in-game options found in ¶
It defines when a provider should be considered part of a font. The filter's keys and values correspond to the names and states of specific buttons in Minecraft.
If true, its button value must be ON.
If false, its button value must be OFF.
If undefined, its button value is ignored.
Filter options are currently hard-coded. They are:
jp: linked to Japanese Glyph Variantsuniform: linked to Force Uniform
Example¶
This filter cause its provider to only be active when both Force Uniform is ON and Japanese Glyph Variants is ON:
{
"type": "..."
"filter": {
"uniform": true,
"jp": true,
}
}
Reference filter merging¶
Filters can also be set on reference providers. If so, mcfonts will apply the reference's filter on top of the targeted providers'.
For example:
{
"type": "reference",
"id": "...",
"filter": {
"uniform": false
}
}
{
"type": "space",
"advances": {},
"filter": {
"uniform": true,
"jp": true,
}
}
{
"type": "space",
"advances": {},
"filter": {
"uniform": false,
"jp": true
}
}
Here, the uniform option was overridden during the merge (reference defined it as false),
while jp remained, unmodified (reference did not define it either way).
Priority¶
Priority is a ranking of order for each provider type. The higher a provider's priority is, the more important and more control it will generally have, This control ranges from being used first for glyph mappings, or called later in some saving process.
For instance, in OpenType saving, higher priority providers are saved last to allow them to make changes to the data other providers have made.
The current priority order for the included providers is:
5 Notdef
4 Space
3 Bitmap
2 TTF
1 Unihex
0 Legacy unicode