Results 1 to 2 of 2

Thread: QFontDatabase::pointSizes question / bug

  1. #1
    Join Date
    Dec 2007
    Qt products
    MacOS X Windows

    Exclamation QFontDatabase::pointSizes question / bug

    Hi Guys,

    I'd like to list the available font sizes of the user selected font - like a custom font dialog. I have some problem with the size of the NonScalableFonts.

    If I select a scalable font, than its sizes are (6, 7, 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72). This is the returned list of the QFontDatabase::pointSizes method.

    If I selects a NonScalableFont - for example font Terminal - and ask for its size with pointSizes than the list is the same, but this shouldn't be.

    I've tried this with thing with QFontDialog::getFont, than this dialog has the same problem. I select there the Terminal font, and change the size form 6 to 7 or 8 but the preview window has the font with unchanged size. So this means to me that something is wrong. The officially available sizes for the font Terminal are 4.5, 6, 9, 12, 13.5.

    This is the code, how I try to get the available sizes and display it in a message box:

    Qt Code:
    1. void Class::getAvailableFontSizes(const QString& fontName){
    2. QString str;
    3. QFontDatabase database;
    4. QList<int> fontSizes = database.pointSizes(fontName);
    6. str.append("FontName: "+fontName+"\n");
    8. for(int i = 0; i < fontSizes.size(); ++i){
    9. str.append("("+QString::number(i)+") "+ QString::number("\n");
    10. }
    12. QMessageBox mb(this);
    13. mb.setText(str);
    14. mb.exec();
    15. }
    To copy to clipboard, switch view to plain text mode 

    Am I missing something??
    How can I get the correct sizes??

    Last edited by giotto; 14th October 2008 at 13:52. Reason: Disable smilies in text

  2. #2
    Join Date
    Jan 2006
    Warsaw, Poland
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Unix/X11 Windows

    Default Re: QFontDatabase::pointSizes question / bug

    What does QFont( fontName ).exactMatch() return?

Similar Threads

  1. Useless but curious compiler warning question
    By Raccoon29 in forum General Programming
    Replies: 4
    Last Post: 30th July 2008, 20:46
  2. SQL Question
    By ^NyAw^ in forum Qt Programming
    Replies: 5
    Last Post: 8th April 2008, 19:36
  3. Access to QSqlTableModel::isDirty Question.
    By patrik08 in forum Qt Programming
    Replies: 3
    Last Post: 12th April 2007, 17:49
  4. QThread exit()/quit() question
    By TheKedge in forum Qt Programming
    Replies: 1
    Last Post: 28th August 2006, 14:38

Tags for this Thread


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.