From Garry's Mod
Jump to: navigation, search
 surface.CreateFont( )



Creates a new font.

To prevent the font from displaying incorrectly when using the "outline" setting, set "antialias" to false. This will ensure the text properly fills out the entire outline.

Be sure to check the List of Default Fonts!

WARNING Due to the static nature of fonts, do NOT create the font more than once. You should only be creating them once, it is recommended to create them at the top of your script. Do not use this function within GM:HUDPaint!

Validation required.
This page contains eventual incorrect information and requires validation.

Due to a bug in Garry's Mod some TTF files won't load properly if only created once and will fallback to the "Default" font. A workaround for this is seen here.


string fontName

The new font name.


table fontData

The font properties. See the FontData structure.



Creates a font with all the defaults showing (any of the fields could be left out for an equivalent font)

surface.CreateFont("TheDefaultSettings", {
	font = "Arial", --  Use the font-name which is shown to you by your operating system Font Viewer, not the file name
	extended = false,
	size = 13,
	weight = 500,
	blursize = 0,
	scanlines = 0,
	antialias = true,
	underline = false,
	italic = false,
	strikeout = false,
	symbol = false,
	rotary = false,
	shadow = false,
	additive = false,
	outline = false,

Personal tools