×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Jan 2004
    Posts
    44

    How to get Monospace Font in Qt

    Hi! Does anyone know how to get a monospace font in Qt, on S60.

    I've tried QFont("Courier"), but that does not return a Courier font on a Nokia 5530.

    If there is no way to explicitly get a monospace font, could someone say which monospace font is guaranteed to be present on Nokia S60 phones?

    Thanks in advance!

  2. #2
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: How to get Monospace Font in Qt

    Fonts are device-specific. The attached mini-app will display the available fonts on your device. (Note that there will be significant differences between simulator/emulator/device.)
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    Aug 2009
    Posts
    173

    Re: How to get Monospace Font in Qt

    FontDemo on my E71 (S60 3rd Ed. FP1) device shows this in case with available fonts :



    But had to change source code a little bit in E71's case, that device is able
    to show the whole form on it's sceen :

    //w.showFullScreen();
    w.showMaximized();

  4. #4
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: How to get Monospace Font in Qt

    Yeah, the app's a quick hack -- certainly not "production" quality. It was just written to get the job done.

  5. #5
    Registered User
    Join Date
    Jan 2004
    Posts
    44

    Re: How to get Monospace Font in Qt

    Thanks a lot for the replies, guys. That's somewhat sad news. Apparently there is no monospace font guaranteed to be present, which I find hard to believe is the final word on this topic.
    But thanks again!

  6. #6
    Registered User
    Join Date
    Aug 2009
    Posts
    27

    Re: How to get Monospace Font in Qt

    I also needed a monospace font and ended up using things like:
    QString space(" ");
    QFontMetrics result = fontMetrics();
    int spaceWidth = result.width(space);
    where "space" could be any string

Similar Threads

  1. N97/Qt 4.6.2: Fixed width font?
    By hurenkam in forum Qt
    Replies: 5
    Last Post: 2010-03-22, 21:44
  2. Monospace font in Nokia 6270
    By kirtimaan in forum Mobile Java Media (Graphics & Sounds)
    Replies: 5
    Last Post: 2007-06-13, 05:47
  3. Nokia support for MONOSPACE font
    By larry_ger in forum Mobile Java General
    Replies: 1
    Last Post: 2004-01-18, 11:50

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×