I have a problem with font:getWrap, and I don't know if it is a bug or is it me, who doesn't understand the mechanics of löve...
Description:
Using a ttf (Comic Neue Regular (included in attachment), but the problem is not limited to this font), I want to draw a long text with a limited width using printf. But when I try to get the needed width and height for the text, the gotten width is to small, the height to big, and the lines are not the same displayed...
Code: Select all
function love.load()
text = 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor.';
font = love.graphics.newFont( 'ComicNeue-Regular.ttf', 19 );
limit = 300;
end
function love.draw()
width, lines = font:getWrap( text, limit );
height = lines * font:getLineHeight() * font:getHeight();
love.graphics.setColor{ 128, 128, 128, 255 };
love.graphics.rectangle( 'fill', 0, 0, width, height );
love.graphics.setColor{ 255, 255, 255, 255 };
love.graphics.printf( text, 0, 0, limit );
end
Can someone please explain me, where the mistake is?
cu
Chronoc