mirror of
https://github.com/pyrollo/display_modpack.git
synced 2025-07-04 00:51:21 +02:00
luacheck, remove old compatibility stuff
This commit is contained in:
@ -18,7 +18,7 @@
|
||||
|
||||
-- Deprecation
|
||||
|
||||
function deprecated_global_table(deprecated_global_name, replacement_global_name)
|
||||
local function deprecated_global_table(deprecated_global_name, replacement_global_name)
|
||||
assert(type(deprecated_global_name) == 'string', "deprecated_global_name should be a string.")
|
||||
assert(type(replacement_global_name) == 'string', "replacement_global_name should be a string.")
|
||||
assert(deprecated_global_name ~= '', "deprecated_global_name should not be empty.")
|
||||
|
@ -19,6 +19,7 @@
|
||||
-- This is the unicode char fallback map. If a char is not present in
|
||||
-- font, this maps indicates which char to try to use instead next.
|
||||
|
||||
-- luacheck: ignore
|
||||
return {
|
||||
-- Lowercase chars
|
||||
['a'] = 'A', ['b'] = 'B', ['c'] = 'C', ['d'] = 'D',
|
||||
|
@ -212,7 +212,7 @@ end
|
||||
-- @return Texture string
|
||||
|
||||
function Font:render(text, texturew, textureh, style)
|
||||
local style = style or {}
|
||||
style = style or {}
|
||||
|
||||
-- Split text into lines (and limit to style.lines # of lines)
|
||||
local lines = {}
|
||||
@ -243,17 +243,17 @@ function Font:render(text, texturew, textureh, style)
|
||||
|
||||
y = y + (self.margintop or 0)
|
||||
|
||||
for _, line in pairs(lines) do
|
||||
for _, l in pairs(lines) do
|
||||
if style.halign == "left" then
|
||||
x = 0
|
||||
elseif style.halign == "right" then
|
||||
x = texturew - line.width
|
||||
x = texturew - l.width
|
||||
else
|
||||
x = (texturew - line.width) / 2
|
||||
x = (texturew - l.width) / 2
|
||||
end
|
||||
|
||||
while line.text ~= '' do
|
||||
codepoint, line.text = self:get_next_char(line.text)
|
||||
while l.text ~= '' do
|
||||
codepoint, l.text = self:get_next_char(l.text)
|
||||
if codepoint == nil then return '' end -- UTF Error
|
||||
|
||||
-- Add image only if it is visible (at least partly)
|
||||
|
@ -60,6 +60,7 @@ local function get_default_font()
|
||||
|
||||
-- If failed, chose first font
|
||||
if default_font == nil then
|
||||
-- luacheck: ignore 512
|
||||
for _, font in pairs(font_api.registered_fonts) do
|
||||
default_font = font
|
||||
break
|
||||
|
Reference in New Issue
Block a user