Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [MacOs] cocoa = fontengine = freetype doesn't work
Forum Updated to NodeBB v4.3 + New Features

[MacOs] cocoa = fontengine = freetype doesn't work

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 308 Views 2 Watching
  • 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.
  • SeeLookS Offline
    SeeLookS Offline
    SeeLook
    wrote on last edited by SeeLook
    #1

    Hi.
    I have following content of qt.conf in Resources of an app bundle:

    [Platforms]
    cocoa = fontengine=freetype
    
    [Paths]
    Plugins = PlugIns
    Imports = Resources/qml
    Qml2Imports = Resources/qml
    
    

    and file is loaded during app launch - when removed, app doesn't run.

    Unfortunately freetype is not used that way and app strongly depends on it.

    Surprisingly, when app is launched with -platform param:

    $myapp -platform cocoa:fontengine=freetype
    

    Freetype is used then.

    Although, I found dirty solution, by hardcoding that parameter (in main.cpp):

    #if defined (Q_OS_MAC)
        int new_argc = argc + 2;
        std::vector<std::unique_ptr<char>> new_argv_aux(new_argc);
        for (int ii = 0; ii < argc; ++ii) {
          new_argv_aux[ii].reset(new char[strlen(argv[ii]) + 1]);
          strcpy(new_argv_aux[ii].get(), argv[ii]);
        }
        new_argv_aux[argc].reset(new char[strlen("-platform") + 1]);
        strcpy(new_argv_aux[argc].get(), "-platform");
        new_argv_aux[argc + 1].reset(new char[strlen("cocoa:fontengine=freetype") + 1]);
        strcpy(new_argv_aux[argc + 1].get(), "cocoa:fontengine=freetype");
    
        std::vector<char*> new_argv(new_argv_aux.size());
        for (size_t ii = 0; ii < new_argv_aux.size(); ++ii)
          new_argv[ii] = new_argv_aux[ii].get();
    
        a = new QApplication(new_argc, new_argv.data());
    #else
        a = new QApplication(argc, argv);
    #endif
    

    which works, but maybe there is something easier and cleaner.
    Have you heard about better solution?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by SGaist
      #2

      Hi,

      I haven't tested it but based on the documentation, I think it should be something like:

      [Platform]
      CocoaArguments = fontengine=freetype
      

      If not Cocoa, maybe macOS.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • SeeLookS Offline
        SeeLookS Offline
        SeeLook
        wrote on last edited by
        #3

        @SGaist Thank You a milion.

        [Platform]
        CocoaArguments = fontengine=freetype
        

        is the correct incantation

        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