• Custom Fonts
    4 replies, posted
So recently I've been tinkering with .lua files and I wanted to change a font used in a certain addon. Simply dragging the custom font to the [code]gmod/resource/[/code] or [code]gmod/resource/fonts/[/code] and then changing [lua]surface.SetFont( "ORIGINALFONTNAME" )[/lua] to [lua]surface.SetFont( "CUSTOMFONTNAME" )[/lua] didn't work and instead used a different font (I'm guessing the default font?). Is there something I have to write in the .lua or a certain area where I have to put the font to get it to work? How do I get custom fonts to work if anything. If anyone could help me out, I'd appreciate it.
You need to call surface.CreateFont if you have custom fonts
[QUOTE=James xX;36663792]You need to call surface.CreateFont if you have custom fonts[/QUOTE] I think I tried that cause I read it on the wiki, it didn't do anything for me. What should the code I use be? I just used the template provided on the wiki: [lua] surface.CreateFont( "CUSTOMFONTNAME", 48, 500, true, true, "CUSTOMFONTNAME" )[/lua] Would I have to write the directory of the font or such? Or would the second customfontname have to be different, etc.? Thanks for the feedback though, much appreciated!
If you want a custom font you would have to place it in your servers resource/fonts/akbar.ttf. Sending it to clients joining your server should be as simple as: [CODE]resource.AddFile("resource/fonts/akbar.ttf")[/CODE] Then you would use as such: [CODE]surface.CreateFont( "akbar", 48, 500, true, true, "CoolFont" )[/CODE]
The font isn't for server-hosting use though- it's for a clientside addon. Would it be possible to use custom fonts in a server that doesn't have it with a clientside addon? [editline]8th July 2012[/editline] [QUOTE=brandonj4;36664265]If you want a custom font you would have to place it in your servers resource/fonts/akbar.ttf. Sending it to clients joining your server should be as simple as: [CODE]resource.AddFile("resouce/fonts/akbar.ttf")[/CODE] Then you would use as such: [CODE]surface.CreateFont( "akbar", 48, 500, true, true, "CoolFont" )[/CODE][/QUOTE] And then afterwards would I do [lua]surface.SetFont( "CoolFont" )[/lua] ? Ah nevermind, got it working. Not sure what did what, though, but thanks for the help guys!
Sorry, you need to Log In to post a reply to this thread.