Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

72pix fonts are same height as 48pix or 54pix fonts #77

Open
i-g-g-y opened this issue Sep 15, 2022 · 3 comments
Open

72pix fonts are same height as 48pix or 54pix fonts #77

i-g-g-y opened this issue Sep 15, 2022 · 3 comments

Comments

@i-g-g-y
Copy link

i-g-g-y commented Sep 15, 2022

I have noticed 2 things.

1). The font size goes to 72 max.
2). from 48 onwards, the size of the font is the same

@i-g-g-y
Copy link
Author

i-g-g-y commented Sep 15, 2022

Forgot to mention, this was observed when using MS Sans Serif

@riuson
Copy link
Owner

riuson commented Sep 15, 2022

Sorry, I can't fix it.
Fonts like

  • Courier
  • MS Sans Serif
  • MS Serif

are bitmap fonts. They can't be scaled to any size. Only fixed list of values are available.
I can only add note for such fonts and update list of sizes.

For example, Arial is a scalable font:

#include "mainwindow.h"
#include <QFontDatabase>
#include <QDebug>
#include <QFontMetrics>
#include <QApplication>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QFontDatabase fonts;
    QString family =
            //"MS Sans Serif";
            //"Arial";
            "Courier";

    QString style = "Normal";

    QList<int> sizes = fonts.smoothSizes(family, style);
    qDebug() << "Sizes for " << family << " " << style;

    for (int i = 0; i < sizes.count(); i++)
    {
        qDebug() << sizes.at(i);
    }

    bool isScalable = fonts.isScalable(family, style);
    bool isSmoothlyScalable = fonts.isSmoothlyScalable(family, style);
    qDebug() << "isScalable: " << (isScalable ? "true" : "false");
    qDebug() << "isSmoothlyScalable: " << (isSmoothlyScalable ? "true" : "false");

    for (int i = 16; i <= 72; i++)
    {
        QFont font = fonts.font(family, style, i);
        QFontMetrics metrics(font);
        qDebug() << "i = " << i << ", h = " << metrics.height();
    }

    MainWindow w;
    w.show();
    return a.exec();
}
Sizes for  "MS Sans Serif"   "Normal"
10
12
15
18
19
22
27
28
35
isScalable:  false
isSmoothlyScalable:  false
i =  16 , h =  23
i =  17 , h =  29
i =  18 , h =  29
i =  19 , h =  28
i =  20 , h =  33
i =  21 , h =  33
i =  22 , h =  33
i =  23 , h =  33
i =  24 , h =  33
i =  25 , h =  41
i =  26 , h =  41
i =  27 , h =  41
i =  28 , h =  42
i =  29 , h =  42
i =  30 , h =  42
i =  31 , h =  42
i =  32 , h =  52
i =  33 , h =  52
i =  34 , h =  52
i =  35 , h =  52
i =  36 , h =  52
i =  37 , h =  52
i =  38 , h =  52
i =  39 , h =  52
i =  40 , h =  52
i =  41 , h =  52
i =  42 , h =  52
i =  43 , h =  52
i =  44 , h =  52
i =  45 , h =  52
i =  46 , h =  52
i =  47 , h =  52
i =  48 , h =  52
i =  49 , h =  52
i =  50 , h =  52
i =  51 , h =  52
i =  52 , h =  52
i =  53 , h =  52
i =  54 , h =  52
i =  55 , h =  52
i =  56 , h =  52
i =  57 , h =  52
i =  58 , h =  52
i =  59 , h =  52
i =  60 , h =  52
i =  61 , h =  52
i =  62 , h =  52
i =  63 , h =  52
i =  64 , h =  52
i =  65 , h =  52
i =  66 , h =  52
i =  67 , h =  52
i =  68 , h =  52
i =  69 , h =  52
i =  70 , h =  52
i =  71 , h =  52
i =  72 , h =  52
Sizes for  "Arial"   "Normal"
isScalable:  true
isSmoothlyScalable:  true
i =  16 , h =  24
i =  17 , h =  26
i =  18 , h =  27
i =  19 , h =  28
i =  20 , h =  32
i =  21 , h =  32
i =  22 , h =  33
i =  23 , h =  35
i =  24 , h =  36
i =  25 , h =  38
i =  26 , h =  40
i =  27 , h =  41
i =  28 , h =  42
i =  29 , h =  44
i =  30 , h =  45
i =  31 , h =  47
i =  32 , h =  49
i =  33 , h =  50
i =  34 , h =  50
i =  35 , h =  53
i =  36 , h =  55
i =  37 , h =  56
i =  38 , h =  58
i =  39 , h =  60
i =  40 , h =  60
i =  41 , h =  63
i =  42 , h =  65
i =  43 , h =  65
i =  44 , h =  66
i =  45 , h =  67
i =  46 , h =  68
i =  47 , h =  71
i =  48 , h =  72
i =  49 , h =  73
i =  50 , h =  75
i =  51 , h =  76
i =  52 , h =  77
i =  53 , h =  80
i =  54 , h =  81
i =  55 , h =  82
i =  56 , h =  83
i =  57 , h =  84
i =  58 , h =  87
i =  59 , h =  88
i =  60 , h =  89
i =  61 , h =  91
i =  62 , h =  92
i =  63 , h =  94
i =  64 , h =  96
i =  65 , h =  97
i =  66 , h =  99
i =  67 , h =  100
i =  68 , h =  101
i =  69 , h =  103
i =  70 , h =  104
i =  71 , h =  106
i =  72 , h =  107
Sizes for  "Courier"   "Normal"
10
12
15
19
isScalable:  false
isSmoothlyScalable:  false
i =  16 , h =  22
i =  17 , h =  29
i =  18 , h =  29
i =  19 , h =  29
i =  20 , h =  29
i =  21 , h =  29
i =  22 , h =  29
i =  23 , h =  29
i =  24 , h =  29
i =  25 , h =  29
i =  26 , h =  29
i =  27 , h =  29
i =  28 , h =  29
i =  29 , h =  29
i =  30 , h =  29
i =  31 , h =  29
i =  32 , h =  29
i =  33 , h =  29
i =  34 , h =  29
i =  35 , h =  29
i =  36 , h =  29
i =  37 , h =  29
i =  38 , h =  29
i =  39 , h =  29
i =  40 , h =  29
i =  41 , h =  29
i =  42 , h =  29
i =  43 , h =  29
i =  44 , h =  29
i =  45 , h =  29
i =  46 , h =  29
i =  47 , h =  29
i =  48 , h =  29
i =  49 , h =  29
i =  50 , h =  29
i =  51 , h =  29
i =  52 , h =  29
i =  53 , h =  29
i =  54 , h =  29
i =  55 , h =  29
i =  56 , h =  29
i =  57 , h =  29
i =  58 , h =  29
i =  59 , h =  29
i =  60 , h =  29
i =  61 , h =  29
i =  62 , h =  29
i =  63 , h =  29
i =  64 , h =  29
i =  65 , h =  29
i =  66 , h =  29
i =  67 , h =  29
i =  68 , h =  29
i =  69 , h =  29
i =  70 , h =  29
i =  71 , h =  29
i =  72 , h =  29

@i-g-g-y
Copy link
Author

i-g-g-y commented Sep 15, 2022

OK, thanks for info, I will use a scalable font then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants