Hi all,
I loaded a font file from memory, then immediately setFont to a sf::Text, but don't know why the program crashes and force to quit.
bool ok = m_font.loadFromMemory(byteArr.data(),byteArr.size()); // byteArr is QByteArray stored in a QMap
if(ok)
{
qDebug() << "load font from memory ok";
m_text.setFont(m_font); // call this function crashes program
}else
{
qDebug() << "load font from memory failed";
}
but I use sf::Font::loadFromFile() is OK, draw text correctly
QString path = "....a font file path...";
m_font.loadFromFile(path.toStdString());
m_text.setFont(m_font);
where m_font is a sf::Font member variable of a RenderWindow subclass
m_text is sf::Text member variable of the same RenderWindow subclass
the font file used is a Chinese font with size > 5MB
PS: I use Qt 4.7.4 with MinGW
Thanks.