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

QQuickWindow::QtTextRendering cause font problem on Apple M1

    XMLWordPrintable

Details

    • macOS
    • aeeaa7d253239b4b45e419bcad5cfde5c5714080 (qt/qtbase/dev) c310dcce5706c284d19eb6221b231cc85c435236 (qt/qtbase/6.2) c900eaf599f22be915830ce5a545190c858da429 (qt/tqtc-qtbase/5.15) 4034daa12ebeea3ac6afe896e914853ecbd981f3 (qt/qtbase/5.12)

    Description

      Hello it's seems that our Qt Application on apple M1 have fonts problem:

      Changing font to another one, or use the system default one seems to not change anything

      Any idea / hints ?

      Project URL: https://github.com/KomodoPlatform/atomicDEX-Desktop

      Binaries available here: https://github.com/KomodoPlatform/atomicDEX-Desktop/actions/runs/413092638

      Fonts is set here: https://github.com/KomodoPlatform/atomicDEX-Desktop/blob/font-fix-m1/atomic_defi_design/qml/Constants/Style.qml#L27

      PS: We use high dpi:

       

      
      QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
       QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
       

      Info.plist:

       <?xml version="1.0" encoding="UTF-8"?>
       <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
       <plist version="1.0">
       <dict>
       <key>CFBundleDevelopmentRegion</key>
       <string>English</string>
       <key>CFBundleExecutable</key>
       <string>atomicdex-desktop</string>
       <key>CFBundleGetInfoString</key>
       <string></string>
       <key>CFBundleIconFile</key>
       <string>atomicdex-desktop</string>
       <key>CFBundleIdentifier</key>
       <string></string>
       <key>CFBundleInfoDictionaryVersion</key>
       <string>6.0</string>
       <key>CFBundleLongVersionString</key>
       <string>0.0.1</string>
       <key>CFBundleName</key>
       <string>atomicdex-desktop</string>
       <key>CFBundlePackageType</key>
       <string>APPL</string>
       <key>CFBundleShortVersionString</key>
       <string>0.0.1</string>
       <key>CFBundleSignature</key>
       <string>????</string>
       <key>CFBundleVersion</key>
       <string></string>
       <key>CSResourcesFileMapped</key>
       <true/>
       <key>LSRequiresCarbon</key>
       <true/>
       <key>NSHumanReadableCopyright</key>
       <string></string>
       <key>NSPrincipalClass</key>
       <string>NSApplication</string>
       <key>NSHighResolutionCapable</key>
       <true/>
       </dict>
       </plist>
      

      EDIT 1:

      It's seems that the problem come from `QQuickWindow::QtTextRendering`

      Using:

      auto is_apple_translated = []() {
              int    ret  = 0;
              size_t size = sizeof(ret);
              if (sysctlbyname("sysctl.proc_translated", &ret, &size, NULL, 0) == -1)
              {
                  if (errno == ENOENT)
                      return 0;
                  return -1;
              }
              return ret;
          };
          if (is_apple_translated() == 1)
          {
              SPDLOG_INFO("You are on apple M1 chipset running an Intel application, forcing NativeTextRendering");
              QQuickWindow::setTextRenderType(QQuickWindow::TextRenderType::NativeTextRendering);
          }
      

      Seems to solve the problem but `QQuickWindow::QtTextRendering` is not usable on last macbook M1 translated code

      Attachments

        Issue Links

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

          Activity

            People

              vestbo Tor Arne Vestbø
              milerius milerius
              Votes:
              6 Vote for this issue
              Watchers:
              15 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews