Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
pumab9 opened this issue Aug 31, 2021 · 5 comments
Open

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

pumab9 opened this issue Aug 31, 2021 · 5 comments
Labels

Comments

@pumab9
Copy link

pumab9 commented Aug 31, 2021

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

@Cherry
Copy link
Owner

Cherry commented Aug 31, 2021

Thanks for the report.

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

@pumab9
Copy link
Author

pumab9 commented Aug 31, 2021

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

@Cherry
Copy link
Owner

Cherry commented Aug 31, 2021

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.

@pumab9
Copy link
Author

pumab9 commented Aug 31, 2021

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!

@pumab9
Copy link
Author

pumab9 commented Aug 31, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants