Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    How to register fonts in Mac OS

    General and Desktop
    2
    11
    3582
    Loading More Posts
    • 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.
    • SGaist
      SGaist Lifetime Qt Champion last edited by

      For Qt you can use QFontDatabase, but if you register the font with the system you won't need it.

      A quick google search returns "this":http://www.guidingtech.com/6437/how-to-install-new-fonts-in-mac-os-x/ for font installation

      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 Reply Quote 0
      • P
        phamvanan last edited by

        Hi, I try to use QFontDatabase:
        @#include <QtGui/QApplication>
        #include <QFontDatabase>
        #include <QDebug>
        #include "mainwindow.h"

        int main(int argc, char *argv[])
        {
        QApplication a(argc, argv);
        int kq = QFontDatabase::addApplicationFont("C:/src/Hawaii_Killer.ttf");
        qDebug()<<"result: "<<kq;
        MainWindow w;
        w.show();

        return a.exec&#40;&#41;;
        

        }
        @
        outputs is result: 0
        But i check fonts folder system not found.
        I try to test on Window OS.
        Thanks,
        An.

        -PVA-

        1 Reply Last reply Reply Quote 0
        • SGaist
          SGaist Lifetime Qt Champion last edited by

          Windows and OS X font management are not the same.

          Why would 0 be a wrong value ? From the doc addApplicationFont returns -1 if the font could not be loaded.

          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 Reply Quote 0
          • P
            phamvanan last edited by

            I want add a new font to window system.
            I try to use QFontDatabase but it's not add. I open control panel and check fonts folder. it's not visible.
            Please tell me reason and resolve.
            Thanks.
            An.

            -PVA-

            1 Reply Last reply Reply Quote 0
            • SGaist
              SGaist Lifetime Qt Champion last edited by

              Then use the tools provided by your OS, Qt won't install system fonts for you.

              Search for "install font windows" for example. This will get you the Microsoft guide to do it.

              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 Reply Quote 0
              • P
                phamvanan last edited by

                Not install new fonts when using Qt for Window and Mac OS, is it right?
                Thank you very much.
                An.

                -PVA-

                1 Reply Last reply Reply Quote 0
                • SGaist
                  SGaist Lifetime Qt Champion last edited by

                  I don't understand your last question.

                  With Qt you can use a custom font within your app loaded for it or any of the font already installed. BUT you cannot install new fonts in the system with it out of the box.

                  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 Reply Quote 0
                  • P
                    phamvanan last edited by

                    Hi,
                    My app is copy fonts files to window and mac system using Qt framework.
                    I don't know. Can Qt support to do it? If capacity how to do that?
                    An.

                    -PVA-

                    1 Reply Last reply Reply Quote 0
                    • SGaist
                      SGaist Lifetime Qt Champion last edited by

                      You have to use system specific solutions to do that

                      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 Reply Quote 0
                      • P
                        phamvanan last edited by

                        Thank you for your answer,
                        As me know, Qt support building a plugin for platforms.
                        I hope Qt add new feature install font in next version.
                        An.

                        -PVA-

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post