Your example works fine, but it draws only one word. Just change the source a little bit to draw a little bit more and you'll see the difference.
I've made the font a little bit smaller and replaced
path.addText(0, 96, fnt, txt);
path.addText(0, 96, fnt, txt);
To copy to clipboard, switch view to plain text mode
with
int lineHeight = fontMetrics.height();
int y = 0;
{
path.addText(0, y, fnt, line);
y += lineHeight;
}
QStringList lines = txt.split("\n");
QFontMetrics fontMetrics(fnt);
int lineHeight = fontMetrics.height();
int y = 0;
foreach(QString line, lines)
{
path.addText(0, y, fnt, line);
y += lineHeight;
}
To copy to clipboard, switch view to plain text mode
Use a static color for the brush (otherwise the difference is not so big...). Then let the program draw 6 or more lines of text on Linux and on Windows. On Windows it needs a few seconds. Because my application often has to draw outlined text, I need some faster solution although it is drawn once on a QPixmap. Thanks for trying to help even though I still have no solution.
Bookmarks