• [Server Content] Downloading and activating custom font files
    22 replies, posted
Hello, GMod Lua Community! I have a question with which i'm trying to deal about half of year. [B]The sutiation.[/B] I'm used to use special fonts for my work in coding. So i have a few fonts - digital7mono and Helvetica Family. Format - ttf [B]The Goal[/B] To make every client have these fonts on joining. [B]The Problem[/B] Fonts couldn't be loaded automatically. [B]My Ways[/B] 1. If client will download (addon with fonts) by [B]himself[/B], the fonts will be loaded. (Let's have a case without downloading manually) 2. If i use [IMG]http://wiki.garrysmod.com/favicon.ico[/IMG] [URL="http://wiki.garrysmod.com/page/steamworks/Download"]steamworks.Download[/URL] -> [IMG]http://wiki.garrysmod.com/favicon.ico[/IMG] [URL="http://wiki.garrysmod.com/page/game/MountGMA"]game.MountGMA[/URL] it will throw an error: [CODE]Failed to load custom font file 'c:/program files (x86)/steam/steamapps/common/garrysmod/garrysmod/workshop/resource/fonts/digital7mono.ttf'[/CODE] (Also error happends with other fonts, which exists in same folder) 3. If i use [IMG]http://wiki.garrysmod.com/favicon.ico[/IMG] [URL="http://wiki.garrysmod.com/page/resource/AddFile"]resource.AddFile[/URL] nothing will be downloaded. (BUT if i add fonts in folder garrysmod/fonts it will download them, but font's will not activate.) 3.1 The same with [IMG]http://wiki.garrysmod.com/favicon.ico[/IMG] [URL="http://wiki.garrysmod.com/page/resource/AddSingleFile"]resource.AddSingleFile[/URL] [B]Info[/B] By made addon: fonts are in folder /resource/fonts/* Trying by mounting on client: [CODE] steamworks.FileInfo( 949191667, function( result ) steamworks.Download( result.fileid, true, function( name ) game.MountGMA( name ) end) end) [/CODE] Installing on server in garrysmod/resource/fonts by [CODE]resource.AddSingleFile("resource/fonts/digital7mono.ttf")[/CODE] or [CODE]resource.AddFile("resource/fonts/digital7mono.ttf")[/CODE] -- [B]failed[/B] Installing on server in garrysmod/fonts by [CODE]resource.AddSingleFile("fonts/digital7mono.ttf")[/CODE] or [CODE]resource.AddFile("fonts/digital7mono.ttf")[/CODE] -- [B]download but not activated[/B] ________ I've tried to search topics about fonts but no solution found. This is my question. Thanks.
Recourse? Shouldn't it be Resources?
[QUOTE=gonzalolog;52903959]Recourse? Shouldn't it be Resources?[/QUOTE] "resource", actually.
[QUOTE=gonzalolog;52903959]Recourse? Shouldn't it be Resources?[/QUOTE] [QUOTE=AwfulRanger;52903998]"resource", actually.[/QUOTE] The actual folder in GMod is "resource". In first post I wrote "resource".
You wrote [b]recource[/b] 3 times (2 times in code snippets) and [B]resource[/B] - 1 time.[quote][img]https://i.imgur.com/b7pdIHS.png[/img][/quote]
poor soul
Missed that. English is my second language and I had messed up [B]c[/B] and [B]s[/B] when typing this. Now it's [CODE]resource.AddSingleFile("resource/fonts/digital7mono.ttf")[/CODE] I've tested. In download folder appears nothing.
Is the font on the server? Also, how large is the font file? If it is too large it wont be sent by the server.
34 KB. Helvetica is 25 KB
Can you post your sv_downloadurl, or are you using ServerDL?
"sv_downloadurl" = "" My addons are extracted from workshop, because some of them I've edited.
I don't believe you can download fonts with ServerDL, or it might have to put the file directly in the server's files - not in addons.
@code_gs My fonts are in garrysmod/resource/fonts/ and addonroot/resource/fonts/
I will investigate further tomorrow, but if Garry's Mod's ServerDL has not been altered from CS:S'/HL2:DM's then fonts cannot be sent through that method.
You can't use the workshop to download fonts at all, it doesn't work for some reason, you need to use web fastdl, idk about resource.AddFile though, doesn't seem like it's working.
@Luna I'm looking for not to use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/resource/AddWorkshop]resource.AddWorkshop[/url] and FastDL I use raw addons by extracting GMA.
I don't quite understand what you're saying homie but you can't use the workshop at all (by extracting GMA I guess is what you mean?) because fonts don't work with workshop, I do support for scripts that have custom fonts and the workshop download never works, they always need fastdl.
Workshop addons have blocked fonts. IIRC it's because of dmcas and copywrite issues.
If client download my addon manually, font will be available
It's a reported bug - for now, you can only make people manually subscribe or use FastDL.
If FastDL is resource.AddWorkshop, then it doesn't help
No, FastDL is literally FastDL, the "old way" of making clients download content, either via sv_allowdownload 1 or sv_downloadurl. As he said, making clients download an addon that has a font via the workshop as they join the server won't make the font be available, but if they MANUALLY SUBSCRIBE, the clients will get the font
sv_allowdownload/ServerDL doesn't work in this case, you HAVE to use a web server in the mean time (or make players subscribe to the addon).
Sorry, you need to Log In to post a reply to this thread.