Skip to content
Snippets Groups Projects
Commit 07b75944 authored by DarkGod's avatar DarkGod
Browse files

Added a Font Scaling option to the video menu, from 50% to 300%

parent 8ae64e80
No related branches found
No related tags found
No related merge requests found
......@@ -66,6 +66,7 @@ function _M:resolveFont(name, orname)
if not font[name] then name = orname end
if not font[name] then name = "default" end
if not font[name][size] then size = "normal" end
print(font[name], size)
return font[name], size
end
......@@ -76,7 +77,7 @@ end
-- @return size
function _M:getFont(name, orname)
local font, size = self:resolveFont(name, orname)
return font.font, font[size]
return font.font, math.ceil(font[size] * config.settings.font_scale / 100)
end
--- Get by name.
......@@ -84,7 +85,7 @@ end
-- @param[type=?boolean] force make a font bold no matter what
function _M:get(name, force)
local font, size = self:resolveFont(name)
local f = core.display.newFont(font.font, font[size], font.bold or force)
local f = core.display.newFont(font.font, math.ceil(font[size] * config.settings.font_scale / 100), font.bold or force)
if font.bold then f:setStyle("bold") end
return f
end
......
......@@ -119,6 +119,18 @@ function _M:generateList()
self.c_list:drawItem(item)
end,}
local zone = Textzone.new{width=self.c_desc.w, height=self.c_desc.h, text=string.toTString"Apply a global scaling to all fonts.\nApplies after restarting the game"}
list[#list+1] = { zone=zone, name=string.toTString"#GOLD##{bold}#Font Scale#WHITE##{normal}#", status=function(item)
return tostring(config.settings.font_scale)
end, fct=function(item)
game:registerDialog(GetQuantity.new("Font Scale %", "From 50 to 300", config.settings.font_scale, 300, function(qty)
qty = util.bound(qty, 50, 300)
game:saveSettings("font_scale", ("font_scale = %d\n"):format(qty))
config.settings.font_scale = qty
self.c_list:drawItem(item)
end, 50))
end,}
local zone = Textzone.new{width=self.c_desc.w, height=self.c_desc.h, text=string.toTString"Activates framebuffers.\nThis option allows for some special graphical effects.\nIf you encounter weird graphical glitches try to disable it.\n\n#LIGHT_RED#You must restart the game for it to take effect.#WHITE#"}
list[#list+1] = { zone=zone, name=string.toTString"#GOLD##{bold}#Framebuffers#WHITE##{normal}#", status=function(item)
return tostring(config.settings.fbo_active and "enabled" or "disabled")
......
......@@ -70,6 +70,7 @@ background_saves = true
mouse_cursor = true
display_fps = 30
gamma_correction = 120
font_scale = 100
mouse_move = true
censor_boot = true
chat.filter = {}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment