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

Font loading for QML input fields slows down app startup

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P2: Important P2: Important
    • None
    • 5.2.0, 5.3.0 Beta1
    • QPA
    • None
    • QML on iPad2 (iOS 6)
    • iOS/tvOS/watchOS

      I profiled this using a rather simple app and the Instruments tool.
      I used the "System/IO" and the "Time Profiler" instruments.

      More than 40 percent of time (for a not very complex QML app) is spent in:

      QCoreTextFontDatabase::populateFontDatabase() (taking ~870 msec)
      calling QCoreTextFontDatabase::populateFromDescriptor(__CTFontDescriptor const*)
      calling TCollection::CopyMatchingFontDescriptors(__CFDictionary const*) const

      and in:
      QCoreTextFontDatabase::fallbacksForFamily(QString const&, QFont::Style, QFont::StyleHint, QChar::Script) const

      Both of those functions are called at some point in initialization by QQuickTextEdit (I'm using TextEdit in QML).

      From the "System/IO" profile tool I can see that all fonts in /System/Library/Fonts are opened and examined.

      If I replace the TextEdit by TextInput it is still slow.
      If I replace the TextEdit by Rectangle it is faster (the populateFontDatabase() still seems to be called, but maybe much less).

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            vestbo Tor Arne Vestbø
            mgoetz2 Markus Goetz (Woboq GmbH)
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes