QFont::setWordSpacing working, but not applied by QPainter



  • Hello,

    I set my QFont this way, in the constructor of a class:

    LORE_FONT(QFontDatabase::applicationFontFamilies(QFontDatabase::addApplicationFont("construct/CardLore1.otf")).at(0), 14),
    

    then proceeded to use it by drawing QStrings with a QPainter (the QPainter object is DrawingTool here, while LineList is a QStringList and WordSpacings is an std::vector<qreal>)

    	for (i = 0; i < n; ++i)
    	{
    		LORE_FONT.setWordSpacing(WordSpacings[i]);
    		std::cout << LORE_FONT.wordSpacing() << std::endl;
    		DrawingTool.setFont(LORE_FONT);
    		DrawingTool.drawText(32, 490+i*LineSpacing, LineList[i]);
    	}
    

    std::cout prints the correct values in WordSpacings, but DrawingTool fails to use them. It's as if the word spacing was 0 all the time. Yes, my QStrings have white spaces, and I'm not mistaking wordSpacing for letterSpacing or anything. I'm quite desperate about this one :S

    Thanks in advance for any help.



  • I would like to bump this. It seems that the code works fine for all fonts, and for all computers BUT my own computer. I've tested other fonts on my computer and I had the same problem.

    I have no idea why and I'm not sure where to look. I'm using Ubuntu LTS 14.04. I've uninstalled and reinstalled Qt but that didn't change anything. If anybody has a possible explanation, or the beginning of a track, by all means share! Thank you.



  • I would like to bump this again...


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.