Using TTF and how to configure the fontconfig in Linux
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?
Silly question but do you have fontconfig installed on your system ?
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>
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.
@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.
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.
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.
Where are your includes installed ?
@SGaist I thought that I don't have the fontconfig library installed, but I just checked with the command:
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?
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.
@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)
Which version of Ubuntu are you running on that virtual machine ?
Ubuntu 14.04 LTS
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.
Installed libfontconfig-dev and all it's dependencies. Thanks for the help.