Module:Abilities/card: Difference between revisions

Jump to navigation Jump to search
Vergir (talk | contribs)
m make upgradebox fonts smaller so they always fit into the box
Vergir (talk | contribs)
Better fontsize calculation for upgrades who don't have readymade lang keys
Line 405: Line 405:
for k, upgrade in pairs(upgrades) do
for k, upgrade in pairs(upgrades) do
local description = lang.get_string(upgrade.DescKey)
local description = lang.get_string(upgrade.DescKey)
local desc_length = description and #description or 0


-- bypass some keys if they are mistakenly left in game files
-- bypass some keys if they are mistakenly left in game files
Line 426: Line 427:
-- Vary the font size based on the number of characters to prevent overflow
-- Vary the font size based on the number of characters to prevent overflow
local fontsize = '0.85rem'
local fontsize = '0.85rem'
if #description > 60 and #description < 71 then
if desc_length > 60 and desc_length < 71 then
fontsize = '0.8rem'
fontsize = '0.8rem'
elseif #description > 70 and #description < 91 then
elseif desc_length > 70 and desc_length < 91 then
fontsize = '0.75rem'
fontsize = '0.75rem'
elseif #description > 90 then
elseif desc_length > 90 then
fontsize = '0.7rem'
fontsize = '0.7rem'
end
end