Cherry/3D2D-Textscreens

Fonts disapear after your re-join a server without exiting gmod.

pumab9 opened this issue · 5 comments

As the title says, the fonts only work if you start gmod and join the server.
How ever, if you disconect and re-connect without restarting your client, the fonts will default back to something basic font.

Workshop version: 23 Jan @ 11:34pm

Example:

This is after joining:

kép

This is after rejoining ( without gmod restart )

kép

Thanks for the report.

How are you adding new fonts specifically? Custom fonts aren't officially supported at this time.

I just modified the textscreens_config.lua

textscreenFonts = {}

local function addFont(font, t)
	if CLIENT then
		t.size = 100
		surface.CreateFont(font, t)
		t.size = 50
		surface.CreateFont(font .. "_MENU", t)
	end

	table.insert(textscreenFonts, font)
end

addFont("Harry Potter", {
	font = "Harry P",
	weight = 400,
	antialias = true,
	outline = false
})

addFont("Harry Potter Outlined", {
	font = "Harry P",
	weight = 400,
	antialias = true,
	outline = true
})

addFont("AuldMagick", {
	font = "AuldMagick Bold",
	weight = 400,
	antialias = true,
	outline = false
})

addFont("AuldMagick Outlined", {
	font = "AuldMagick Bold",
	weight = 400,
	antialias = true,
	outline = true
})

addFont("Magic Handwriten", {
	font = "magic-Regular",
	weight = 400,
	antialias = true,
	outline = false
})

addFont("Magic Handwriten Outlined", {
	font = "magic-Regular",
	weight = 400,
	antialias = true,
	outline = true
})

addFont("Avatarock", {
	font = "Avatarock",
	weight = 400,
	antialias = true,
	outline = true
})

addFont("Advent Pro", {
	font = "Advent Pro Light",
	weight = 400,
	antialias = true,
	outline = true
})

addFont("Barlow Semi Condensed", {
	font = "Barlow Semi Condensed Light",
	weight = 400,
	antialias = true,
	outline = true
})

addFont("Who asks Satan outlined", {
	font = "Who asks Satan",
	weight = 400,
	antialias = true,
	outline = true
})

addFont("Who asks Satan", {
	font = "Who asks Satan",
	weight = 400,
	antialias = true,
	outline = false
})

addFont("Elder Futhark outlined", {
	font = "Elder Futhark",
	weight = 400,
	antialias = true,
	outline = true
})

addFont("Elder Futhark", {
	font = "Elder Futhark",
	weight = 400,
	antialias = true,
	outline = false
})

addFont("Coolvetica outlined", {
	font = "coolvetica",
	weight = 400,
	antialias = false,
	outline = true
})

addFont("Screens_Trebuchet outlined", {
	font = "Trebuchet MS",
	weight = 400,
	antialias = false,
	outline = true
})

addFont("Screens_Trebuchet", {
	font = "Trebuchet MS",
	weight = 400,
	antialias = false,
	outline = false
})

addFont("Screens_Arial outlined", {
	font = "Arial",
	weight = 600,
	antialias = false,
	outline = true
})

addFont("Screens_Arial", {
	font = "Arial",
	weight = 600,
	antialias = false,
	outline = false
})

addFont("Screens_Roboto outlined", {
	font = "Roboto Bk",
	weight = 400,
	antialias = false,
	outline = true
})

addFont("Screens_Roboto", {
	font = "Roboto Bk",
	weight = 400,
	antialias = false,
	outline = false
})

addFont("Screens_Helvetica outlined", {
	font = "Helvetica",
	weight = 400,
	antialias = false,
	outline = true
})

addFont("Screens_Helvetica", {
	font = "Helvetica",
	weight = 400,
	antialias = false,
	outline = false
})

addFont("Screens_Akbar outlined", {
	font = "akbar",
	weight = 400,
	antialias = false,
	outline = true
})

addFont("Screens_Akbar", {
	font = "akbar",
	weight = 400,
	antialias = false,
	outline = false
})

if CLIENT then

	local function addFonts(path)
		local files, folders = file.Find("resource/fonts/" .. path .. "*", "MOD")

		for k, v in ipairs(files) do
			if string.GetExtensionFromFilename(v) == "ttf" then
				local font = string.StripExtension(v)
				if table.HasValue(textscreenFonts, "Screens_" .. font) then continue end
print("-- "  .. font .. "\n" .. [[
addFont("Screens_ ]] .. font .. [[", {
	font = font,
	weight = 400,
	antialias = false,
	outline = true
})
				]])
			end
		end

		for k, v in ipairs(folders) do
			addFonts(path .. v .. "/")
		end
	end

	concommand.Add("get_fonts", function(ply)
		addFonts("")
	end)

end

Are you ensuring the fonts are sent to the client? Does the client have the same version installed? I'd also recommend putting any of your custom fonts under the default ones, else you're likely going to run into compatibility issues with this official version, since the font indexes will be off.

This isn't an officially supported thing I'm afraid though, so you're on your own for debugging this I'm afraid, sorry.

The fonts are uploaded on the workshop collection addons and on the game server aswell. They are also sent to the client.
The official addon version however is not added the the workshop collection, I have it extracted on the game server, so the clients should have the same version. I tested this multiple time with completly fresh gmod instals. I have it on the server only because I wanted to edit the config file.

I ll try to put the custom fonts under the default ones and reorganize this config. Thank you for the suggestioN!

I tried but its still defaults back after reconecting. Anyway Thank you for your replies