Saving

As a complement to loading, mcfonts also implements support for saving fonts back to other formats.

Although loading only support Minecraft fonts right now, saving supports many more formats.

Table 1 Complexity overview

Characters

OpenType

Unihex

YAFF

Minecraft

1

0.7 ms

0.033 ms

0.004 ms

0.28 ms

10

0.8 ms

0.075 ms

0.06 ms

0.457 ms

100

8.5 ms

1.42 ms

2.4 ms

2.8 ms

1,000

92.8 ms

14.5 ms

31 ms

34 ms

10,000

830 ms

154 ms

260 ms

280 ms

Complexity tends to be linear with respect to the number of providers. Each provider has its own complexity.

Minecraft

Save the font in Minecraft: Java Edition format.

Note

Reference providers are not saved - their targets are saved in their place.

API

mcfonts.serde.minecraft

OpenType

Save the font to an OpenType font.

The result will have an em size of 1024 (configurable via EM_SIZE). Glyphs are stored in a GLYF format.

_images/outlines.webp

Fig. 2 Green lines are outlines

Warning

Not all OpenType features/tables are supported, like ligatures, LOCL, colors.

API

mcfonts.serde.opentype

Unihex

Save the font to a GNU Unihex-compatible format.

By default, glyphs which don't fit cleanly as a unihex glyph will have naïve scaling.

API

mcfonts.serde.unihex

YAFF

Save the font to a YAFF format.

API

mcfonts.serde.yaff