How to print text with the right font
Solved
General and Desktop
-
Hi!
How to print text with the right font?
If I do so, the font does not change.QString testText = "test1"; int id = QFontDatabase::addApplicationFont(":/fonts/code128.ttf"); QString family = QFontDatabase::applicationFontFamilies(id).at(0); QFont font(family); font.setPixelSize(30); QStaticText testStaticText; testStaticText.setText(testText); QTransform transform; testStaticText.prepare(transform,font); QPrinter printer; QPainter painter; painter.begin(&printer); painter.drawStaticText(0, 0, testStaticText); painter.end();