Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    QFont setFixedPitch

    General and Desktop
    1
    4
    4827
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      steno last edited by

      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?

      @QFont dejavu("DejaVu Sans");
      dejavu.setKerning(false);
      dejavu.setFixedPitch(true);
      QFontMetrics fm(dejaVu);
      QRect r1 = fm.boundingRect("Test ");
      QRect r2 = fm.boundingRect("Test0");
      @

      1 Reply Last reply Reply Quote 0
      • ?
        Guest last edited by

        DejaVu Sans is a proportional font. Did you try setFixedPitch with any other proportional font and did that work? Your code snip returns the same bounding rectangle for fixed fonts (DejaVu Sans Mono, courier etc)

        Looks like no effect of calling setFixedPitch ... maybe a bug that you should log "here":http://bugreports.qt.nokia.com

        1 Reply Last reply Reply Quote 0
        • S
          steno last edited by

          So I tried other proportional fonts and set fixed pitch had no effect on them. I logged a bug report.

          1 Reply Last reply Reply Quote 0
          • ?
            Guest last edited by

            thanks :)

            1 Reply Last reply Reply Quote 0
            • First post
              Last post