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. Qt 4 synthesizes Helvetica font on Windows?
Forum Updated to NodeBB v4.3 + New Features

Qt 4 synthesizes Helvetica font on Windows?

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 653 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.
  • S Offline
    S Offline
    stephenju
    wrote on last edited by
    #1

    When I build and run the following code with Qt 4.8 on Windows :
    @
    #include <QApplication>
    #include <QFontDatabase>
    #include <QFontInfo>
    #include <QDebug>
    #include <QPainter>
    #include <QImage>

    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    QFont f("Helvetica");
    QFontDatabase fdb;
    qDebug() << fdb.families().indexOf("Helvetica");
    QImage image(100,100,QImage::Format_ARGB32);
    QPainter painter(&image);
    painter.setFont(f);
    painter.drawText(0,0,"Helvetica");
    qDebug() << fdb.families().indexOf("Helvetica");
    qDebug() << fdb.isSmoothlyScalable("Helvetica") << QFontInfo(f).exactMatch() << QFontInfo(f).family();

    return 0;
    

    }
    @

    It shows this output:
    @
    -1
    126
    true true "Helvetica"
    @

    It indicates that the font "Helvetica" was not available as exact match before I draw some text using it.

    With Qt 5.3:
    @
    -1
    -1
    false false "Arial"
    @

    which is what I expect.

    Is there any way to stop Qt 4 from "synthesizing" a Helvetica font? It doesn't do this with any other fonts I tried.

    1 Reply Last reply
    0

    • Login

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