# HOWTO: Set up fonts for a KDE system

## Cloney

EDIT: Updated with Xfs being used to generate nice scale files, then consigned to the bin.

Right, this has taken me approximately ages to get perfect.

Firstly, if you use nVidia, you may get crazy distorted fonts. For some people this is only in GTK apps, for some people it effects KDE too. This can be easily fixed by editing your XF86Config and adding the following line to the "Monitors" section:

```
Option "NoDDC" "true"
```

Next, we need some more truetype fonts:

```
ACCEPT_KEYWORDS='~x86' emerge corefonts

emerge sharefonts freefonts
```

This installs the MS core TrueType fonts, along with the Gimp fontsets.

The next step is to set up XFS, the X Font Server. We're not going to actually use it, but it's a handy way of automating the generation of .scale files and other things required by X.

Edit /etc/X11/fs/config.  There's a section that catalogues all the various banks of fonts installed on your system. Add to the bottom of this list:

```
/usr/share/fonts/corefonts,

/usr/share/fonts/freefont
```

Now start up XFS. It'll catalogue the directories, then return control. Then stop it; it's work is done.

```
/etc/init.d/xfs start

/etc/init.d/xfs stop
```

Now we need to edit the fontpath settings in XF86Config so they include all the fontpaths that were in your XFS setup. Then save, and we should be ready to roll.

Fire X back up, and things should look very pretty indeed. Some KDE fonts that were previously reasonable sizes may now seem too small - fix this by changing the relevant settings (it was desktop and Konquerer settings for me). If you want anti-aliasing, turn it on in Kontrol Centre.

Getting to the end! Next step is to stop GTK2 apps looking awful. We'll need gtk-theme-switch for this.

```
emerge gtk-theme-switch

switch2
```

Now choose a GTK+ theme, then hit the plus to the right of the selection box. You can now specify a default font - for maximum consistency, I recommend Helvetica 12pt.

Next, edit /etc/fonts/local.conf, and add the following:

```
<dir>/usr/share/fonts</dir>
```

This makes all freetype apps aware of the corefonts. Thanks to crweb on #gentoo for this. This may make the next step unnecessary - YMMV.

The last step is to make OpenOffice aware of your newly installed Fonts. Fire up OpenOffice Printer Administration, then click the font button, then point it at the corefonts directory, hit select all, then hit add. oowriter etc should now be able to see the full set of MS fonts.

Your system should now look positively beautiful. It's so good to have Verdana back for IRC usage.

CloneyLast edited by Cloney on Thu Feb 05, 2004 5:18 pm; edited 2 times in total

----------

## maxilion

Tnx, great howto!

Sam

----------

## Jux

Perfect timing.

In the morning I intended to search a font-howto this evening -  here it is.

Great work, Jux

----------

## JuNix

Alright! That worked superbly, and 12 point fonts are really 12 point instead of being huge. Great how to, cheers!

----------

## leandro

Thank you very much!

Didn't know about the NoDDC option..  :Smile: 

----------

## MaGuS

Hi,

I added 

```
FontPath     "unix/:-1"
```

 to my X config and removed all other FontPath lines. No my x server won't come up. xfs is running.

Anybody knows why?

Best regards,

Magnus

----------

## Drewgrange

Thanks for the how-to, but I'm just curious about one thing. Does doing this through XFS have any advantage over just installing the fonts and adding the path to the xf86config file?

----------

## Drewgrange

Magus, does it give any errors? Check /var/log/XFree86.0.log Also could you post that top section of your xf86config file?

----------

## MaGuS

 *Drewgrange wrote:*   

> Magus, does it give any errors? Check /var/log/XFree86.0.log Also could you post that top section of your xf86config file?

 

No nothing, but I just removed all FonPath lines and all work great!

Magnus

----------

## Cloney

 *Drewgrange wrote:*   

> Thanks for the how-to, but I'm just curious about one thing. Does doing this through XFS have any advantage over just installing the fonts and adding the path to the xf86config file?

 

Actually, after some experimentation, I'm not sure it does. I've switched to a non-XFS system.

I'll update the FAQ soon with a bit about turning off anti-aliasing in XFT for fonts in the range 8-15 points.

Cloney

Enjoying KDE 3.2

----------

## Plasmaisme

Wow, thanks for the tips!  My fonts now look fantastic.  Before, all my fonts were basically always one-pixel thick, which while utilitarian, isn't all that fancy, and antialiasing seemed to have no effect.  Now, I'm using Times New Roman with antialiasing (for all font sizes), and it's FANTASTIC.  

Up until now, this was the only thing from my long-gone Mandrake days which I couldn't replicate in Gentoo, but now that I have this, my setup is complete (well, I could go for the old-style Mosfet Liquid theme, but it's not available for KDE 3.2).  So thanks again!

----------

## triad

Finally a Nice straight Forward Guide to Fonts! 

Thanks a million Cloney!

triad

----------

## Dolio

Hi.

I took your advice with the NoDCC (like you, I can't seem to tell a difference between XFS and no-XFS, so I'm just using regular font paths), and everything looks fine for the most part.

However, in Firebird and Thunderbird, all the fonts in the menubars and such are very tiny, and I can't seem to figure out how to change them. I thought they went according to the browser page fonts, but they don't seem to, and changing my GTK font doesn't seem to work either.

Does anyone know what setting (say in about:config) Mozilla et-al use for the menu drawing so I can fix this? Actual fonts in the web pages are fine.

Thanks in advance.

----------

## Dolio

Never mind. Found the answer.

In case anyone's interested, you need to edit your ~/.thunderbird/default/RANDOM_LETTERS.slt/chrome/

or .phoenix, as necessary to include the followng:

```
* {

    font-size: 12pt !important;

} 
```

Or whatever font size you want. That should work.

----------

## EugeneTSWong

Hi all. I looked in spadmin, & found that the fonts all end in ttf. Doesn't that mean that I don't need to install these other fonts?

Also, what happens when other people read my documents, & don't have the fonts installed? Doesn't it look really messy?

----------

## Cloney

 *Dolio wrote:*   

> I took your advice with the NoDCC (like you, I can't seem to tell a difference between XFS and no-XFS, so I'm just using regular font paths), and everything looks fine for the most part.

 

Well, to use the fontpaths you have to have the .scale files, etc, for each directory generated. I found what worked best was using XFS to automate the generation of these files, then killing it and just plugging the directories into XF86Config. Steal the good features from both   :Twisted Evil: 

As for Mozilla & co, it's been driving me mad. See https://forums.gentoo.org/viewtopic.php?t=129778&highlight= for some of my experiments.

What with Konqueror being so good in KDE 3.2, I've just switched over to Konq full time, with Firebird around for backup in case of incompatiblity. I've also switched to KMail, which seemed crap at first, but is secretly quite customizable (and minimises to the sys-tray. Go team KDE!)

Cloney

----------

## Ruedi1_99

Do I have to add the line

```
<dir>/usr/share/fonts</dir>
```

inside the </fontconfig> borders or outside?

Sometimes I get an error message about /etc/fonts/local.conf  :Embarassed: 

----------

## jerry arns

Great post. I got all the fonts I wanted. Thank you. It deserves to go in the Desktop configuration guide.

Now for the GTK theme integration.

I did as you said, I emerged gtk-theme-switch

Then I emerged gtk-engines-geramik

Then, as a normal user, I ran switch2 and was able to choose Geramik as a theme and the switch2 window switched to the theme.

So far, so good.

But none of the 2 applications I tried, MozillaFirebird and XMMS got the Geramik theme and they stay ugly.

I re-emerge xmms with +gtk2 but it made not good.

My USE flag is +kde +qt -gnome -gtk

Did I miss something ?

----------

## Cloney

 *jerry arns wrote:*   

> Now for the GTK theme integration.
> 
> I did as you said, I emerged gtk-theme-switch
> 
> Then I emerged gtk-engines-geramik
> ...

 

Ugly as in bad fonts? When you pick a theme in switch2, you'll see a big + sign to the right of the theme name. Click this, and you can specify a font for use in all GTK2 apps. Note that these settings are only for GTK2 stuff - to emerge the original GTK switcher, switch, type the following:

```
emerge =gtk-theme-switch-1.0.1-r1
```

However, this switcher doesn't seem very stable to me. Your mileage may vary.

I've never had a problem with XMMS fonts, but I believe there are a few threads somewhere on the forums regarding tiny fonts in XMMS and Mozilla which had some kind of resolution.

Mozilla's fonts are a mystery to me, as I've mentioned further up in this post. It seems to ignore almost everything, including it's own settings. I recommend KDE 3.2 - the new Konquerer is frankly a better browser than Moz.

Cloney

----------

## davekt

Hmm, all I had to do to get MS core truetype fonts working was to have the 'truetype' USE var set when emerging X.  When truetype is set, the Xfree ebuild installs the corefonts pkg (I've read that is why the corefonts ebuild is masked.)

Then I had to edit /etc/fonts/local.conf to add the truetype dir:

<dir>/usr/X11R6/lib/X11/fonts/truetype</dir>

Then running 'fc-cache -fv' picked up the new fonts.

I may be missing something but everything mentioned earlier in this thread seems to basically duplicate what's already done for you if you have 'truetype' set while emerging X.

----------

## jerry arns

Cloney : fonts are OK, but scroll bars, combo boxes, etc... do not follow the theme and stay gray.

----------

## Cloney

 *davekt wrote:*   

> Hmm, all I had to do to get MS core truetype fonts working was to have the 'truetype' USE var set when emerging X.

 

A bit of investigation shows that appears to be the case to get them installed, which I didn't realise. At any rate, they're not usable until they've had scale files generated and been plumbed into XF86Config, Xft and font.conf.

Ah well, it worked for everyone in this thread, so why gripe? The fonts documentation for Gentoo seems pretty awful in general. The NoDDC and switch2 bits are news to most, anyway.

Cloney

----------

## davekt

Sorry, didn't mean it as a gripe, was just puzzled about the other steps and wanted to get some feedback.  Some users were noting they couldn't get ttf fonts working even after using the 'truetype' in X (in other threads also).  I had the same problem but tracked it down to the truetype dir not being in the fonts.conf file.  Once I fixed that everything seemed to work, without doing anything else.  Running fc-cache also puts the fonts.scale files in the directories (I think that's right anyway).  At this point Gnome, KDE and Mozilla could all see these fonts.  Wasn't trying to say one way was better or anything, just what I did to get mine to work.

----------

## alexraasch

I am sorry, but I have not been lucky with this guide. After having finished it I can use all of the truetype fonts, but everything looks a lot uglier than before. I had compiled X with USE="truetype" and I was quite satisfied with the overall appearance. Now, after the guide the anti-aliasing and subpixel hinting does not look as good as before. The font sizes are messed and some letters are rendered quite bolder than others.

Further, I also included the directories in /etc/fonts/local.conf as suggested, then tried the NoDDC option on and off, but nothing helped out. Is there any way to savely undo the whole procedure?

I really appreciate any help on this. Thank you.

----------

## MattSharp

I have followed this instructions as they apply to me. I am trying to install a new TrueType font. I copied it to the appropriate directory but TrueType fonts don't seem to show up in like configure desktop? What am I missing?

EDIT: Do I need to have truetype in my USE variables? I realize taht I don't but TTFs work in OpenOffice?

----------

## davekt

All the 'truetype' USE var does is tell the ebuild to install the MS core ttf fonts, in /usr/X11R6/lib/X11/fonts/truetype.  You can install other ttf fonts into that (or any dir you make).  Then add the dir to the local.conf and do the 'fc-cache -fv' thing mentioned earlier. 

This is all I had to do, but others have obviously had success with the other steps.  It's crazy that some methods work for some and not others, it should be a simple and basic thing to get AA fonts working, it's just aggravating.

'truetype' is on by default in the global make settings, so unless the global settings have been changed, or there is a '-truetype' in your make.conf, it should have been used when building X.  You can run 'etcat -u xfree' I think to see what vars were set.  If you don't have etcat installed then 'emerge gentoolkit' should get it for you.

Check the /etc/fonts/local.conf file to see if the sub-pixel hinting section is uncommented and set to rgb or bgr, whichever you need.

If the X ebuild would also take care of adding the truetype font dir to /etc/fonts/local.conf (or fonts.conf) then I bet most people would have AA fonts working right after emerging X.  It would have for me anyway.

----------

## dopey

There is one issue with using NoDDC.  Basically, NoDDC tells the driver to ignore the values returned by the monitor (this tends to consist of screen size, and a number of other things).  The X server then uses these values to calculate the DPI.  Without these values (or with values that aren't sane) the server defaults to 75dpi.  On many monitors this ends up making the default font small.  Alot of fonts end up looking like crap at 75dpi.

Default DPI on windows is 96.  Gnome uses this as a default value as well.  Unfortunately, KDE doesn't appear to have any way to override the X server's DPI (I haven't found one), so to deal with 75dpi on KDE you want to pick fonts that actually scale well and use them.  Unfortunately, this does exclude many fonts, and it's not a good solution as the font choices don't carry over directly into gtk/gtk2 based apps.  The font setting with switch2 isn't perfect either.  It only affects certain fonts.   I found the best compromise in this situation is to force the X server to 100 dpi with -dpi 100 as an argument to the Xserver.  With modern monitors, 75dpi isn't as sane as 100 is.

I've been struggling with getting gtk apps to actually use decent fonts under KDE for the past 6 months or so, and -dpi 100 did more for font quality than anything else I tried.

----------

## milkypostman

The reason your themes don't show up when KDE + GTK apps is because you cannot run 2 X managers at the same time.  As an experiment boot up KDE and then try to load 'gnome-settings-daemon' what is controls themes and fonts to gtk apps.  If it is not running they all default to the normal which is what you'll see happening.  How in my .xinitrc i have added 

```
gnome-settings-daemon &
```

but then the only problem with this is that when you run KDE apps you don't get good fonts.  Although its tough for me to give up on GTK apps i've pretty much migrated all my use to KDE including konqueror and such.  It'd just be nice if these two worlds could just get along.

----------

## dopey

yup. like you said, the gnome-settings-daemon horks everything.  I found that out a while ago when I ran the gnome control-center under KDE and all of the sudden my KDE fonts went wonky.

It is a shame that the two can't use some sort of unified font configuration.  with anyluck, this will be one of the things addressed down the road.

for now, i use a local .gtkrc file to handle the fonts under gtk apps and its okay, not great, but okay.

----------

## Hackeron

Wrote a script to automate everything in this post, please test it and tell me if you want anything added/changed.

For latest version of script, visit:

https://forums.gentoo.org/viewtopic.php?t=143502Last edited by Hackeron on Mon Mar 01, 2004 5:05 pm; edited 1 time in total

----------

## mshmsh

Great stuff. I used a combination of this post and pluto's ideas in https://forums.gentoo.org/viewtopic.php?t=76503 to set up my fonts. It's all workign well in gnome (am still using xfs). 

The one problem that still remains is with apps like Acrobat Reader and xemacs ( guess the non GTK apps)  where the fonts  for the menubar items are HUGE.  Where is a good place to change the settings for that?

Shyam

----------

## Sinkster

 *Ruedi1_99 wrote:*   

> Do I have to add the line
> 
> ```
> <dir>/usr/share/fonts</dir>
> ```
> ...

 

I wondered the same thing even though it seemed that it should go inside <fontconfig>.

So I looked at the script the author made and confirmed that yes, it does go inside <fontconfig> since the script adds everything after the line '-->' in the file.

Btw, thanks for this awesome HOW TO! Helped a ton!   :Very Happy: 

----------

## binarynova

 *Quote:*   

> In case anyone's interested, you need to edit your ~/.thunderbird/default/RANDOM_LETTERS.slt/chrome/
> 
> or .phoenix, as necessary to include the followng:
> 
> Code:
> ...

 

Um.... so, in the chrome directory... what file do we need to edit?

EDIT: Also, I noticed a big problem when I use the, 'Option "NoDDC" "true"'.... after restarting X, my 3d acceleration went poof... bye bye. A quick look at, 'cat /var/log/XFree86.0.log.old | grep "(EE)" showed the following error: fglrx(0): Failed to initialize UMM driver.

Commented out the line, restared my comp (I assume to restart the font server or something, cuz restarting X wasn't enough), and low and behold, my 3d acceleration is back.

Just thought I'd give you guys a heads up on that.

I think I'll keep mine commented out until I can learn more about what that option does.

----------

## regnever

I followed the instructions and get some apps work.

But I got this problem:

```

$ gvim

** (gvim:22465): WARNING **: Cannot open font file for font Courier New 10

** (gvim:22465): WARNING **: Cannot open fallback font, nothing to do

```

```

$firefox

** (Gecko:22480): WARNING **: Cannot open font file for font Verdana 10

** (Gecko:22480): WARNING **: Cannot open fallback font, nothing to do

```

I am new to Gentoo and Linux, anyone has any idea about this?

Many thanks!

Tuan Anh

----------

## gcasillo

Well done, sir. Thank you for taking the time to share this nugget with us.

----------

