-
Notifications
You must be signed in to change notification settings - Fork 192
SMODS.Font
N edited this page Mar 24, 2026
·
4 revisions
This class allows you to use custom Fonts. Your mod must be located in its own subdirectory of the Mods folder. To make sure your font works, you have to put it in a fonts subdirectory inside assets The file structure should look something like this:
Mods
└──FontMod
├── main.lua
└── assets
└── fonts
└── HelveticaNeue.ttf
-
Required parameters:
-
key: The key used to indentify your font (e.g.'HelveticaNeue'(modprefix_HelveticaNeue)) -
path: The font's name, including the extension (e.g.'HelveticaNeue.ttf').
-
-
Optional parameters (defaults):
-
prefix_config, dependencies(reference) -
render_scale: Sets the font size. This is generally better as a higher value so it can be scaled down. The default value is200. -
FONTSCALE: Multiplier to scale down the font to the intended display size. Multipliesrender_scaleso that it renders at a proper size. The default value is0.1. -
DESCSCALE: Determines how big the description text should be in relation to normal text. Keep in mind that mobile UI makes this 1.5x bigger. The default font's value is1. -
squish: Determines horizontal width of each character. The default value is1. -
TEXT_HEIGHT_SCALE: Determines line spacing. The default value is0.83. -
TEXT_OFFSET(table) : Determines the offset that the font is rendered. You might need to adjust this if the font renders in unexpected places. The default value is{x=0, y=0}.
-
-
Example Code
SMODS.Font{
key = "HelveticaNeue",
path = "HelveticaNeue.ttf",
render_scale = 200,
TEXT_HEIGHT_SCALE = 0.83,
TEXT_OFFSET = {x=0,y=0},
FONTSCALE = 0.1,
squish = 1,
DESCSCALE = 1
}For your font to show up in game, you can assign it to formatted text using the style modifier code f: Example:
j_modprefix_example = {
name = "{f:modprefix_HelveticaNeue}Example",
text = {
{
"{C:chips,f:modprefix_HelveticaNeue}+#1#{} Chips",
},
},
},Game Objects
- API Documentation
- SMODS.Achievement
- SMODS.Atlas
- SMODS.Attribute
- SMODS.Blind
- SMODS.CanvasSprite
- SMODS.Center
- SMODS.Challenge
- SMODS.DeckSkin
- SMODS.DrawStep
- SMODS.DynaTextEffect
- SMODS.Font
- SMODS.Gradient
- SMODS.https
- SMODS.JimboQuip
- SMODS.Keybind
- SMODS.Language
- SMODS.ObjectType and SMODS.ConsumableType
- SMODS.PokerHand
- SMODS.Rank and SMODS.Suit
- SMODS.Rarity
- SMODS.Scoring_Parameter and SMODS.Scoring_Calculation
- SMODS.Seal
- SMODS.Shader and SMODS.ScreenShader
- SMODS.Sound
- SMODS.Stake
- SMODS.Sticker
- SMODS.Tag
Guides
- Your First Mod
- Mod Metadata
- The Mod Object
- Calculate Functions
- Perma-bonuses
- Object Weights
- Logging
- Event Manager
- Localization
- Text Styling
- UI Structure
- Utility Functions
- All About
G - Internal Documentation
Release Notes
Found an issue, or want to add something? Submit a PR to the Wiki repo.