1
Graphics / Re: sf::Text::GetGlobalBounds() returns misaligned rectangle?
« on: April 10, 2014, 03:01:31 pm »
Oh, it was a silly mistake in this test case, which works properly now, thank you.
However, I am still having troubles with text positioning. I am trying to put my text at the bottom (or center) of the shape by vertical axis. For some reason the text appears slightly lower than it should be (origin is always at (0, 0)).
I tried aligning the text by setting its origin to bottom, but it results in the same picture. I would like to know what am I doing wrong.
However, I am still having troubles with text positioning. I am trying to put my text at the bottom (or center) of the shape by vertical axis. For some reason the text appears slightly lower than it should be (origin is always at (0, 0)).
text.setPosition(text->getPosition().left,
-text.getGlobalBounds().height +
shape.getGlobalBounds().top + shape.getGlobalBounds().height
);
-text.getGlobalBounds().height +
shape.getGlobalBounds().top + shape.getGlobalBounds().height
);
I tried aligning the text by setting its origin to bottom, but it results in the same picture. I would like to know what am I doing wrong.