Text rendering problems



    1. Unicode characters break layout in Qml
      0_1507900161426_qt_unicode.png

    In 1st grid is the text as is should be.

    In 2nd grid inserted ⭐ character in text2.

    In 3rd grid I created a dummy Text

    text: t2.text
    

    and calculated the Test2 pixel size

    font.pixelSize: t1.font.pixelSize * t1.height / dummy.height
    

    but text is rendered too small.

    EDIT: Example code

    import QtQuick 2.7
    import QtQuick.Controls 2.0
    import QtQuick.Layouts 1.3
    
    ApplicationWindow {
        visible: true
        width: 400
        height: 200
        title: qsTr("Hello World")
    
        Text {
            id: dummy
            visible: false
            font.bold: true
            text: t2.text
        }
    
        RowLayout {
            anchors.centerIn: parent
            spacing: 40
    
            GridLayout {
                columns: 2
                Text {
                    text: qsTr("Test1:")
                }
                Text {
                    id: t1
                    font.bold: true
                    text: qsTr("Test2")
                }
                Text {
                    text: qsTr("Test3:")
                }
                Text {
                    font.bold: true
                    text: qsTr("Test4")
                }
            }
    
            GridLayout {
                columns: 2
                Text {
                    text: qsTr("Test1:")
                }
                Text {
                    font.bold: true
                    text: qsTr("⭐Test2")
                }
                Text {
                    text: qsTr("Test3:")
                }
                Text {
                    font.bold: true
                    text: qsTr("Test4")
                }
            }
    
            GridLayout {
                columns: 2
                Text {
                    text: qsTr("Test1:")
                }
                Text {
                    id: t2
                    font.bold: true
                    text: qsTr("⭐Test2")
                    font.pixelSize: t1.font.pixelSize * t1.height / dummy.height
                }
                Text {
                    text: qsTr("Test3:")
                }
                Text {
                    font.bold: true
                    text: qsTr("Test4")
                }
            }
        }
    }
    
    
    1. When using
    QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
    

    and application has to display emoji it will crash but not always on the same character.

    Screenshot when typing emoji
    0_1507900256469_android_emoji.png

    This bug is reported here and marked as solved but in Qt 5.9.2 the problem persists.

    On that page a user posted a workaround, and most of the time solves the problem, but I could not find a font to cover all emoji and it's still crashing.

    I need some solutions to bypass these problems.

    Thank you!



  • About first problem:

    Tested it on windows both qt msvc and qt mingw and working as expected.

    Tested it on android:

    When used QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling) did'nt break the layout but the "star" character was not displayed.

    When did not use hdpi scaling worked as expected.


Log in to reply
 

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