PDA

View Full Version : How to display local language fonts in qpainter



vsk.manikandan
7th November 2014, 10:13
Hi Guys,

am new to Qt4 my task is I trying to write different tamil fonts in postscript file , i can able write in tamil but i cannot select any fonts kindly help me


thanks in advance !!



My code :

QPrinter printer;
printer.setOutputFormat(QPrinter::PostScriptFormat );
printer.setOutputFileName("test.ps");
printer.setPaperSize(QPrinter::A4);


QPainter painter(&printer);
painter.drawLine(QPointF(0, 0), QPointF(72, 72));

painter.setPen(Qt::blue);
painter.drawText(10, 10,QString::fromUtf8("நன்றி"));

//painter.setFont(QFont(QString::fromUtf8("TAU_Elango_Todi", 20));
painter.drawText(20, 20,"நன்றி"));
painter.end();

ChrisW67
7th November 2014, 20:45
What do you "cannot select any fonts"? You never get the font to change? The font changes but is not the expected font? You get the correct font but only garbage out?

Your string literal is possibly being misinterpreted. It could be a local 8bit encoding (i.e. not a UTF8) or your compiler could be mangling it before it even gets to Qt.

vsk.manikandan
11th November 2014, 08:34
thanks Chirsw67....