Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QPainter::drawText(QRectF ...) draws with very unequally spaces between the characters
Forum Updated to NodeBB v4.3 + New Features

QPainter::drawText(QRectF ...) draws with very unequally spaces between the characters

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 398 Views 1 Watching
  • 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.
  • NiagarerN Offline
    NiagarerN Offline
    Niagarer
    wrote on last edited by
    #1

    Hi!
    When I use the font "Corbel" and draw a text like the following

    QRectF testRectF = QRectF(QPointF1, QPointF2);
    painter->drawText(testRectF, Qt::AlignVCenter | Qt::AlignLeft, "some text");
    

    I get really ugly results like the following

    0_1525344174258_Qt 33.png
    There is more space between the 'i' and the 'a' for example than between the words "counter" and "variable" (there is a actual space between them, not between the 'i' and the 'a'). So, the spaces between the characters are very unequally.
    When I use the font Arial, it is better, but still wrong, so it's not the font itself.
    Has anyone an idea what the problem could be?
    Thanks!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      IIRC, you need to use a monospaced font for that kind of use case.

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved