PDA

View Full Version : Printing Unicode?



auba
3rd June 2009, 17:11
I have some trouble to print Unicode characters with QPrinter and QPainter, especially Russian and Arabian.
To print out, I use nothing special:

bool TWinPrinter::printStr(TDeviceIO*, const QString& str) {
QFontMetrics fm = m_Painter.fontMetrics();
m_Painter.drawText(m_X, m_Y, str);
m_X += fm.width(str);
return TRUE;
}

When I print ascii texts, it works - of course. But UTF16 chars are not printed. I also played around with setting a printer font, without success. Do I miss something? How can I print out unicode texts to a QPrinter?

auba
3rd June 2009, 17:32
Was a problem with QString and QChar. Sorry.

auba
4th June 2009, 16:24
I still have an error with Arabian/Persion characters and QPrinter and/or QPainter. When I have a line containing one arabian character, the line is printed from right to left - but english characters, too. It looks something like

Name (Count) Description
Dream (5) Something to talk about
<some arabian description> )6( Nightmare

Is this a known issue of qt3 (I am using qt3.38)?