S&box Wiki

Revision Difference

Fonts#547878

<cat>Dev.UI</cat>⤶ <title>Fonts</title>⤶ <cat>UI.Intro</cat>⤶ <title>Custom Fonts</title>⤶ # 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; ``` <note>This differs from normal CSS syntax, this should be a single font name and not multiple.</note> # 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: <upload src="a5727/8da5e66e76161a6.png" size="5741" name="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: <upload src="a5727/8d951ff31dc234d.png" size="75523" name="image.png" /> To use `SourceSansPro-BoldItalic.ttf` you would use the CSS: ``` font-family: SourceSansPro; font-weight: bold; font-style: italic; ```