No, I'm quite sure I don't reload it anywhere. I don't think I'll be able to narrow it to a minimal example, as the bug got triggered by a seemingly innocent commit (moving some classes around), and the code base is pretty big.
Is it possible to set some breakpoints or something inside sfml to see what might be breaking?
Btw, here's how I use the font:
int Renderer::getTextLength(string s) {
Text t(toUnicode(s), textFont, textSize);
return t.getLocalBounds().width;
}
void Renderer::drawText(FontId id, int size, Color color, int x, int y, String s, bool center) {
int ox = 0;
int oy = 0;
Text t(s, getFont(id), size);
if (center) {
sf::FloatRect bounds = t.getLocalBounds();
ox -= bounds.left + bounds.width / 2;
}
t.setPosition(x + ox, y + oy);
t.setColor(color);
renderList.push_back(
[this, t] { display->draw(t); });
}
String Renderer::toUnicode(const string& s) {
std::basic_string<sf::Uint32> utf32;
sf::Utf8::toUtf32(s.begin(), s.end(), std::back_inserter(utf32));
return utf32;
}
Font& Renderer::getFont(Renderer::FontId id) {
switch (id) {
case Renderer::TEXT_FONT: return textFont;
case Renderer::TILE_FONT: return tileFont;
case Renderer::SYMBOL_FONT: return symbolFont;
}
}