0
new:
0
new: s
s 8
new: sc
sc 17
new: sch
sch 28
new: schr
schr 36
new: schr
Error: main.lua:62: Not enough space
stack traceback:
[C]: in function 'getWidth'
main.lua:62: in function 'load'
[string "boot.lua"]:378: in function <[string "boot.lua"]:373>
[C]: in function 'xpcall'
What does "not enough space" mean? Am I doing something wrong?
Can someone confirm this? Is it an engine-bug?
Thanks...
Last edited by Germanunkol on Sat Jun 23, 2012 8:20 am, edited 1 time in total.
"Not enough space" is an exception thrown by the UTF-8 library used by LÖVE. This can happen when the library encouters an unfinished UTF-8 string. In this case, you chop the UTF-8 code for 'ö' which uses 2 bytes in half with fullTitle:sub( 1, j ). The library sees the first byte and expects another, but is already at the end of the string and throws.
Or something like that anyway. One would expect a "Invalid UTF-8" message here.
Make sure you chop UTF-8 strings a the right places if you want to split them up.
buttonFont = love.graphics.newFont( 18 )
function love.load(arg)
titleStr = ""
fullTitle = "schrödinger"
for char in utf8iter(fullTitle) do
titleStr = titleStr .. char
if buttonFont:getWidth( titleStr ) < buttonWidth-20 then
print(titleStr.. " " .. buttonFont:getWidth( titleStr ))
else
break
end
end
end