Results 1 to 2 of 2

Thread: Load multi language fonts at the same time

  1. #1
    Join Date
    Mar 2011
    Posts
    20
    Thanks
    6
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Question Load multi language fonts at the same time

    Hi guys,
    i want to show multi languages(English, HEBREW, Thai, ARABIC, Chinese) as a selection list,
    i find something about insert substitution
    void QFont::insertSubstitution ( const QString & familyName, const QString & substituteName )
    and
    void QFont::insertSubstitutions ( const QString & familyName, const QStringList & substituteNames )
    but failed , below is my code of loading fonts
    first , i'm using the debug message to show the support family, i don't know if this is a proper way to find the support font,
    please correct me if it's a wrong solution
    Qt Code:
    1. /* output the support font */
    2. qDebug() << qfd.families(QFontDatabase::Hebrew);
    3. qDebug() << qfd.families(QFontDatabase::Arabic);
    4. qDebug() << qfd.families(QFontDatabase::Thai);
    5. qDebug() << qfd.families(QFontDatabase::TraditionalChinese);
    To copy to clipboard, switch view to plain text mode 
    after get the debug message , i'm using tool "makeqpf" to create qpf2 files such as
    wenquanyi_micro_hei(for chinese), sans_serif(for HEBREW, ARABIC), waree(for Thai)
    and i need to load all of them to show the correct words, but failed

    In this way, i can show the chinese, english, hebrew, arabic but not thai,
    Qt Code:
    1. QFont font1("WenQuanYi Micro Hei [prerendered]",14,50,FALSE);
    2. subs << "DejaVu Sans [prerendered]" << "Waree" ;
    3. font1.insertSubstitutions("WenQuanYi Micro Hei [prerendered]", subs);
    4. qApp->setFont(font1);
    5.  
    6. qDebug() << font1.family() ;
    7. QStringList sl = font1.substitutions() ;
    8. qDebug() << sl.isEmpty() ;
    9. qDebug() << sl ;
    10. qDebug() << font1.substitutes("WenQuanYi Micro Hei [prerendered]") ;
    To copy to clipboard, switch view to plain text mode 

    and i just make another test to change the font family
    Qt Code:
    1. QFont font1("DejaVu Sans [prerendered]",14,50,FALSE);
    2. subs << "WenQuanYi Micro Hei [prerendered]" << "Waree" ;
    3. font1.insertSubstitutions("DejaVu Sans [prerendered]", subs);
    4. qApp->setFont(font1);
    To copy to clipboard, switch view to plain text mode 
    if i insert "DejaVu Sans" first, when i open the multi language page,
    the program crashed, i guess it's because the program can't show chinese and crashed,
    i just can't figure it out why this happened ,
    in my eyes , that two ways above was almost the same, can anyone explain for me?

    and the final goal is to show all the language at the same time
    so i need load waree and show it correctly, please help
    thanks

  2. #2
    Join Date
    Mar 2011
    Posts
    20
    Thanks
    6
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Exclamation Re: Load multi language fonts at the same time

    hello~ guys ,
    is there someone who know this issue ?
    i've also tried to read the "Thai" font "Waree" like below
    Qt Code:
    1. QFont font1("Waree",14,50,FALSE);
    To copy to clipboard, switch view to plain text mode 
    in this way, i can see the "Thai" font in my program,
    but the others disappear, (Hebrew, Arabic, Traditional Chinese) all remain in blank
    please help !

    any reply will be appreciated!!

Similar Threads

  1. Qt Assistant for custom help and multi-language
    By bec in forum Qt Programming
    Replies: 0
    Last Post: 14th April 2011, 09:54
  2. multi language support example
    By Ratheendrans in forum Qt Programming
    Replies: 6
    Last Post: 3rd April 2011, 03:50
  3. Multi language translation
    By bhaskar in forum Installation and Deployment
    Replies: 1
    Last Post: 14th June 2010, 17:30
  4. Problem at time compilation in traslation of language
    By thomasjoy in forum Qt Programming
    Replies: 3
    Last Post: 22nd May 2007, 15:18
  5. Help!! cannot load Fonts!
    By gattogio in forum Qt Programming
    Replies: 5
    Last Post: 24th February 2007, 14:37

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.