Results 1 to 3 of 3

Thread: How to display local language fonts in qpainter

  1. #1
    Join Date
    Nov 2014
    Location
    Dharmapuri
    Posts
    2
    Thanks
    1
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Android

    Default How to display local language fonts in qpainter

    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_Elang o_Todi", 20));
    painter.drawText(20, 20,"நன்றி"));
    painter.end();

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to display local language fonts in qpainter

    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.

  3. The following user says thank you to ChrisW67 for this useful post:

    vsk.manikandan (11th November 2014)

  4. #3
    Join Date
    Nov 2014
    Location
    Dharmapuri
    Posts
    2
    Thanks
    1
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Android

    Default Re: How to display local language fonts in qpainter

    thanks Chirsw67....

Similar Threads

  1. Replies: 2
    Last Post: 26th December 2012, 01:03
  2. Replies: 2
    Last Post: 1st September 2012, 09:10
  3. Load multi language fonts at the same time
    By lllturtle in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 12th April 2012, 08:20
  4. qml change local language
    By goli in forum Qt Programming
    Replies: 1
    Last Post: 29th May 2011, 12:20
  5. QPainter drawText with different language
    By lni in forum Qt Programming
    Replies: 4
    Last Post: 11th June 2009, 19:54

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.