How to Create a Font and Find its Name
How to Create a Font
Place the Font File in Your Addon
When Garry's Mod loads fonts, it looks for them in the /garrysmod/addons/{Your Addon's Folder}/resource/fonts/
folder.
Example: resource/fonts/arial_bold.ttf
Due to inconsistencies between operating systems, it's good practice to ensure that your addon's files and folders (including font files) use entirely lowercase names which do not contain spaces. Spaces should be replaced by underscores (_
) or hyphens (-
).
This is especially true on Linux.
.ttf
format.In addition, make sure that the font's .ttf
file is available clientside, otherwise players will not be able to use it.
You can do this via resource.AddSingleFile
Find the Font's Name
To use your font in Garry's Mod, you need to know the name of your font. This is required for surface.CreateFont.
On Windows and macOS, the font name is not the .ttf
file's file name. Instead, the .ttf
file has the name of the font embedded within it. This embedded name is what Garry's Mod uses to create the font and make it available in-game.
On Linux, using the embedded font name tends to be unreliable. I recommend using the font's (case-sensitive) file name, like "Roboto-Regular.ttf"
, instead. You can use system.IsLinux to help determine which name to use.
Windows
Right click on your
.ttf
font file and clickPreview
In the window that opens, find the line that begins with "Font name"
The name you will need to use in Garry's Mod is the text following "Font name"
In the example below, the name isDigital-7 Mono
MacOS
TODO
Linux
"Roboto-Regular.ttf"
, instead. You can use system.IsLinux to help determine which name to use.GNOME Font Viewer
Package name: gnome-font-viewer
Open the font
Find the label at the center of the top menu (In this example, it's
Arial
, style is not a part of the font here)Additionally you can check the font name by click
Info
on the top menu and findName:
Creating the Font
For information and examples on how to use the font you have now installed and found the name of, see surface.CreateFont