• How to make fonts work properly?
    4 replies, posted
  • I've read through this twice: [URL="http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index5b6d.html"]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index5b6d.html[/URL] I'm installing the font at this location: resource/fonts/spraypaint.ttf This is my code: [lua] surface.CreateFont ("spraypaint", 30, 400, true, false, "PressUse") hook.Add("HUDPaint", "FindModelPaths", function() draw.DrawText("Test[a]", "PressUse", (ScrW()/2)-1, (ScrH()-100)+1, Color(150,150,0,255), TEXT_ALIGN_CENTER) end) [/lua] The text shows up as some default text from I don't know where. How do I make the font work properly? I've tried other fonts in that resource folder and they work fine also. I don't have to install the font to my windows fonts do I?
  • Make sure the name of the font you're trying to use is the TrueType font name, not the file name.
  • [QUOTE=ConTron123;37136872]Make sure the name of the font you're trying to use is the TrueType font name, not the file name.[/QUOTE] What do you mean by that? Something inside Properties? If I open up the font it has this: Font name: [U]Spraypaint Free[/U] Version: Version 1.000 TrueType Outlines ----- ABCDE etc.
  • You need to use this: [lua] surface.CreateFont ("Spraypaint Free", 30, 400, true, false, "PressUse") [/lua] instead of [lua] surface.CreateFont ("spraypaint", 30, 400, true, false, "PressUse") [/lua]
  • [QUOTE=ConTron123;37137118]You need to use this: [lua] surface.CreateFont ("Spraypaint Free", 30, 400, true, false, "PressUse") [/lua] instead of [lua] surface.CreateFont ("spraypaint", 30, 400, true, false, "PressUse") [/lua][/QUOTE] Thanks that's what I thought.