Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions loveframes/skins/Blue/skin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,11 @@ local function ParseHeaderText(str, hx, hwidth, tx)

local font = love.graphics.getFont()
local twidth = love.graphics.getFont():getWidth(str)
local strLen = loveframes.utf8.len(str)

if (tx + twidth) - hwidth/2 > hx + hwidth then
if #str > 1 then
return ParseHeaderText(loveframes.utf8.sub(str, 1, #str - 1), hx, hwidth, tx, twidth)
if strLen > 1 then
return ParseHeaderText(loveframes.utf8.sub(str, 1, strLen - 1), hx, hwidth, tx, twidth)
else
return str
end
Expand All @@ -178,10 +179,11 @@ end
local function ParseRowText(str, rx, rwidth, tx1, tx2)

local twidth = love.graphics.getFont():getWidth(str)
local strLen = loveframes.utf8.len(str)

if (tx1 + tx2) + twidth > rx + rwidth then
if #str > 1 then
return ParseRowText(loveframes.utf8.sub(str, 1, #str - 1), rx, rwidth, tx1, tx2)
if strLen > 1 then
return ParseRowText(loveframes.utf8.sub(str, 1, strLen - 1), rx, rwidth, tx1, tx2)
else
return str
end
Expand Down
10 changes: 6 additions & 4 deletions loveframes/skins/Default/skin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ local function ParseHeaderText(str, hx, hwidth, tx)

local font = love.graphics.getFont()
local twidth = love.graphics.getFont():getWidth(str)
local strLen = loveframes.utf8.len(str)

if (tx + twidth) - hwidth/2 > hx + hwidth then
if #str > 1 then
return ParseHeaderText(loveframes.utf8.sub(str, 1, #str - 1), hx, hwidth, tx, twidth)
if strLen > 1 then
return ParseHeaderText(loveframes.utf8.sub(str, 1, strLen - 1), hx, hwidth, tx, twidth)
else
return str
end
Expand All @@ -58,10 +59,11 @@ end
local function ParseRowText(str, rx, rwidth, tx1, tx2)

local twidth = love.graphics.getFont():getWidth(str)
local strLen = loveframes.utf8.len(str)

if (tx1 + tx2) + twidth > rx + rwidth then
if #str > 1 then
return ParseRowText(loveframes.utf8.sub(str, 1, #str - 1), rx, rwidth, tx1, tx2)
if strLen > 1 then
return ParseRowText(loveframes.utf8.sub(str, 1, strLen - 1), rx, rwidth, tx1, tx2)
else
return str
end
Expand Down