[TUTORIAL] How to add custom fonts to mods

Started by elip100 on

Topic category: User side tutorials

Joined Jan 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[TUTORIAL] How to add custom fonts to mods

Today I am going to tell you how to add custom fonts to your mod!

This tutorial will teach you:

  • How to add fonts to mod
  • How to use fonts in /tellraw command
  • How to use fonts in books
  • How to use fonts on signs
  • How to use fonts in /title command
  • How to change default minecraft font in mods

HOW TO ADD FONTS TO MOD

IMPORTANT: Fonts are required to be .ttf files (TrueType font file)

In your workspace, at the top left-ish, click "workspace", then "open workspace folder". This will bring you to your workspace directory in file explorer. Go to this directory:

<your workspace>\src\main\resources\assets\<your mod name> and create a folder named "font". Inside the font folder, create a text file named whatever you  want your font to be named, and rename the extension (.txt) to ".json". Inside the file, copy and paste the following code:

{
	"providers": [
		{
			"type": "ttf",
			"file": "MOD ID/NAMESPACE:FONT NAME.ttf",
			"shift": [0, 0],
			"size": 11.0,
			"oversample": 2.0
		}
	]
}

Replace "MOD ID/NAMESPACE" with your mod id (or namespace) by default this is your mod name in all lowercase letters, replacing all spaces with underscores (_) and using no symbols such as commas or other things (';:.,<>?!@#$%^&*()-= etc.) Example: if my mod name was "Craft The Uncraftable!" the id/namespace would be "craft_the_uncraftable". replace "FONT NAME" with the name of your font file. Now you have the json file, but not the font itself. Put the font file (.ttf file) in the font folder, with the json file. your font is now in the mod resource pack.

 

HOW TO USE FONTS IN /TELLRAW COMMAND

/tellraw @p {"text":"TEXT","font":"MOD ID/NAMESPACE:FONT NAME"}

Replace "TEXT", "MOD ID/NAMESPACE", and "FONT NAME" with the appropriate answers.

 

HOW TO USE FONTS IN BOOKS

For books it is recommended to use a generator such as minecraftjson.com

 

HOW TO USE FONTS ON SIGNS

For signs it is recommended to use a generator such as minecraftjson.com

 

HOW TO USE FONTS IN /TITLE COMMAND

/title @a title {"text":"TEXT","font":"MOD ID/NAMESPACE:FONT NAME"}

Replace "TEXT", "MOD ID/NAMESPACE", and "FONT NAME" with the appropriate answers.

 

HOW TO CHANGE DEFAULT FONT IN MODS

This tutorial has only shown you how to ADD fonts not REPLACE fonts. If you want to replace the default font in minecraft (The one used in menus, chat, etc.) then follow these steps:

  1. Rename the .json file (font name.json) to default.json
  2. Go to <your workspace>\src\main\resources\assets, and create a folder named "minecraft"
  3. Move your font folder to the minecraft folder
  4. Done! Your font will now replace the default minecraft font.
Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How can I use custom font…
Thu, 06/16/2022 - 19:01

How can I use custom font with overlays and GUIs

Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I would also like to know…
Sat, 03/04/2023 - 05:11

I would also like to know how to use this with GUIs and overlays 

Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Also I’d like to know how to…
Sat, 03/04/2023 - 05:13

Also I’d like to know how to use it in things like the names of items and tooltips