Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@appgurueu
Created September 12, 2021 14:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save appgurueu/37982038ce9b4791d452bd66d91c621c to your computer and use it in GitHub Desktop.
Save appgurueu/37982038ce9b4791d452bd66d91c621c to your computer and use it in GitHub Desktop.
Minetest: Setting a clientside font
local font = minetest.get_modpath(minetest.get_current_modname()) .. "/fonts/PressStart2P.ttf"
local previous_path = minetest.settings:get"font_path"
minetest.settings:set("font_path", font)
local previous_mono_path = minetest.settings:get"mono_font_path"
minetest.settings:set("mono_font_path", font)
minetest.register_on_shutdown(function()
if previous_path or font == previous_path then
-- TODO instead of our, persistently store last valid previous path elsewhere
minetest.settings:remove"font_path"
else
minetest.settings:remove("font_path", previous_path)
end
if previous_mono_path or font == previous_mono_path then
-- TODO instead of our, persistently store last valid previous path elsewhere
minetest.settings:remove"mono_font_path"
else
minetest.settings:remove("mono_font_path", previous_mono_path)
end
minetest.settings:write()
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment