Important: Please read the Qt Code of Conduct -

Font rendered in Linux Ubuntu 18.04 is not same as Embedded Linux

  • Hi,
    I am using Qt5.6.3,
    I have Qt/QML Application, in which I have loaded the Qt Font as below
    My Application must run on platforms: Windows, Windows CE, Ubuntu 18.04 and Embeded Linux(built using Buildroot)

    In Application, I am loading Font as below

    QFont arialFont("Arial Unicode MS", 15);

    In QML, I show a text as below

            id: txt
            color: "#1E1E1E"
            elide: Text.ElideRight
            horizontalAlignment: Text.AlignHCenter
            text: "Start Apt"

    The text is elided(looks different) in embedded Linux platform when compared with Ubuntu Linux desktop(18.04).

    I managed to match fonts in windows with Ubuntu Linux desktop. By explicitly using freetype font engine in windows desktop.(modifying qt.conf)

    Free type is used in Linux for font rendering and Qt is configured for system freetype. I used different freetype versions(2.9.1, 2.6.1, 2.5.3 and 2.3.12) and didn't see much variation.

    I also gathered font information by logging them.

    Values of font properties that are logged and are same in all platforms:

    Text Width: 52
    Font Point size: 10
    Font Family: Arial Unicode MS
    Font Pixel size: 13
    Font letter spacing: 0
    Font Weight: QFont:: Normal-50
    Font Ratio: 1
    Hinting Preference: PreferDefaultHinting
    Capitalization: Capitalize
    SpacingType: PercentageSpacing
    Stretch: Unstretched
    Style: Normal
    StyleHint: AnyStyle
    StyleStrategy: PreferDefault
    Weight: Normal

    Only below property is different

    Text Painted Width: 48.35 in Linux Ubuntu and 47.39 in embedded Linux

    Below picture shows the difference:

    Left side is Ubuntu Linux Desktop(18.04) and right is Embedded Linux

    Is there any way I can make fonts looks similar in all platforms?

Log in to reply