Results 1 to 10 of 10

Thread: Qt 5.3.0 display Arabic text wrong :(

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2013
    Location
    shanghai
    Posts
    14
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11

    Default Re: Qt 5.3.0 display Arabic text wrong :(

    Quote Originally Posted by anda_skoa View Post
    A single QTextDocument only uses one layouting engine.


    I assume QTextDocument uses QPainter::drawText(), but on top of that performs text layouting.
    So it is not an either/or choice, more a with/without layout one.

    Cheers,
    _
    Thanks again! Acutally i dont really get what you mean I just wanna know if you guys had met the same problem using drawText ever, and if you guys have any idears about there the bug is?

  2. #2
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Thanks
    4
    Thanked 140 Times in 132 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qt 5.3.0 display Arabic text wrong :(

    Please provide minimum compilable example reproducing the problem, so we can see your actual code and check if there is something wrong or not.
    I would like to be a "Guru"

    Useful hints (try them before asking):
    1. Use Qt Assistant
    2. Search the forum

    If you haven't found solution yet then create new topic with smart question.

  3. #3
    Join Date
    Oct 2013
    Location
    shanghai
    Posts
    14
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11

    Default Re: Qt 5.3.0 display Arabic text wrong :(

    Quote Originally Posted by faldzip View Post
    Please provide minimum compilable example reproducing the problem, so we can see your actual code and check if there is something wrong or not.
    Oh yeah, sorry, i should have posted it. just very simple example like here, I dont really think its the problem of my code, i used the same code in qt4.8.3, it works fine...

    //just reinplement virtual function paintEvent and use QPainter instance to paint it

    void MainWindow:aintEvent(QPaintEvent *)
    {
    QPainter painter;
    painter.begin(this);

    QRect rect1 = QRect(20, 20, 760, 420);
    QRect rect2 = QRect(50,50,700,400);
    QPen pen=QPen(Qt::red);

    painter.setPen(pen);
    QFont font;
    font.setFamily("Droid Arabic Naskh");
    font.setItalic(false);
    font.setPixelSize(47);
    painter.setFont(font);

    QTextOption textOption;
    textOption.setTextDirection(Qt::LeftToRight);

    painter.drawText(rect1,QString::fromWCharArray(L"W elcome to the world of العالم في navigatio"),textOption);


    painter.end();
    }

  4. #4
    Join Date
    Oct 2013
    Location
    shanghai
    Posts
    14
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11

    Default Re: Qt 5.3.0 display Arabic text wrong :(

    Thank god, finally i found how it happens....qt5.3.0 uses new unicode 6.3 while qt4.8.3 uses Unicode6.2... they have different ways to itemizer strings...like arabic text, in qt4.8.3,,e.g "العالم في" it will be itemizered into 3 items, second item is space button...while in qt5.3.0, it will just itemizer into 1 items...so when it counts width to draw text, it gets full width while just draw part of arabic string.......confused?! sorry im not native english speaker.....ok here is the place and they way to fix it... in file "qtextlayout.cpp" , line 2025,,, x position shouldnt be positioned by si.width as si is the item of all arabic text with space..... so should be " x += gf.width; " just hope you guys can see it and wont spend too much time on this stupid bugs by Qt....cheers, and thank you all

  5. #5
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qt 5.3.0 display Arabic text wrong :(

    Quote Originally Posted by aniasen View Post
    just hope you guys can see it and wont spend too much time on this stupid bugs by Qt....cheers, and thank you all
    Have you reported the problem and the fix so other won't run into the bug anymore?

    Cheers,
    _

  6. #6
    Join Date
    Oct 2013
    Location
    shanghai
    Posts
    14
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11

    Default Re: Qt 5.3.0 display Arabic text wrong :(

    Quote Originally Posted by anda_skoa View Post
    Have you reported the problem and the fix so other won't run into the bug anymore?

    Cheers,
    _
    Yeah, I did, you could visit QTBUG-40617 and they have confirmed it thank you so much btw!
    Last edited by anda_skoa; 15th August 2014 at 09:25. Reason: make link clickable

Similar Threads

  1. Replies: 0
    Last Post: 30th January 2014, 13:35
  2. Please help with Arabic text printing and PDF creation
    By ahmedb in forum Qt Programming
    Replies: 8
    Last Post: 11th November 2013, 21:10
  3. Arabic text rendering; issues with parentheses
    By TropicalPenguin in forum Qt Programming
    Replies: 4
    Last Post: 10th September 2013, 09:53
  4. How to display text from a file to a text browser
    By ironmantis7x in forum Newbie
    Replies: 11
    Last Post: 14th June 2012, 15:23
  5. sort row by column , when getting text alwas wrong
    By umen in forum Qt Programming
    Replies: 2
    Last Post: 5th July 2011, 08:35

Tags for this Thread

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.