[Development] Why on Linux using FreeType engine fonts are rendered in 72 dpi instead of Screen DPI?

Tomasz Olszak olszak.tomasz at gmail.com
Wed Oct 17 17:59:26 CEST 2018


Hi,

I would like just to ensure that I missed something and there is
documentation somewhere informing that Linux fonts are rendered
*always* in 72 dpi
(https://www.freetype.org/freetype2/docs/reference/ft2-base_interface.html#FT_Set_Char_Size)
(which makes font.pixelSize inaccurate for regular screens).

I found: https://bugreports.qt.io/browse/QTBUG-8890 which fixes the
problem but it was rejected. I see the default 72 dpi is also used in
current Qt 5.11 FT engine
(https://code.woboq.org/qt5/qtbase/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp.html#297).

Does it surprise any of Qt developers or is it only me? Am I right
thinking that when we do following:
Rectangle {
   height: 100
   Text {font.pixelSize: 100}
}
then the relation between height of text and height of rectangle will
differ depending on screen dpi (don't have a way to test it
currently)?

Moreover I'm pretty sure that's the cause I very often use
Text.fontSizeMode: Text.Fit  because setting pixelSize to height of
desired text size never worked correctly :)

tl;dr: Is it a bug?



More information about the Development mailing list