Putting a font into gmod?

So I want to put this font: http://www.urbanfonts.com/fonts/Searfont.htm into my server. Just so other people can see it on the hud i’m making. Anyone know how?

  • Thanks!

Yes. I know how to do that but when I use that font it sets the font to the default one. Not the graffiti one.

If its for an addon just remember the addon folder structure mimics the garrysmod folder structure. So it will go into addonname/resource/fonts/

Then use what Niandra said.

Make sure the Font data structure is correct. When you place the font into the directory don’t rename it, keep the original name.
Example


surface.CreateFont( "ARandomNameYouCanChoose", { --You can choose any name you like for the font name 
	font = "coolvetica",  -- This is the font source located in /resource/fonts
	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, 
} )

then you would use something like


 DLabel:SetFont("ARandomNameYouCanChoose") --make sure to use the font name you made yourself 

I put it in my resource/fonts folder but it still won’t work?

Code:


surface.CreateFont("Spraymhs", { //cool font ;D
		font = "Searfont",
		size = 50,
		weight = 800,
		blursize = 0,
		scanlines = 0,
		antialias = true,
		underline = false,
		italic = false,
		strikeout = false,
		symbol = false,
		rotary = false,
		shadow = false,
		additive = false,
		outline = true,
	})

That might be your problem ^

Nope. That didn’t work either.

you need to resource.AddFile it so everyone downloads it (assuming you haven’t already)

Ok I can do that but I have only done it with workshop addons. How would I code that out with a font?

resource.AddSingleFile(“resources/fontname.ttf”)

Oh thanks. And I got it working, it was just that font! Thanks so much guys heres the hud I ended up with for the addon:

https://www.youtube.com/watch?v=MFrGGF_KJ3Q&feature=youtu.be