|
|
Fonts in MythicHUD are sprite-sheets configured to pair a text character with a visual icon. This can be used to transform Unicode textures into icons and images.\
|
|
|
MythicHUD currently does _not_ utilize pre-existing fonts in a resource pack, and must have font characters configured in its generation to display them.
|
|
|
|
|
|
## Font Config
|
|
|
By default, MythicHUD generates the config for its default fonts in `/MythicHUD/assets/font/default-fonts.yml`, which use several sprite-sheets located in `/MythicHUD/textures/font/default/`.\
|
|
|
A font configuration includes a provider name, a texture file to reference, the character height of the sheet, and a list of characters mapped to the sheet.
|
|
|
Here is a small example custom-font configuration:
|
|
|
```yaml
|
|
|
custom-font:
|
|
|
providers:
|
|
|
# standard space characters unchanged
|
|
|
spaces:
|
|
|
type: "space"
|
|
|
advances:
|
|
|
" ": 4
|
|
|
"\u200c": 0
|
|
|
# remapped unicode characters to icons:
|
|
|
nonlatin-european:
|
|
|
type: "bitmap"
|
|
|
texture: font/custom-font/sprites.png
|
|
|
height: 8
|
|
|
chars:
|
|
|
- "\u00a1\u2030\u00ad\u00b7"
|
|
|
- "\u20b4\u2260\u00bf\u00d7"
|
|
|
- "\u00d8\u00de\u04bb\u00f0"
|
|
|
- "\u00f8\u00fe\u0391\u0392"
|
|
|
```
|
|
|
This configuration creates a font named `custom-font` for use in text [Assets](/Components/Assets), uses the sprite sheet provided at `/MythicHUD/textures/font/custom-font/sprites.png`, and loads 16 characters to change the display of various Unicode characters (such as `\u00a1`'s `¡` character as whatever the first, upper-left icon in the sprite sheet is).
|
|
|
|
|
|
## Spritesheet
|
|
|
The sprite sheet for a font is considered a grid of character tiles sized `height` x `height`. The above example would be a 32px by 32px sheet made of 8px square characters, for example.
|
|
|
Sprite sheet textures do not have to be square, but do have to have exact resolution measurements to be read correctly. If textures load but seem misshapen or offset, it is likely a sprite-sheet resolution issue. |
|
|
\ No newline at end of file |