diff options
author | Niklp <89982526+Niklp09@users.noreply.github.com> | 2023-07-24 09:59:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-24 09:59:26 +0200 |
commit | 1440f35fa62fd2c01b4844261290c88e42d2430f (patch) | |
tree | e42db53056e5d6f1c4fd562a924934081ae787c4 /font_api/font.lua | |
parent | e0e03058362e038d07d4063c4fbd6999ad27109c (diff) | |
download | display_modpack_no_craft-1440f35fa62fd2c01b4844261290c88e42d2430f.tar.gz display_modpack_no_craft-1440f35fa62fd2c01b4844261290c88e42d2430f.zip |
Add luacheck, update translations, replace ABMs, bug fixes (#1)
* luacheck, mt 5 translation, german translation, maintenance
* fix luacheck warnings
* Fix digital clock nodebox and texture
* Fix luacheck usage
* Add comment why fonts are not split into several lines
Diffstat (limited to 'font_api/font.lua')
-rw-r--r-- | font_api/font.lua | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/font_api/font.lua b/font_api/font.lua index 5794867..d7b67d7 100644 --- a/font_api/font.lua +++ b/font_api/font.lua @@ -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) |