-
-
Save appgurueu/37982038ce9b4791d452bd66d91c621c to your computer and use it in GitHub Desktop.
Minetest: Setting a clientside font
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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