Module:Abilities/card: Difference between revisionsGive feedback
Jump to navigation
Jump to search
m make upgradebox fonts smaller so they always fit into the box |
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 | if desc_length > 60 and desc_length < 71 then | ||
fontsize = '0.8rem' | fontsize = '0.8rem' | ||
elseif | elseif desc_length > 70 and desc_length < 91 then | ||
fontsize = '0.75rem' | fontsize = '0.75rem' | ||
elseif | elseif desc_length > 90 then | ||
fontsize = '0.7rem' | fontsize = '0.7rem' | ||
end | end | ||