[Qt-interest] View UTF-8 text by QGraphicsTextItem

Frank Mertens frank at cyblogic.de
Sun Mar 7 17:47:21 CET 2010


M. Bashir Al-Noimi wrote:
> Hi All,
> 
> When I tried to add QGraphicsTextItem item in QGraphicsScene object I
> got illegal characters (as shown in the following pix) although I used
> QString::fromUtf8 function !!!
> 
> *How I can view utf8 text in QGraphicsView?*
> 
> 
> snippet---
> 
>     graphic_itemText = new QGraphicsTextItem(QString::fromUtf8("نص عربي"));
>     scene->addItem(graphic_itemText);
>     graphic_itemText->setFont(QFont("Tahoma", 15));
>     graphic_itemText->setPos(sceneWidth-pix_factory.width()-100, 15);
> 

I checked it, it is valid UTF8. Interesting to see some Arab text rendered by Qt.
How is that going for you? Qt seems to even get the cursor movement done right,
although shouldn't the cursor keys be swapped?...
I'm used to switch off font merging to see if the font actually contains
specific glyphs (see QFont::StyleStrategy). And note that with Qt/Cocoa Qt will
switch from ATSUI to CoreText, if you are using a Mac.



More information about the Qt-interest-old mailing list