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

[NSFont fontWithName:size] fails when called in a non-bundle application

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.9.0 Beta 2
    • 5.8.0 Alpha
    • WebEngine
    • None
    • macOS 10.11.5, XCode 7.3.1
    • ceff67e0bab4d34c5b791d1f1b1d43c7a4e44d84

    Description

      During execution of the qwebenginepage renderWidgetHostViewNotShowTopLevel test, the following error messages can be seen on macOS when the wikipedia frontpage is loaded:

      [26700:34119:1128/143504:ERROR:font_loader.mm(64)] Failed to load font NotoSansSyriacEastern
      [26701:1295:1128/143504:ERROR:renderer_blink_platform_impl.cc(575)] Bad response from RenderProcessHostMsg_LoadFont() for NotoSansSyriacEastern
      [26701:1295:1128/143504:ERROR:FontPlatformDataMac.mm(92)] Loading user font ".LastResort" from non system location failed. Corrupt or missing font file?
      [26701:1295:1128/143504:ERROR:FontDataCache.cpp(56)] Empty typeface() in FontPlatformData when accessing FontDataCache.
      [26700:34119:1128/143505:ERROR:font_loader.mm(64)] Failed to load font NotoSansGlagolitic
      [26701:1295:1128/143505:ERROR:renderer_blink_platform_impl.cc(575)] Bad response from RenderProcessHostMsg_LoadFont() for NotoSansGlagolitic
      [26701:1295:1128/143505:ERROR:FontPlatformDataMac.mm(92)] Loading user font ".LastResort" from non system location failed. Corrupt or missing font file?
      [26701:1295:1128/143505:ERROR:FontDataCache.cpp(56)] Empty typeface() in FontPlatformData when accessing FontDataCache.
      

      After a lengthy discovery process, this happens because the test application is a regular executable not packed into a macOS bundle (e.g. testName.app).

      The offending line in the Chromium source directory is in

      src/3rdparty/chromium/content/common/mac/font_descriptor.mm:23

      inside the FontDescriptor::ToNSFont() method.

      Specifically [NSFont fontWithName:size] is called to load the "NotoSansSyriacEastern" font, but the return value is nil.

      If the same call is done from a bundled app, the return value is a correct NSFont object.
      The font in question resides in a semi-standard location in

      /Library/Application\ Support/Apple/Fonts/Language\ Support/NotoSansSyriacEastern-Regular.ttf
      

      and for some mysterious reason the loadFont method considers that location only if the application is executed from inside a bundle.

      The aforementioned font is considered as a fallback font by Chromium, and is chosen by Blink in

      src/3rdparty/chromium/third_party/WebKit/Source/platform/fonts/mac/FontCacheMac.mm:128

      It uses the private API call

      [NSFont findFontLike:forCharacter:inLanguage] 

      which appears to take into account the semi-standard folder.

      Attachments

        For Gerrit Dashboard: QTBUG-57354
        # Subject Branch Project Status CR V

        Activity

          People

            alexandru.croitor Alexandru Croitor
            alexandru.croitor Alexandru Croitor
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes