Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Text rendering problems
Forum Updated to NodeBB v4.3 + New Features

Text rendering problems

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 1 Posters 955 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jean jean
    wrote on last edited by A Former User
    #1
    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!

    1 Reply Last reply
    0
    • J Offline
      J Offline
      jean jean
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved