Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-52195

Using embedded font by FontLoader causes Loader to block UI Thread

    XMLWordPrintable

Details

    • macOS

    Description

      I used Loader to load some component asynchronously. It works great. But whenever I use FontLoader to load some embedded font, It brings asynchronously of Loader element and block UI thread a long time!
      If FontLoader uses same system wide installed font using the name property, it seems to the Loader element works as expected or perhaps it works so fast.
      This is my code:

      import QtQuick 2.6
      import QtQuick.Window 2.2
      import QtGraphicalEffects 1.0
      
      Window {
          id: win
          visible: true
          width: 300; height: 450
          color: "#d8d8d8"
      
          Loader {
              asynchronous: true
              active: true
              anchors.fill: parent
              sourceComponent: Component {
                  Item {
                      id: wrapper2
                      anchors.fill: parent
                      FontLoader {
                          id: yekan_persianFont
                          source: "qrc:/BYekan+.ttf"
                      }
                      DropShadow {
                          id: rectShadow;
                          anchors.fill: source
                          horizontalOffset: 0;
                          verticalOffset: 3;
                          radius: 12.0;
                          samples: 16;
                          color: "#80000000";
                          smooth: true;
                          source: wrapper;
                          anchors.topMargin: 1.2
                      }
                      Item {
                          id: wrapper
                          anchors.fill: parent
                          Rectangle {
                              anchors.fill: parent
                              anchors.margins: 20
                              Text {
                                  text: "Salam"
                                  font { family: yekan_persianFont.name; pointSize: 20 }
                                  anchors.centerIn: parent
                              }
                          }
                      }
                  }
              }
          }
      }
      
      

      Attachments

        1. BYekan+.ttf
          224 kB
        2. main.qml
          2 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            seyed_m S.M.Mousavi
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes