Blurred fonts / text rendering with Qt/Embedded 4.7.1



  • Hello,

    when drawing text with QPainter, the output looks blurry, especially with small font sizes (about < 14 pixels in height).

    I tried three different truetype font files (Freefont (20100919), VU Arial and Arial Unicode MS; the latter two at least should have a very good hinting, I suppose), but the effect stays more or less the same.

    In an older project based on Qt-Embedded 3.3.8 I can remember that at least VU Arial did yield clean, appealing antialiased results.

    The target device is the Linux framebuffer or QVFb (both x86-32bit), the bluriness appears both with depth 16 and 32bit.

    I tried the following combinations:

    • Qt4.7.1 with build-in libfreetype (2.3.9).
    • Qt4.7.1 with system libfreetype (Debian testing) 2.4.4

    I did NOT compile fontconfig support into Qt.

    I also played with QPainter::TextAntialiasing turned off and QFont::NoAntialias which did only yield
    chunky, ugly non-antialiased text (well, at least this, just as it is supposed to ... ;-) )

    To make sure the right truetype font file was loaded, I explicitly set QT_QWS_FONTDIR to a directory only containing
    the font in question.

    Searching the web for blurred text rendering, I found only hints concerning desktop environments.

    So, am I the only one using Qt/Embedded having these troubles?
    What am I doing wrong?
    How can I tweak Qt4 and/or libfreetype to try out variations in font rendering and filtering?
    How do YOU get appealing antialiased fonts at small sizes with Qt/Embedded?

    Any help is appreciated.

    Thanks in advance.

    -zaphod



  • [quote author="zaphod" date="1302607471"]Hello,
    Searching the web for blurred text rendering, I found only hints concerning desktop environments.
    -zaphod[/quote]

    So do these hints work on your environment? Have tried your source code on a desktop? Regarding the nature of Qt everything should be the same on both platforms otherwise you can consider raising a bug regarding this issue.

    Best regards,
    Leon



  • The hints for desktop environments were all about GTK and/or fontconfig settings. Since I have no fontconfig support compiled into my Qt/Embedded, they don't work for me.

    However, having a second and third look at them led me to the solution:
    Qt/Embedded sets FT_LOAD_NO_HINTING when loading glyphs, which yields exact, but unfortunaely blurry results. After patching this away, rendered fonts look exactly as on my X11 desktop and this is what I wanted.

    Thanks nonetheless

    -zaphod



  • [quote author="zaphod" date="1302796301"]However, having a second and third look at them led me to the solution:
    Qt/Embedded sets FT_LOAD_NO_HINTING when loading glyphs, which yields exact, but unfortunaely blurry results. After patching this away, rendered fonts look exactly as on my X11 desktop and this is what I wanted.[/quote]

    Well done for solving it and thanks for sharing - someone else also may use it :)


Log in to reply
 

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