S&box Wiki

Fonts

Using fonts

You can add your own fonts by placing them in the fonts folder within your addon, both otf and ttf files are supported.

To use your font you should set the font-family on your text so that it matches the font family name of your files.

font-family: FontFamilyName;
This differs from normal CSS syntax, this should be a single font name and not multiple.

Uploading fonts

For your players to download your fonts you need to configure your resource paths to include fonts/* in the addon manager like so:

image.png

Font file naming

You shouldn't need to worry about how they're named as most fonts you download should be named like this anyway, but incase you run into any trouble your fonts will be searched for in this order:

  • /fonts/FontFamilyName-FontWeightFontStyle.ttf
  • /fonts/FontFamilyName-FontWeight.ttf
  • /fonts/FontFamilyName.ttf

Where:

  • FontFamilyName is: A shared name across each weight/style of your font.
  • FontWeight is: Thin, ExtraLight, Light, Regular, Medium, Semibold, Bold, ExtraBold, Black
  • FontStyle is: Empty or Italic

Here's an example of a correct layout of fonts:

image.png

To use SourceSansPro-BoldItalic.ttf you would use the CSS:

font-family: SourceSansPro; font-weight: bold; font-style: italic;