Results 1 to 3 of 3

Thread: QFont setFixedPitch

  1. #1
    Join Date
    Nov 2009
    Location
    Sacramento, CA
    Posts
    24
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default QFont setFixedPitch

    Setting setFixedPitch to true doesn’t seem to work with Dejavu sans. Is this allowed? The following code doesn’t yeild the same rectangles for the given text. To me if you set fixed pitch to true, those rectangles should be the same. Am I wrong here?

    Qt Code:
    1. QFont dejavu("DejaVu Sans");
    2. dejavu.setKerning(false);
    3. dejavu.setFixedPitch(true);
    4. QFontMetrics fm(dejaVu);
    5. QRect r1 = fm.boundingRect("Test ");
    6. QRect r2 = fm.boundingRect("Test0");
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    May 2009
    Location
    Canada
    Posts
    163
    Thanks
    7
    Thanked 20 Times in 20 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Windows Android

    Default Re: QFont setFixedPitch

    Is this copy-paste? It runs?

  3. #3
    Join Date
    Nov 2009
    Location
    Sacramento, CA
    Posts
    24
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QFont setFixedPitch

    Yes that code runs. Of course you have to add some stuff for it to be complete.

Similar Threads

  1. CFont to QFont
    By suneel1310 in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 29th July 2010, 09:56
  2. QFont and DPI
    By ArlexBee-871RBO in forum Qt Programming
    Replies: 2
    Last Post: 9th March 2010, 14:31
  3. QFont, inclination
    By Piskvorkar in forum Qt Programming
    Replies: 0
    Last Post: 28th September 2009, 09:36
  4. QFont
    By ghorwin in forum Qt Programming
    Replies: 1
    Last Post: 23rd January 2007, 21:44
  5. Default value for QFont
    By Kapil in forum Qt Programming
    Replies: 1
    Last Post: 2nd June 2006, 06:40

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.