Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Using TTF and how to configure the fontconfig in Linux
QtWS25 Last Chance

Using TTF and how to configure the fontconfig in Linux

Scheduled Pinned Locked Moved Solved Mobile and Embedded
18 Posts 4 Posters 13.4k Views
  • 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.
  • D Offline
    D Offline
    dynam1te
    wrote on last edited by
    #1

    I had trouble using my custom .TTF font, so in the documentations I found this:

    Note: Adding application fonts on Unix/X11 platforms without fontconfig is currently not supported.
    

    I couldn't figure out how the fontconfig thing works.
    How do I create, edit, or configure such a fontconfig file, to work with my custom font?

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

      Hi,

      Silly question but do you have fontconfig installed on your system ?

      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
      0
      • D Offline
        D Offline
        dynam1te
        wrote on last edited by dynam1te
        #3

        I found a fontconfig folder (+ files inside) in $QT-4.7.2/config.tests/x11/fontconfig.
        I tried to create a Makefile, like the other tools that I've already installed, with qmake.
        But it somehow didn't work out correctly. I'm thinking that the fontconfig is in the wrong place?
        Is that possible? Where should it be originaly?

        This is the error:

        fatal error: ft2build.h: no such file or directory #include <ft2build.h>
        
        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          First thing: are you locked to that old and outdated version of Qt ? If not please upgrade to Qt 5 or if not possible then Qt 4.8.7 which is the latest and last version available for the Qt 4 series.

          I guess that you compiler Qt yourself ? If so, you should add the fontconfig dev packages to your system in order to build Qt with support for it.

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

          D 1 Reply Last reply
          1
          • SGaistS SGaist

            First thing: are you locked to that old and outdated version of Qt ? If not please upgrade to Qt 5 or if not possible then Qt 4.8.7 which is the latest and last version available for the Qt 4 series.

            I guess that you compiler Qt yourself ? If so, you should add the fontconfig dev packages to your system in order to build Qt with support for it.

            D Offline
            D Offline
            dynam1te
            wrote on last edited by
            #5

            @SGaist Yes I'm locked to 4.7.2, and I did not set it up myself.
            I got a VirtualMachine with Linux on it and Qt already Setup. That's why my Qt-knowledge is quite small, I startet working with it few weeks ago.

            I hope the fontconfig dev packages are already installed. If not, I can't do it myself, since I don't have an active Internet connection on my workstation.

            My main problem is, that when I try to run QFontDatabase::addApplicationFont(..) I get a -1 as return, although I use a valid .ttf file as parameter and I think the problem leads to fontconfig.

            ATM, this forum is pretty much everything I can rely on.

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

              Worst case, you can use a USB key to get the package from another station on to your virtual machine unless that something that is also locked.

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

              D 1 Reply Last reply
              0
              • SGaistS SGaist

                Worst case, you can use a USB key to get the package from another station on to your virtual machine unless that something that is also locked.

                D Offline
                D Offline
                dynam1te
                wrote on last edited by dynam1te
                #7

                Thanks for the reply @SGaist
                I managed to install freefont on my system, apparently it was not installed already. Now it shows me other errors, that it can't find the include files. Although I have the include files.

                I think either the includes are linked wrong, or I'm missing some installation progress.
                btw. I didn't manage to install the packeges you suggested.

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

                  Where are your includes installed ?

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

                  D 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    Where are your includes installed ?

                    D Offline
                    D Offline
                    dynam1te
                    wrote on last edited by dynam1te
                    #9

                    @SGaist I thought that I don't have the fontconfig library installed, but I just checked with the command:

                    /sbin/ldconfig -p
                    

                    And it turns out that I do have the library installed. This is what I find:

                    libfontconfig.so.1 (libc6,x86-64) => usr/lib/x86_64-linux-gnu/libfontconfig.so.1
                    libfontconfig.so.1 (libc6) => usr/lib/i1386-linux-gnu/libfontconfig.so.1
                    

                    I still couldn't install the fontconfig-dev packages.

                    The current error is:

                    fontconfig/fontconfig.h: No such file or directory
                     #include <fontconfig/fontconfig.h>
                    

                    What would you suggest to do next?

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

                      You won't have the headers if you don't have the dev package installed. Like I suggested before, you can grab the package for the repositories of the distribution running on your virtual machine and install it.

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

                      D 1 Reply Last reply
                      0
                      • SGaistS SGaist

                        You won't have the headers if you don't have the dev package installed. Like I suggested before, you can grab the package for the repositories of the distribution running on your virtual machine and install it.

                        D Offline
                        D Offline
                        dynam1te
                        wrote on last edited by
                        #11

                        @SGaist Yeah, I'm trying to get it installed, I get alot of errors though.
                        When I run the downloaded .deb (http://packages.ubuntu.com/trusty/libfontconfig1-dev).
                        I can't install it via the Software Center.
                        And when I run the dpkg command, it won't install. (Errors encountered)

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

                          Which version of Ubuntu are you running on that virtual machine ?

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

                          D 2 Replies Last reply
                          0
                          • SGaistS SGaist

                            Which version of Ubuntu are you running on that virtual machine ?

                            D Offline
                            D Offline
                            dynam1te
                            wrote on last edited by
                            #13

                            @SGaist
                            Ubuntu 14.04 LTS
                            64-bit

                            1 Reply Last reply
                            0
                            • SGaistS SGaist

                              Which version of Ubuntu are you running on that virtual machine ?

                              D Offline
                              D Offline
                              dynam1te
                              wrote on last edited by dynam1te
                              #14

                              @SGaist I installed fontconfig-config, because it looks like it's a dependency from libfontconfig1 (http://packages.ubuntu.com/trusty/libfontconfig1)

                              I'm not sure if it's because of that, but I managed to get a bit further with the make process.
                              The only errors are variables that are not used.

                              I get a fontconfig file. not sure how I run or use it though.

                              1 Reply Last reply
                              0
                              • D Offline
                                D Offline
                                dynam1te
                                wrote on last edited by
                                #15

                                Final update

                                Installed libfontconfig-dev and all it's dependencies. Thanks for the help.

                                1 Reply Last reply
                                0
                                • LostDeveloperL Offline
                                  LostDeveloperL Offline
                                  LostDeveloper
                                  wrote on last edited by
                                  #16
                                  This post is deleted!
                                  raven-worxR 1 Reply Last reply
                                  0
                                  • LostDeveloperL LostDeveloper

                                    This post is deleted!

                                    raven-worxR Offline
                                    raven-worxR Offline
                                    raven-worx
                                    Moderators
                                    wrote on last edited by
                                    #17

                                    @LostDeveloper
                                    no need to double post,
                                    even not on a 3 year old thread

                                    --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                                    If you have a question please use the forum so others can benefit from the solution in the future

                                    1 Reply Last reply
                                    2
                                    • LostDeveloperL Offline
                                      LostDeveloperL Offline
                                      LostDeveloper
                                      wrote on last edited by
                                      #18
                                      This post is deleted!
                                      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