Results 1 to 4 of 4

Thread: QFontDatabase::addApplicationFont doesn't work for all fonts

  1. #1
    Join Date
    Jul 2011
    Posts
    4
    Qt products
    Qt4
    Platforms
    Symbian S60

    Default QFontDatabase::addApplicationFont doesn't work for all fonts

    Hello,

    I'm having problems using chinese .ttf font (on Symbian Device using Qt4.7.3)
    When I load a "standard" font like Arial, it works. Loading a Chinese Font doesn't work.

    Qt Code:
    1. MainWindow::MainWindow(QWidget *parent)
    2. : QMainWindow(parent), ui(new Ui::MainWindow)
    3. {
    4. QFileDialog dialog(this);
    5. dialog.setFileMode(QFileDialog::ExistingFile);
    6. QString fileName;
    7. fileName = dialog.getOpenFileName(this);
    8. qDebug()<<QFontDatabase::addApplicationFont(fileName);
    9. //qDebug displays 0 for Arial.ttf, but -1 for chinese.ttf (not the real font Name)
    10. bool ok;
    11. QApplication::setFont(QFontDialog::getFont(&ok,this));
    12. //**see below
    13. ui->setupUi(this);
    14. }
    To copy to clipboard, switch view to plain text mode 

    **As a consequence the font Dialog has Arial in its font list and returns true when selecting it, but not the chinese one.

    -The fonts are located in the same directory.
    -I got both fonts from the Windows Font Directory

    I just found similar threads about addApplicationFont not working at all. But as it works for some fonts I don't know what I did wrong.

    Thanks,
    Chris

  2. #2
    Join Date
    Jul 2011
    Posts
    4
    Qt products
    Qt4
    Platforms
    Symbian S60

    Default Re: QFontDatabase::addApplicationFont doesn't work for all fonts

    No ideas?
    Maybe I should repost it to the Embedded/Mobile Forum?

  3. #3
    Join Date
    May 2011
    Posts
    239
    Thanks
    4
    Thanked 35 Times in 35 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Symbian S60

    Default Re: QFontDatabase::addApplicationFont doesn't work for all fonts

    I would post it on Nokia Developer site and define the actual font (I understand that it is one particular font, not any Chinese font). After all, fonts have bugs too.

  4. #4
    Join Date
    Jul 2011
    Posts
    4
    Qt products
    Qt4
    Platforms
    Symbian S60

    Default Re: QFontDatabase::addApplicationFont doesn't work for all fonts

    Well I tried different chinese fonts, two or three. Same error with all of them.

Similar Threads

  1. Replies: 5
    Last Post: 21st June 2012, 00:40
  2. setWindowFilePath seems doesn't work
    By borisbn in forum Qt Programming
    Replies: 7
    Last Post: 15th June 2011, 19:26
  3. setWindowModality doesn't work
    By dude in forum Qt Programming
    Replies: 3
    Last Post: 15th February 2008, 15:11
  4. why doesn't the button work?
    By mattia in forum Newbie
    Replies: 18
    Last Post: 5th November 2007, 13:14
  5. setMouseTracking() doesn't work.
    By luffy27 in forum Qt Programming
    Replies: 13
    Last Post: 27th April 2007, 19:16

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.