WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Font Type in QT Application  (Read 2570 times)

Offline nim108

  • Full Member
  • ***
  • Posts: 107
Font Type in QT Application
« on: September 16, 2015, 01:03:01 PM »
I am running the latest TC (6.4 at the time of this posting) with an entire build environment underneath (compiletc, -dev packages of all libs, etc.). I used this guide (http://www.m-opensolutions.com/?p=600) to build Qt 5.4.2 and it built flawlessly. My question is about fonts. My test application written under Qt displays with a very weird font that does not match what I see under Linux Mint or Windows. How/where can I get a more traditional style font and customize it to work as the default? What am I missing? Where are the configs, if any, that I need to modify? Do I just grab Xorg-fonts.tcz and dejavu-fonts-ttf.tcz, load those, and expect it to just work?

Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14818
Re: Font Type in QT Application
« Reply #1 on: September 16, 2015, 01:19:34 PM »
what happens when you try that?

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: Font Type in QT Application
« Reply #2 on: September 16, 2015, 01:23:19 PM »
Yeah, any fonts should just work, though many find Xorg fonts and Dejavu ones ugly - liberation or microsoft ones are common.
The only barriers that can stop you are the ones you create yourself.

Offline nim108

  • Full Member
  • ***
  • Posts: 107
Re: Font Type in QT Application
« Reply #3 on: September 16, 2015, 01:28:52 PM »
Thanks, let me test with the liberation-fonts-ttf.tcz extension ... I assumed it was a Qt problem and not TC or X but from what it sounds like, the application should just use whatever font is available before falling back to some default one, which is what it seems to be doing now.

Offline nim108

  • Full Member
  • ***
  • Posts: 107
Re: Font Type in QT Application
« Reply #4 on: September 16, 2015, 02:15:58 PM »
Loaded ttf-bitstream-vera.tcz and liberation-fonts-ttf.tcz and it seemed to have changed the font in my application so I guess it works. I'm just not sure how to tell what it's using or force it to use a certain family of fonts if I have multiple sets installed for testing. Any ideas?
« Last Edit: September 16, 2015, 02:28:25 PM by nim108 »

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: Font Type in QT Application
« Reply #5 on: September 17, 2015, 04:46:39 AM »
The app requests a font or a family, "Arial" "Sans serif". Then fontconfig maps that to an installed font according to your preferences, see /etc/fonts (can be made per-user in ~/.fonts.conf).

So in short, you need the app's source code to see what font it requests first.
The only barriers that can stop you are the ones you create yourself.

Offline nim108

  • Full Member
  • ***
  • Posts: 107
Re: Font Type in QT Application
« Reply #6 on: September 18, 2015, 08:39:26 AM »
Thanks curaga, I will find out more what my Qt app is doing/requesting.