Fonts always bold in Devanagari under Android



  • Hi,
    I am programming an bilingual English / Devanagari app for Android using Noto Font from Google under QT 5.8. Noto has a normal and bold styles for Devanagari symbols.

    Font loading and use in QML are working fine for latin characters. But Devanagari on Android is always rendered bold. Whatever I try, there is no difference. Also loading another font with Devanagari symbols is no solution.

    Devanagari symbols are rendered flawless (thick and thin) if compiled for macOS Desktop QT 5.8 clang_64 bit.

    Is anyone experiencing the same? Or is this a bug?
    Thank you very much

    QML
    FontLoader { id: appFontRegularHindi;   name: "NotoSansDevanagariRegular";  source: "fontsHi/NotoSansDevanagari-Regular.ttf" }
    FontLoader { id: appFontBoldHindi;      name: "NotoSansDevanagariBold";     source: "fontsHi/NotoSansDevanagari-Bold.ttf" }
    
                   TextArea {
                        textFormat: Text.RichText
                        onLinkActivated: Qt.openUrlExternally(link)
                        font.pointSize: 16
                        font.family:    appFontRegularHindi.name
                        font.weight:    Font.Thin
                        font.bold:      false
                        text:           "मेरा नाम रवि है"
                    }
    


  • Just 2 ideas, even though you have tried "everything"

    • font.weight is Thin, which sounds wrong for a "regular" font.
    • when something funny is going on, I accept that the fix can be irrational too, just changing random things to shuffle the bytes around. For that end, I'd change the order the fonts are loaded (there could also be a bug that uses under some conditions the last font loaded)


  • Thank you for your ideas mvuori

    • font.weight: Font.Normal unfortunately doesn't do anything
    • changing the order didn't do it either
    • while playing with the order, I commented out all font loading. Which should mean that, Android falls back to the default system font. And you won't believe it, that's also rendered bold all the time, wherever I have Devanagari symbols. Wherever there are latin ciphers as in a date or numbers, they are rendered normal and slim.


  • Alright, problem solved. As so many times, the bug was sitting between chair and keyboard.

    In the FontLoader, I had the name property set. Which is set automatically if a font is loaded by source. https://doc.qt.io/qt-5/qml-qtquick-fontloader.html

    Having the name property set while loading a font by source is no problem under macOS but under Android, one Devanagari font started to dominate all instances, where Devanagari symbols appeared and all logic, how fonts are applied falls apart.



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