Dilemma with Truetype/ClearType or maybe Qt itself?



  • Hi,

    i am currently developing a rather simple tool to demonstrate how unique ttf/otf-fonts can look like on a LED-Display.

    What it does: it renders with a given font some text on a QImage, which is then saved as a bitmap-output-file. That BMP is then scanned pixel-by-pixel and that data is used to show some LED-kind-of-image.
    As you might now, it is possible to save Bitmap-Characters into TTFs/OTFs, which then will be applied at certain font-sizes.

    However, when in Linux the general font-smoothing is activated (in CentOS found inside the appearance seetings) or in Windows the so called ClearType feature, those features prevent the usage of those embedded bitmaps.
    And furthermore they also alter the fonts in some ways, such as Anti-Aliasing and Subpixelrendering.

    My first thought on this was to switch off those features completely, which does do the job for once. But doesn't solve the problem, as you need administrative rights to do so, and the software needs to run anywhere without those.
    Then I found out that while ClearType under Windows is turned off, one can seperately turn it on inside InternetExplorer.

    Therefore I thought there should be some kind of way to tell my app not to use this feature.
    Microsoft Developer Network (MSDN) didn't help much so far. Besides the same kind of effect can be seen in Linux, too.
    Conclusion: There MUST be a control inside Qt which decides wether to use those features or not.

    To round this up, here is what I tried and did not work so far:

    • CustomFont.setKerning(false);
    • CustomFont.setStyleStrategy(QFont::NoAntialias);
    • CustomFont.setStyleStrategy(QFont::PreferBitmap);
    • CustomFont.setStyleStrategy(QFont::NoSubpixelAntialias);
    • CustomFont.setHintingPreference(QFont::PreferNoHinting);
    • CustomPainter.setRenderHint(QPainter::Antialiasing, false);
    • CustomPainter.setRenderHint(QPainter::HighQualityAntialiasing, false);

    Appreciate any help/advice you got on this one.

    Cheers


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You should bring that question on the interest mailing list You'll find there Qt's developers/maintainers (this forum is more user oriented)



  • @SGaist thanks for the advice, I'll give it a try.



  • Ok, I found the solution for Windows-Side:
    When opening a font with FontForge, there (in GridFitting-Options) one can set certain attributes for certain point-sizes, such as Antialiasing. There is even two special columns for giving attributes to ClearType. These settings will be respected by ClearType, so no need to switch it off.

    On Linux based OS, I still am no further, except that I know that some sort of fontconfig is what Qt5 "reads" and therefore decides. Unfortunately the Linux-RenderEngine ignores the above mentioned internal font-attributes.



Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.