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 isDrawingTool
here, whileLineList
is aQStringList
andWordSpacings
is anstd::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 inWordSpacings
, butDrawingTool
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 mistakingwordSpacing
forletterSpacing
or anything. I'm quite desperate about this one :SThanks 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...