Importing

mcfonts can import fonts from Java Edition JSON, folders, and ZIPs in a variety of formats and configurations.

This is offered through the mcfonts.importing module.

All paths accepted here will correctly expand shortcuts and variables such as ~, .., and %HOME%. For all of these examples, assume that a resource pack folder is in the working directory.

All importing functions return an instance of mcfonts.MinecraftFont.


To import a Java Edition font, you may use any of the below functions:

import mcfonts
# From a JSON file
font = mcfonts.from_java_font_file("./assets/minecraft/font/default.json")
# From a folder that contains a resource pack
font = mcfonts.from_java_pack_folder("./")
# From a resource pack that is a ZIP
font = mcfonts.from_java_pack_zip("./pack.zip")

My font has no colors!

This is because by default, all importing functions do not read colors in font files; they see grayscale. To explicitly enable color functionality, set read_colors=True as an argument.

Warning

Enabling colors heavily decreases export performance.


Last update: 2023 November 30