HD Fonts¶

The default font texture snippet.¶
File location
/assets/minecraft/optifine/font/**/*.{png,properties}
Danger
This feature is obsolete. Do not use it. Minecraft's font system has fixed the issues HD fonts was created to resolve.
Warning
Characters outside the ASCII range are not supported.
HD Fonts can define custom widths for characters.
OptiFine first looks for fonts in the assets/minecraft/optifine/font
folder.
This allows having a custom font that works in vanilla and a higher resolution font that requires OptiFine to display properly.
Default font:
assets/minecraft/optifine/font/ascii.png
SGA (enchanting) font:
assets/minecraft/optifine/font/ascii_sga.png
To allow for more control over the widths of individual characters, OptiFine offers a way to specify them manually. Create a properties file corresponding to the font to customize:
/assets/minecraft/optifine/font/ascii.properties
/assets/minecraft/optifine/font/ascii_sga.properties
Properties¶
Each line in this file specifies the width of a character:
Note
Each character must be in it's decimal codepoint, not hexadecimal; this is why SPACE U+0020
is 32
.
# Custom width
width.<ascii value 0-255>=<width 0-8>
The ASCII table¶
For example, to specify the widths of capital A, B, and C, the following might be used:
# A
width.65=5.9
# B
width.66=5
# C
width.67=5.25
Values can be floating point numbers (Vanilla only supports integer widths) and range from 0-8 regardless of the resolution of the font. The widths for all characters do not need to be specified, only those that should override the default width.
The space character default width is 4.0
.
This can be overridden by setting width.32
to a custom value.
JSON schema¶
Note
Although this page is .properties
based, it can be mapped to JSON.
{
"$schema": "http://json-schema.org/draft/2020-12/schema",
"$id": "https://gitlab.com/whoatemybutter/optifinedocs/-/blob/master/schemas/hd_fonts.schema.json",
"title": "HD Fonts",
"description": "HD Fonts can define custom widths for characters.",
"type": "object",
"patternProperties": {
"^width.(?:\\b(?:25[0-5]|2[0-4][0-9]|[01]?[0-9]{1,2})\\b\\s?)+$": {
"type": "number",
"minimum": 0,
"maximum": 8,
"description": "The width of a character.",
"deprecated": true
}
},
"additionalProperties": false,
"deprecated": true
}