Sorry about that.
I have another problem, though:
int main()
{
std::string msg = "abcdefghijklmnopqrstuvwxyz";
color = sf::Color(0, 0, 0);
xPosition = 0; yPosition = 250;
for (int i = 0; i < msg.length(); i++)
{
currentChar = msg[i];
glyph = font.getGlyph(currentChar, fontSize, false);
temporarySprite.setTexture(font.getTexture(24));
temporarySprite.setTextureRect(glyph.textureRect);
temporarySprite.setColor(color);
if (i >= 1) { xPosition += font.getKerning(previousChar, currentChar, fontSize); }
/////////////////////////////////////////
// other unimportant stuff ... ... ... //
/////////////////////////////////////////
// THIS PART IS WHERE THE ERROR IS, I BELIEVE
temporarySprite.setPosition(xPosition, yPosition);
message.push_back(temporarySprite);
xPosition += glyph.advance;
previousChar = currentChar;
}
}
When using this code, the output is:
As you can see, the characters aren't in their correct positions. I tried using the following code:
temporarySprite.setPosition(xPosition, yPosition + (font.getGlyph('A', fontSize, false).bounds.height - glyph.bounds.height));
Now, the output is:
As you can see, it is mostly fixed, but some letters are still not correctly positioned. I don't know what to do.