PDA

View Full Version : Need Help to add new Font to QT



giriprasad
27th August 2009, 13:35
Hi All,

I am newbie to QT Embedded. I am using qt-embedded-linux-opensource-src-4.5.2.
I want to add new font to the directory ~/qt-embedded-linux-opensource-src-4.5.2/lib/fonts so that I can reuse the font in all my applications. I have a custom_font.ttf file.
I have copied that file to the above mentioned directory, but I am unable to use that font. Please tell me how to use this font.

One more thing, can someone please tell me the procedure to convert a ttf or bdf file to qpf in Qt-Embedded-4.5.2 using the makeqpf tool. I have given the command like this
makeqpf Giri 18
***Giri is the Font name and 18 is the pixel size.
A qpf2 file with filename Giri_180_50.qpf2 will be generated in /binafter the above command is executed.

Can someone tell me how to use the above .qpf2 file after it is generated.

One more thing, there is no FontDir file under /lib/fonts folder in Qt-embedded-linux-opensource-src-4.5.2.

Regards,
Giri

nezticle
31st August 2009, 14:01
If you want to add new fonts they need to be in the lib/fonts folder of your Prefix, so unless your prefix is your source directory then what you are doing currently is not going to work. Also you can set your QT_QWS_FONTDIR environmental variable to to the location your fonts are at.

To use makeqpf, you need to build it with your X11 version of Qt. its in the tools directory of the X11 qt source and it will provide a GUI for converting fonts to qpf's.

Then place those .qpf files in the directory pointed to by your QT_QWS_FONTDIR env variable.

giriprasad
1st September 2009, 09:25
Hi Nezticle,

Thanks for your useful information..I have followed your procedure and successfully integrated the fonts.

Regards,
giri prasad

Krzysztow
26th February 2010, 00:55
Hello,

I have a question connected to the topic. I want to compile qpf font from ttf one. Is it possible to do it without embedded version of qt? I'm on linux ubuntu karmic and could find makeqpf program in repositories. Having a folder lib/fonts, with fonts there and fontdir file, I can see that these fonts are seen by makeqpf - when I simply call makeqpf, the gui window opens and lists fonts. However calling makeqpf -A (all fonts to be qpf-ed), nothing happens.

Please, I'm in great need to know that. Thank You for a response. Bye.

drawat
15th September 2010, 07:18
Hello,

My issues is not completely related to the topic but somewhat related.

I am on linux and successfully added fonts using addApplicationFonts().
I am invoking assistant from qt application(qt 4.5.3) but assistant is not using the same fonts which I set for my application. How do I force assistant to use the same fonts which I setfor my application?

Thanks