# [Mini-HOWTO] X.org & font

## solka

Mini-HOWTO X.org & font

Author: solka (solkanar[at]ngi[dot]it)

Version: 1.1

Update 1.1 of 18-06-2004: added Firefox 0.9 and some informations about its installation.

Most updated version: http://gentoo-wiki.com/HOWTO_Xorg_and_Fonts

Summary

Why

emerging the necessary packages

Modify config files

Services restart

Mozilla Firefox 0.8 e 0.9

Useful topics

Thanks

1. Why

After changing the x server from Xfree to X.org many people (as me) had many problems

about the font rendering and the antialiasing. This mini-HOWTO has the purpose to give

a possible solution to the problem.

2. emerging the necessary packages

Supposing x.org installed correctly, you have to emerge the font packages, some of them

are already installed, but I advise to install them again.

These are the necessary packages:

media-libs/freetype

media-fonts/corefonts

media-fonts/freefonts

However I advise to install these fonts too:

media-fonts/artwiz-fonts

media-fonts/sharefonts

media-fonts/terminus-font

media-fonts/ttf-bitstream-vera

media-fonts/unifont

Emerge them:

```

emerge freetype corefonts freefonts artwiz-fonts sharefonts 

\ terminus-font ttf-bitstream-vera unifont

```

3. Modify config files

When fonts are installed, you have to modify the config files in order to make the system

recognize them. These are the files you have to modify:

/etc/fonts/local.conf

/etc/X11/xorg.conf

~/.fonts.conf

/etc/fonts/local.conf

In /etc/fonts/local.conf are set the font directories which are in the directory 

/usr/share/fonts with x.org, so the file should be as the following listed but I advise 

to check yours:

```

<?xml version="1.0"?>

<!DOCTYPE fontconfig SYSTEM "fonts.dtd">

<!-- /etc/fonts/local.conf file for local customizations -->

<fontconfig>

<!--    

        <match target="font">

                <edit name="rgba" mode="assign"><const>rgb</const></edit>

        </match>

-->

        <dir>/usr/share/fonts/corefonts/</dir>

        <dir>/usr/share/fonts/terminus/</dir>

        <dir>/usr/share/fonts/unifont/</dir>

        <dir>/usr/share/fonts/Type1/</dir>

        <dir>/usr/share/fonts/freefont/</dir>

        <dir>/usr/share/fonts/artwiz/</dir>

        <dir>/usr/share/fonts/local/</dir>

        <dir>/usr/share/fonts/misc/</dir>

        <dir>/usr/share/fonts/Speedo/</dir>

        <dir>/usr/share/fonts/CID/</dir>

        <dir>/usr/share/fonts/ttf-bitstream-vera/</dir>

        <dir>/usr/share/fonts/util/</dir>

        <dir>/usr/share/fonts/sharefont/</dir>

        <dir>/usr/share/fonts/lfp-fix/</dir>

        <dir>/usr/share/fonts/TTF/</dir>

        <dir>/usr/share/fonts/75dpi/</dir>

        <dir>/usr/share/fonts/100dpi/</dir>

</fontconfig>

```

/etc/X11/xorg.conf

As the previous file you have to list your font directories in /etc/X11/xorg.conf:

```

< cut >

    FontPath   "/usr/share/fonts/ttf-bitstream-vera/"

    FontPath   "/usr/share/fonts/terminus/"

    FontPath   "/usr/share/fonts/corefonts/"    

    FontPath   "/usr/share/fonts/Type1/"

    FontPath   "/usr/share/fonts/freefont/"

    FontPath   "/usr/share/fonts/artwiz/"

    FontPath   "/usr/share/fonts/local/"

    FontPath   "/usr/share/fonts/misc/"

    FontPath   "/usr/share/fonts/75dpi/:unscaled"

    FontPath   "/usr/share/fonts/100dpi/:unscaled"

    FontPath   "/usr/share/fonts/Speedo/"

    FontPath   "/usr/share/fonts/CID/"

    FontPath   "/usr/share/fonts/encodings/"

    FontPath   "/usr/share/fonts/TTF/"

    FontPath   "/usr/share/fonts/util/"

    FontPath   "/usr/share/fonts/sharefont/"

    FontPath   "/usr/share/fonts/lfp-fix/"

    FontPath   "/usr/share/fonts/75dpi/"

    FontPath   "/usr/share/fonts/100dpi/"

    FontPath   "/usr/share/fonts/unifont/"

< cut >

```

In the same file, please pay attention to the line where the freetype module is loaded, it should be uncommented:

```

Load "freetype"

```

~/.fonts.conf

The config file ~/.fonts.conf is the own one for each user, it should be as the following:

```

<?xml version="1.0"?>

<!DOCTYPE fontconfig SYSTEM "fonts.dtd">

<!-- /etc/fonts.conf file to configure system font access -->

<fontconfig>

<!--  Enable sub-pixel rendering 

        <match target="font">

                <test qual="all" name="rgba">

                        <const>unknown</const>

                </test>

                <edit name="rgba" mode="assign"><const>rgb</const></edit>

        </match>

 

 -->

 

<!-- Autohint fonts

        <match target="font">

                <edit name="autohint" mode="assign"><bool>true</bool> </edit>

        </match>

-->

 

<!-- Use Bitstream Vera fonts by default -->

        <alias>

                <family>serif</family>

                <prefer>

                        <family>Bitstream Vera Serif</family>

                </prefer>

        </alias>

        <alias>

                <family>sans-serif</family>

                <prefer>

                        <family>Bitstream Vera Sans</family>

                </prefer>

        </alias>

        <alias>

                <family>monospace</family>

                <prefer>

                        <family>Bitstream Vera Sans Mono</family>

                </prefer>

        </alias>

<!-- Antialias -->

<match target="font">

        <test qual="any" name="size" compare="more">

                <double>8</double>

        </test>

        <test qual="any" name="size" compare="less">

                <double>15</double>

        </test>

        <edit name="antialias" mode="assign">

                <bool>true</bool>

        </edit>

</match>

</fontconfig>

```

The first option, which is commented with Enable sub-pixel rendering, is useful for those who have a LCD monitor.

However I advise to check by yourself the different configurations with sub-pixel rendering and font autohinting 

(second option). The third option tells the system to use instead of the common serif, sans-serif and monospace fonts

the better Bitstreams.

The last option activates the antialiasing and it's quite explicative.

4. Services restart

After modifying config files, you have to restart xfs and x.org (if you use a graphical greeter

as GDM, KDM, XDM, etc. restaring x.org is possible by restarting the xdm service).

```

# /etc/init.d/xfs stop

# /etc/init.d/xdm stop

# /etc/init.d/xfs start

# /etc/init.d/xdm start

```

Then your own graphical greeter should start and entering your system you should have antialiased fonts.

5a. Mozilla Firefox 0.8

In order to have antialiased fonts with Mozilla Firefox 0.8 you have to modify another config file, that is 

unix.js present in /usr/lib/MozillaFirefox/defaults/pref/ (if this path isn't yours, try running 

locate unix.js).

You have to modify the lines under the // TrueType comment:

```

// TrueType

pref("font.FreeType2.enable", true);

pref("font.freetype2.shared-library", "libfreetype.so.6");

// if libfreetype was built without hinting compiled in

// it is best to leave hinting off

pref("font.FreeType2.autohinted", true);

pref("font.FreeType2.unhinted", true);

// below a certian pixel size anti-aliased fonts produce poor results

pref("font.antialias.min",        0);

pref("font.embedded_bitmaps.max", 1000000);

pref("font.scale.tt_bitmap.dark_text.min", 0);

pref("font.scale.tt_bitmap.dark_text.gain", "0.0");

// sample prefs for TrueType font dirs

pref("font.directory.truetype.1", "/usr/share/fonts/ttf-bitstream-vera");

pref("font.directory.truetype.2", "/usr/share/fonts/TTF");

pref("font.directory.truetype.3", "/usr/share/fonts/corefonts");

pref("font.directory.truetype.4", "/usr/share/fonts/freetype");

pref("font.FreeType2.printing", true);

```

Modify your file as the one listed.

The lines where are indicated the font directories are essential, by following

this HOWTO the previous ones are correct.

Then, in Firefox, go to

Tools --> Options --> General --> Fonts & Colors

and set these parameters:

```

Proportional: Serif (Size: 16)

Serif: Bits-bitstream vera serif

Sans-serif: Bits-bitstream vera sans

Monospace: Bits-bitstream vera sans mono (Size: 12)

Minimum font size: 9

```

You should also check that the following boxes aren't ticked: Always use my: Fonts / Colors

Then restart Firefox and browse www.gentoo.org with antialiased fonts!

5b. Mozilla Firefox 0.9

Before installing Firefox 0.9 I advise to remove, if installed, the old Mozilla Firefox for a correct usage and

then copy bookmarks.html, key3.db and signons.txt files present in the user directory (for Firefox 0.8 they are in

~/.phoenix/default.xxx/) and remove these directories and these files:

/usr/lib/MozillaFirefox

/usr/bin/firefox

~/.phoenix

After the installation copy again the previous three files in ~/.mozilla/firefox/default.xxx/ .

In order to activate antialiased fonts in Firefox 0.9 I had to compile it with the USE flag "moznoxft".

So before proceeding with the emerging you should check that the flags moznoxft and truetype are set.

```

(note: at this time mozilla-firefox-0.9_rc1 is keyword masked)

USE="moznoxft truetype" ACCEPT_KEYWORDS=~x86 emerge mozilla-firefox

```

After compiling the emerging you should start once Firefox as normal user in order to create personal files in ~. After that,

you have to create the user.js file in ~/.mozilla/firefox/default.xxx/, where xxx are letters or numbers.

In the user.js file you have to insert these lines:

```

// TrueType

user_pref ("font.FreeType2.enable", true);

user_pref ("font.freetype2.shared-library", "libfreetype.so.6");

// if libfreetype was built without hinting compiled in

// it is best to leave hinting off

user_pref ("font.FreeType2.autohinted", true);

user_pref ("font.FreeType2.unhinted", true);

// below a certian pixel size anti-aliased fonts produce poor results

user_pref ("font.antialias.min",        0);

user_pref ("font.embedded_bitmaps.max", 1000000);

user_pref ("font.scale.tt_bitmap.dark_text.min", 0);

user_pref ("font.scale.tt_bitmap.dark_text.gain", "0.0");

// sample user_pref s for TrueType font dirs

user_pref ("font.directory.truetype.1", "/usr/share/fonts/ttf-bitstream-vera");

user_pref ("font.directory.truetype.2", "/usr/share/fonts/TTF");

user_pref ("font.directory.truetype.3", "/usr/share/fonts/corefonts");

user_pref ("font.directory.truetype.4", "/usr/share/fonts/freetype");

user_pref ("font.FreeType2.printing", true); 

```

If you have followed this HOWTO you shouldn't have problem with the listed directories, otherwise you can change them.

Then run Firefox and go to

Tools --> Options --> General --> Fonts & Colors

and set these parameters:

```

Proportional: Serif (Size: 16)

Serif: Bits-bitstream vera serif

Sans-serif: Bits-bitstream vera sans

Monospace: Bits-bitstream vera sans mono (Size: 12)

Minimum font size: 9

```

Also check that the following boxes aren't ticked: Always use my: Fonts / Colors

Then restart Firefox and browse www.gentoo.org with antialiased fonts!

6. Useful topics

These are the topics from which I took informations in order to write this HOWTO:

How to enable AA in Fluxbox,GKrellM,Abiword,Phoenix etc...

X.Org & Fonts

[xfree] caratteri sfocati

Moz Firefox 0.9 (all versions) general discussion thread.

7. Thanks

I want to thank the Gentoo Italian Community and the Gentoo Community, which make Gentoo so powerful and incredible.

A special thank to BlueRaven for his explanation about fonts in [xfree] caratteri sfocati and to FonderiaDigitale who led me to the final solution for my problem.

----------

## RinkyDinks_RJ

In #2, you have media-fonts/freefonts listen twice.

Also, for xfs, there is a config file located at /etc/X11/fs/config

You should also add any new fonts-directories to that file too--as xfs uses it to do whatever it does to the font directories. [Forgot the term(s)].

----------

## solka

Thanks for the note.

I think that the config file /etc/X11/fs/config is checked only if  there is the FontPath "unix:-1" in xorg.conf so adding font directories in the former file is irrelevant...

----------

## knopper

But it's also not needed to start xfs or am I wrong?

----------

## solka

Mmh...you are right. However I tried commenting all font lines in /etc/X11/fs/config, restarting xfs and x.org and it worked the same...well, I'll add the configuration of xfs config file just to make this howto more complete  :Smile: 

Thank you all.

----------

## knopper

The howto works like a charm, though there's one thing I encountered.

The fonts weren't anti-aliased in Firefox until I did "fc-cache -fv" as root. This builds some indexes and more stuff for freetype fonts which are used by Firefox as explained by this howto. 

Maybe it's something to put in the howto?

Anyway, great howto! (ahum, "mini" howto...)

----------

## Sastraxi

I'm pretty sure the /etc/init.d/xfs restart command will do that caching for you, though I'm not exceptionally sure.

----------

## Master One

Nice try to gather all the fonts info spread over many topics in this forum.

You may want to adjust the order of your fonts in xorg.conf, because the first match is used, so it makes sense to have all TTF on top of the list.

As there seem to be no need for XFT at all, you may want to skip any explaination about /etc/X11/fs/config, remove xfs from the default runlevel, and stop xfs once and for all, it likely only eats resources.

I also did a lot of reading about X & fonts, tried a lot of things, and it looks pretty nice now, also there seem to be still some issues, especially as I do not know much about the various fonts themselves. I should have an old Corel Draw CDset here somewhere, with a whole bunch of nice TTF, I think I should try do find and extract the fonts to my Gentoo workstation   :Wink: 

----------

## knopper

 *Sastraxi wrote:*   

> I'm pretty sure the /etc/init.d/xfs restart command will do that caching for you, though I'm not exceptionally sure.

 

I'm not sure, but at least it didn't work for me. I restarted xfs like I should regarding the howto.

----------

## Master One

Ok, this is weird. I just recompliled mozilla-firefox 0.9-r1 with the option "moznoxft", but then I don't get any antialiasing / hinting / subpixel-rendering at all, as expected. Everything else it set up correctly, and I tried it with xfs turned on and off.

So how do you exect to get antialiased fonts without xft?

I must have missed something. I am gonna recomplile firefox without "nomozxft" again now, it seems to be working this way, except some fonts look a little bulky then, like the menulist on top of this forum page (I mean the "FAQ | Search | ..."), but this may he due to subpixel-rendering & hinting.

It is very strange, it seems not to be possible to get the same look like under WinXP. As I already mentioned in another threat, I have two workstation here side by side, one with Gentoo, the other with WinXP, each using an equal LCD panel.

On WinXP the ClearType rendering is enabled, the main difference is, that some fonts (like the forum-menulist) look clear and sharp, and the rest gets rendered well, but under Gentoo everything gets rendered differently and some a little too much (like the forum-menulist, with then looks a little foggy and bulky). BTW I have copied the WinXP fonts-folder to my Gentoo machine, so I have access to the same TTFs there.

One other thing: With firefox compiled with "moznoxft" the listing of the fonts in the preferences (Edit -> Preferences -> General -> Fonts & Colors) looks totally different. For example instead of

```
Bitstream Vera Serif
```

 I get 

```
bitstream-bitstream vera serif-iso8859-15
```

Setting up fonts under Linux is still some kind of mystery, this is what I can tell, when also looking at the many topics here in this forum about fonts, which show that most people have no clue how it really works, it's more of a trial & error game,

BTW Do you have compiled freetype with the option BINDIST or without? I tried both, but again everything looked a little more bulky with using BINDIST,

----------

## Sastraxi

I have the exact same problems with this guide. Everything else is BEAUTIFUL.

----------

## solka

Master One: I noticed that without the use flag moznoxft the fonts of the menubar were antialiased but web page fonts weren't. Recompiling Firefox 0.9 with this flag set gave me the opposite result, that is web page fonts antialiased and normal menu fonts. However please pay attention to the fonts selected in the preferences because they should be Bits-bitstream-* and not  bitstream-bistream-*, in fact with the latter font set the web fonts are awful for me.

About freetype, I compiled it without "bindist".

And I must agree with you that fonts in linux are a kind of mistery  :Wink: 

Please tell me if compiling Firefox with "moznoxft" and selecting the correct fontset make things better, otherwise I'd like to find a common solution to add in my HOWTO.

----------

## solka

 *knopper wrote:*   

> 
> 
> The fonts weren't anti-aliased in Firefox until I did "fc-cache -fv" as root. This builds some indexes and more stuff for freetype fonts which are used by Firefox as explained by this howto. 
> 
> 

 

Mumble...as said /etc/init.d/xfs should do this at restart...I'll add a little note for this. Thanks for your feedback  :Smile: 

----------

## Master One

 *solka wrote:*   

> Master One: I noticed that without the use flag moznoxft the fonts of the menubar were antialiased but web page fonts weren't. Recompiling Firefox 0.9 with this flag set gave me the opposite result, that is web page fonts antialiased and normal menu fonts.

 

I don't understand this. Using "moznoxft" = ugly fonts without antialiasing in the menubar and web pages, without "moznoxft" everthing's fine except some fonts look a little "over-antialiased" and therefore some kind of bulky.

There has to be something different between our systems.

If you compile firefox with "moznoxft", you tell it not to use the X FreeType interface library, therefore you do not get any FreeType fonts rendering, which leeds to the result I mentioned before.

If you nevertheless get nicely rendered fonts also without xft, another component in your setup takes over the fonts rendering.

xfs can also render TTF fonts, but therefore it has to be in use, which means the font paths in xorg.conf would have to be replaced by the xfs fontpath. As I understand it, xfs is not used at all, if not included by 

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

 that's why I mentioned, that you do not need to start xfs at all, if not using it this way, as it's just a waste of system resources then.

 *solka wrote:*   

> However please pay attention to the fonts selected in the preferences because they should be Bits-bitstream-* and not  bitstream-bistream-*, in fact with the latter font set the web fonts are awful for me.

 

Another strange thing, because I have media-fonts/ttf-bitstream-vera-1.10-r3 properly installed on my system, but it's not showing up as Bits-bitstream-*, but only as mentioned before.

We should try to track down, what the main differences between our two installations could be. At the moment, I have no clue how you got to your results.

 *solka wrote:*   

> Please tell me if compiling Firefox with "moznoxft" and selecting the correct fontset make things better, otherwise I'd like to find a common solution to add in my HOWTO.

 

I can't select the font the way you mentioned it, as it is not showing up in the fontlist in the firefox font-config menu.

Can it have something to do with the locale? As you can see, I'm using iso8859-15 here, and in the firefox font-menu "Fonts for: Western".

It looks like I again have to play with the fonts setup, I am simply not satisfied with the result until now. There has to be the right mix of subpixel-rendering, hinting and antialiasing.

At the moment I am writing this on my WinXP workstation. I am not sure, how it is solved in WinXP, but maybe it's not using antialiasing at all, but only subpixel-rendering and hinting. This would explain the visual difference in the forum menu-line (I don't know which font is used for it), which looks sharp and clear. Anyone knows what the "ClearType" option is actually doing to the fonts rendering?

BTW These are the firefox font settings unter WinXP:

```
Fonts for: "Western"

Proportional: Serif (Size: 16)

Serif: Times New Roman

Sans-serif: Arial

Monospace: Courier New (Size: 13)

Display resolution: 96 dpi

Minimum font size: None
```

I surely have not the proper knowledge background, when it comes down to the whole fonts management system. Maybe someone can point out some links to good documents, how all this fonts stuff exactly works unter Linux. I especially still do not understand the following points:

- What exactly is the X server doing with fonts, as it is instructed to load the modules "freetype", "type1" and "speedo" in my xorg.conf, besides letting it know the paths to all my fonts?

- How exactly is the X FreeType interface library (= xft) involved? Is this only due to the module "freetype" beeing loaded by the X server? And which configuration options is it using (only Xft.something in .Xresources or .Xdefaults?)?

- How is rendering working exactly, if both FreeType AND xfs are in use?

- How exactly is fontconfig involved, as it only handles fonts, but does not do any rendering itself (but why then give all the options in /etc/fonts/local.conf and /etc/fonts/fonts.conf -> looks like these only get passed on, but where to)?

For me this all looks just like a weird mix of different components, not beeing able to get it all down to one simple and common configuration.

Did you ever thing about, why font paths can be declared in 3 different places (xorg.conf - /etc/fonts/local.conf - /etc/X11/fs/config)?

If not using xfs, you usually have all your font paths in xorg.conf and /etc/fonts/local.conf. When you do then a "fc-cache -fv", you will see, that all your font-dirs get scanned twice, so there has to be a redundancy. Maybe it is not at all intended, to insert all your font-dirs in /etc/fonts/local.conf as well?

Maybe it's possible to gather all this information in this how-to. I would love to be able to finally come to an end playing arround with all that fonts stuff, there are surely more important things to do...   :Wink: 

----------

## solka

 *Quote:*   

> Another strange thing, because I have media-fonts/ttf-bitstream-vera-1.10-r3 properly installed on my system, but it's not showing up as Bits-bitstream-*, but only as mentioned before.
> 
> We should try to track down, what the main differences between our two installations could be. At the moment, I have no clue how you got to your results. 

 

That's another strange thing because I tried using bitstream-bitstream and while in Firefox 0.8 this fontset made web pages awful, in Firefox 0.9 it renders correctly. And a stranger thing, I searched in all fonts.list and fonts.dir but I couldn't find a line mentioning the Bits-bitstream-* fontset, also in xfonstel it doesn't appear...I'm really becoming mad.

About xfs you're right, I only used to restart it to make the system do fc-cache automatically but it can be removed without problems.

Unfortunately (well, it depends by the point-of-view eheh) I'm going to the seaside and I'm coming back on the second of july, so I can't give much time to this HOWTO since I'll come back.

I hope we'll find a good solution to this problem, I think that fonts are one of the few things that linux can't manage properly.

----------

## Master One

I think we then should open a new threat in the forum (not under documentation, tips & tricks) to have an open discussion, so that other can also contribute to this problem, especially as some other seem to get the same results like me.

I'll be on holliday for about a week from the 2nd July, but we definitely should deal with this fonts issue after I'm back. In the meantime I'll start my own investigation, there is quite a lot to try. Actually I'm using FVWM2, so no additional software (like the gnome-settings-daemon) is involved. I really can't believe, that it's not possible to get a real good fronts setup under linux.

----------

## Sastraxi

I think part of the reason we're having major problems is that Firefox actually uses *pango* and its xft backend for its fonts, if you don't specify moznoxft. Thus, changing settings in the gnome manager can help, but we do get the stupid glyphs... the stupid smooth 'x', the 'k' with hardly any diagonal stroke, etc... but I think that this *may* just be the font we're using -- I think I've seen that ugly font, it's the sans one they put in for things like "Verdana" when they don't have the actual font to work with.

I guess I didn't say much of use, but I'm really trying to find what fonts in X are all about. If you ask me, "X" in some respects is just too old and confusing to be useful these days.

Just a little addition, ldd says firefox isn't a dynamic executable. If it was statically linked with all of the libraries at compile-time, could this be part of the problem?

----------

## plbe

I had the same problem as one of the previous posters I compiled firefox with moznoxft flag and fonts looked like crap, I emerged again without that flag and only truetype and everything worked great although I didn't have xfree previously installed I guess that could be why

----------

## Master One

I also installed xorg-x11 from scratch, so there was no Xfree on this system before, but I don't think this has something to do with these font problems.

Next I am gonna try to install some more TTFs from an old Corel CD set, it may be due to the selection of fonts here in my workstation.

----------

## BlindSpy

Just wanted to say GREAT GUIDE. This is very important information and i think it should be made a part of the FAQ. mods?

thanks again for the good work.

----------

## torklingberg

media-fonts/corefonts is masked. Nothing to worry about or?

----------

## Bash[DevNull]

Hm, it will be good practice if you all publish screenshot with results, so i and any other can compare results!

----------

## torklingberg

I had two issues with the HOWTO:

1. artwiz changed my mouse cursor. Moving FontPath   "/usr/share/fonts/artwiz/" to the end of the list fixed that.

2. running "/etc/init.d/xdm stop" from within X made my computer freeze completely.

----------

## BlindSpy

ISSUES:

1. I've did the 0.9 guide and I didnt have an user.js file so I just made one. It seemed to make some fonts anti-alias but not all.

----------

## Sastraxi

From my last post, I recompiled firefox without moznoxft... and it looks amazing. Thanks a lot for the guide, but I still do recommend changing that "moznoxft" tip =)

----------

## Bash[DevNull]

Hey, people! Please, post your screenshots (for example Firefox with opened gentoo-forums) :)))

----------

## BlindSpy

Sastraxi whats the dif without moznoxft compiled in? do you still have antialiasing?

----------

## Sastraxi

I have antialiasing and no more of that awful blurry 'x' or 'k' without a bottom... it's amazing  :Smile:  Here's my current desktop, if you guys want to see it.

[img:f6daf4689c]http://www.crystal-rain.com/files/screeno.png[/img:f6daf4689c]

http://www.crystal-rain.com/files/screeno.png if the image doesn't work...

----------

## Zyne

Thanks a lot for this great guide mate...

I just finished compiling my X.org after getting rid of xfree, and my fonts looked like shit... This little howto fixed all my problems with my fonts.

Thanks again mate!

----------

## mlybarger

i tried this also to the T, but still have not so good fonts.  they're probably not getting anti aliased or some such. my /var/log/Xorg.0.log file shows:

```

(WW) `fonts.dir' not found (or not valid) in "/usr/share/fonts/encodings/".

        Entry deleted from font path.

        (Run 'mkfontdir' on "/usr/share/fonts/encodings/").

(WW) The directory "/usr/share/fonts/sharefont/" does not exist.

        Entry deleted from font path.

(WW) The directory "/usr/share/fonts/lfp-fix/" does not exist.

        Entry deleted from font path.

(**) FontPath set to "/usr/share/fonts/TTF/,/usr/share/fonts/ttf-bitstream-vera/,/usr/share/fonts/terminus/,/usr/share/fonts/corefonts/,/usr/share/fonts/Type1/,/usr/share/fonts/freefont/,/usr/share/fonts/artwiz/,/usr/share/fonts/local/,/usr/share/fonts/misc/,/usr/share/fonts/75dpi/:unscaled,/usr/share/fonts/100dpi/:unscaled,/usr/share/fonts/Speedo/,/usr/share/fonts/CID/,/usr/share/fonts/util/,/usr/share/fonts/75dpi/,/usr/share/fonts/100dpi/,/usr/share/fonts/unifont/"

        X.Org Font Renderer : 0.4

(II) Loading /usr/X11R6/lib/modules/fonts/libbitmap.a

        Module class: X.Org Font Renderer

        ABI class: X.Org Font Renderer, version 0.4

(II) Loading font Bitmap

(II) Loading extension FontCache

(II) Loading /usr/X11R6/lib/modules/fonts/libspeedo.a

        Module class: X.Org Font Renderer

        ABI class: X.Org Font Renderer, version 0.4

(II) Loading font Speedo

(II) Loading /usr/X11R6/lib/modules/fonts/libtype1.a

        Module class: X.Org Font Renderer

        ABI class: X.Org Font Renderer, version 0.4

(II) Loading font Type1

(II) Loading font CID

(II) Loading /usr/X11R6/lib/modules/fonts/libfreetype.so

        Module class: X.Org Font Renderer

        ABI class: X.Org Font Renderer, version 0.4

(II) Loading font FreeType

(II) Initializing built-in extension XFree86-Bigfont

Could not init font path element /usr/share/fonts/Type1/, removing from list!

Could not init font path element /usr/share/fonts/local/, removing from list!

Could not init font path element /usr/share/fonts/Speedo/, removing from list!

Could not init font path element /usr/share/fonts/CID/, removing from list!

Could not init font path element /usr/share/fonts/util/, removing from list!

```

----------

## Tun

Cheers for this, it was a big help in sorting my fonts out.

I never realised firefox could look like this, it's a lot more impressive than it was under XFree and I can now use artwiz fonts with fluxbox which I'd failed at before.

I had a test of different options an I found -moznoxf and uncommenting the sub-pixel rendering worked best for me.  If compiled with +moznoxf the fonts in firefox were basic, and the sub-pixel rendering 'fattened out' the antialiased fonts making them more pleasing on the eye.

----------

## Bash[DevNull]

 *Tun wrote:*   

> 
> 
> I never realised firefox could look like this, it's a lot more impressive than it was under XFree and I can now use artwiz fonts with fluxbox which I'd failed at before.

 

IMHO nothing seriously was changed in font  from XFree-4.3 to Xorg

----------

## paperp

First of all thanks a lot for this guide.I got this errorand I 'm not able to get ananswer on myself why says .."have been masked ..2 if i use ACCEPT_KEYWORDS="~x86???

```

root@killertux emanuele # ACCEPT_KEYWORDS="~x86" emerge sharefonts

Calculating dependencies

!!! all ebuilds that could satisfy "sharefonts" have been masked.

!!! possible candidates are:

- media-fonts/sharefonts-0.10-r1 (masked by: missing keyword)

- media-fonts/sharefonts-0.10-r2 (masked by: missing keyword)

- media-fonts/sharefonts-0.10-r3 (masked by: missing keyword)

!!! Error calculating dependencies. Please correct.

root@killertux emanuele # emerge media-fonts/sharefonts

Calculating dependencies

!!! all ebuilds that could satisfy "media-fonts/sharefonts" have been masked.

!!! possible candidates are:

- media-fonts/sharefonts-0.10-r1 (masked by: missing keyword)

- media-fonts/sharefonts-0.10-r2 (masked by: missing keyword)

- media-fonts/sharefonts-0.10-r3 (masked by: missing keyword)

!!! Error calculating dependencies. Please correct.
```

Thanks in advance.

----------

## Tun

 *Bash[DevNull] wrote:*   

>  *Tun wrote:*   
> 
> I never realised firefox could look like this, it's a lot more impressive than it was under XFree and I can now use artwiz fonts with fluxbox which I'd failed at before. 
> 
> IMHO nothing seriously was changed in font  from XFree-4.3 to Xorg

 

I think you're right.  The difference I can see probably comes down to my laziness in correctly configuring my original xfree install.

----------

## Tun

 *paperp wrote:*   

> First of all thanks a lot for this guide.I got this errorand I 'm not able to get ananswer on myself why says .."have been masked ..2 if i use ACCEPT_KEYWORDS="~x86???
> 
> ...
> 
> Thanks in advance.

 

I'm no portage expert, but I'll try.  On my box

```

plato sharefonts # emerge -pv sharefonts

These are the packages that I would merge, in order:

Calculating dependencies ...done!

[ebuild   R   ] media-fonts/sharefonts-0.10-r1   0 kB 

Total size of downloads: 0 kB

 
```

Which is as you'd expect so taking a look at the ebuilds in /usr/portage/media-fonts/sharefonts 

```

plato sharefonts # find .  |  xargs grep -H KEYWORDS

./sharefonts-0.10-r1.ebuild:KEYWORDS="x86 sparc ppc amd64"

./ChangeLog:  Added LICENSE, KEYWORDS, SLOT.

./sharefonts-0.10-r2.ebuild:KEYWORDS="~x86 ~sparc ~ppc ~amd64"

./sharefonts-0.10-r3.ebuild:KEYWORDS="~x86 ~sparc ~ppc ~amd64"

```

How do your ebuilds match up to mine?

If I were you I'd emerge sync and try again.  Then failing that take a look at /usr/portage/package.mask and /usr/portage/profiles/package.mask 

Like I said I'm no expert and there is probably better advice out there, but it's not here yet so hopefully this is a step in the right direction

----------

## thinair

I dont understand what is the difference between :

```

Bitstream Vera Serif 

and

bitstream-bitstream vera serif-iso8859-15

```

I follow this guide, but I only have bitstream-bitstream fonts...

Bitstream are not in firefox menu... and antialiasing is not working in firefox 0.9.1

why ?

thx in advance

----------

## solka

Hi all.

I'm back from my holidays and now I can give some answers, but first I want to thank you all for your support  :Smile: 

 *torklingberg wrote:*   

> media-fonts/corefonts is masked. Nothing to worry about or?

 

Yes, this isn't a problem. I'll add a note regarding this masking, I forgot it.

 *torklingberg wrote:*   

> I had two issues with the HOWTO:
> 
> 1. artwiz changed my mouse cursor. Moving FontPath "/usr/share/fonts/artwiz/" to the end of the list fixed that.
> 
> 2. running "/etc/init.d/xdm stop" from within X made my computer freeze completely.

 

I'll add other notes for this, thank you.

 *BlindSpy wrote:*   

> ISSUES:
> 
> 1. I've did the 0.9 guide and I didnt have an user.js file so I just made one. It seemed to make some fonts anti-alias but not all.

 

user.js doesn't exist by default in 0.9, in fact you have to create it. Have you solved your problem about anti-aliasing?

 *Sastraxi wrote:*   

> From my last post, I recompiled firefox without moznoxft... and it looks amazing. Thanks a lot for the guide, but I still do recommend changing that "moznoxft" tip =)

 

Fonts in x sometimes make me crazy, in fact as I said without moznoxft my fonts look ugly. I'll study this when I'll return from my holiday in Scotland, at the end of July.

 *mark_lybarger wrote:*   

> i tried this also to the T, but still have not so good fonts. they're probably not getting anti aliased or some such. my /var/log/Xorg.0.log file shows:

 

Check your font config files, first of all ~/.fonts.conf. I was stuck to this problem due to the "antialias" option.

 *thinair wrote:*   

> I follow this guide, but I only have bitstream-bitstream fonts...
> 
> Bitstream are not in firefox menu... and antialiasing is not working in firefox 0.9.1
> 
> why ?
> ...

 

If you have compiled Firefox without the "moznoxft" flag you have fonts listed as "bitstream-bitstream vera serif-iso8859-15", vice versa if you use the "moznoxft" flag you have "Bitstream Vera Serif".

----------

## nostabo

To change the fonts when using Mozilla (1.7 at least) add the code (as suggested earlier):

```
// TrueType

user_pref ("font.FreeType2.enable", true);

user_pref ("font.freetype2.shared-library", "libfreetype.so.6");

// if libfreetype was built without hinting compiled in

// it is best to leave hinting off

user_pref ("font.FreeType2.autohinted", true);

user_pref ("font.FreeType2.unhinted", true);

// below a certian pixel size anti-aliased fonts produce poor results

user_pref ("font.antialias.min",        0);

user_pref ("font.embedded_bitmaps.max", 1000000);

user_pref ("font.scale.tt_bitmap.dark_text.min", 0);

user_pref ("font.scale.tt_bitmap.dark_text.gain", "0.0");

// sample user_pref s for TrueType font dirs

user_pref ("font.directory.truetype.1", "/usr/share/fonts/ttf-bitstream-vera");

user_pref ("font.directory.truetype.2", "/usr/share/fonts/TTF");

user_pref ("font.directory.truetype.3", "/usr/share/fonts/corefonts");

user_pref ("font.directory.truetype.4", "/usr/share/fonts/freetype");

user_pref ("font.FreeType2.printing", true); 
```

to the "/usr/lib/mozilla/greprefs/all.js" file.  This apparently does for Mozilla what the "~/.mozilla/firefox/default.xxx/user.js" does for Firefox.

After editing the file make the changes to the Preferences -->Appearance -->Fonts settings as noted previously.  There are other font selections with Mozilla, but leaving them as is seems to be OK.

Rick B

----------

## Psycam

By not using -moznoxfs, the firefox 9.1 actually produced better results for me (anti-aliased menu, etc.). Just thought I'd share that.

----------

## JetAce44

I just have to say, excellent guide, I have everything up and running with X.org now, very very painless. Thank you very much!

----------

## nkolia

If I understand this correctly then the changes made to ~/.fonts.conf can be done in /etc/fonts/local.conf to enable system-wide effects instead of a per user basis?

----------

## solka

Well I have never tried but I think that's correct...

----------

## Boworr

Thanks! I followed this to the letter and have nice fonts to look at again.

Great work on putting this together.

----------

## Boworr

I tried this on my home PC too and it would not work. I eventually tracked it down to my  /etc/fonts/fonts.conf being empty. It had the header file information, the starting <fontconfig>, the usual warning text but then nothing else. 

So if you're seeing the error below check your fonts.conf file too.

```
office root #  fc-cache -fv

Fontconfig error: line 26: no element found

Fontconfig error: [b]Cannot load default config file[/b]

fc-cache: "/usr/X11R6/lib/X11/fonts/Type1": caching, 29 fonts, 0 dirs

fc-cache: succeeded

```

I copied mine from my laptop and it worked fine after that.

----------

## lagrima

hello guys, im new at this but can you guys post what the necessary USE flags for this?  for some reason i emerge the fonts and it emerges xfree also i want to use xorg omg!

----------

## lagrima

when i do emerge -pv fonts fonts etc etc

one of the things in red is +X

would adding -X on my use flags not install xfree?

----------

## solka

No, the USE flag "X" is also for x.org.

----------

## lagrima

i took the X off and it stopped installing xfree for my fonts oh well xorg works now it seems

----------

## nostabo

A way to stop any merging of xfree is by adding a line to your /etc/portage/package.mask file which will exclude any ebuilds that are listed within it.  This approach should not block any X.org files which will allow you to do updates without worrying about that "tainted" code.

If you don't have a /etc/portage/package.mask all you need to do is:

```
mkdir /etc/portage  ---> this creates the directory
```

If you have a /etc/portage/package.mask or after you created the directory then simply issue:

```
echo x11-base/xfree >> /etc/portage/package.mask  ---> this creates the file (if it doesn't exist and adds the entry
```

or you could simply add the line "x11-base/xfree" to the file's text, on a separate line.

Note that the only ebuild blocked is the x11-base/xfree...I believe that X.org uses some source files that are xfree86 files...at least thats what I saw as I watched the merging on one system...it kinda had me worried, but all is well.

----------

## scruff

Thanks for the tutorial! Had to tweak the Firefox fonts to my liking, but otherwise it worked fine right off the bat.

----------

## chrisaasan

Nice How- To, keep up the good work!

----------

## _FD_

 *Quote:*   

> 
> 
> // TrueType
> 
> user_pref ("font.FreeType2.enable", true);
> ...

 

Shouldn't the directory for font.directory.truetype.4 be something like /usr/share/fonts/freefont ?

Otherwise great guide. Thanks.

----------

## solka

It can be whatever you want, I think that the most important are the ttf-bitstream-vera one and the corefonts.

However, this is true, it was a typo  :Smile: 

----------

## asph

very nice, my eyes thank you  :Smile: 

----------

## Deranger

Hmm, I don't have ~/.fonts.conf file at all. I have only /etc/fonts/fonts.conf and it shouldn't be modified (that's commented)

Should I make it or...? Thanks in advance.

----------

## ksuther

Oktane, you just create the ~/.fonts.conf file.

Since compiling 0.6.7.99.902/903, my fonts in most applications look about 6 points larger than they should be. It seems to be in all my gtk2 apps, as it's appearing throughout xfce4 and any g-apps I run. Does anybody know of a fix to this problem?

----------

## Deranger

 *ksuther wrote:*   

> Oktane, you just create the ~/.fonts.conf file.
> 
> Since compiling 0.6.7.99.902/903, my fonts in most applications look about 6 points larger than they should be. It seems to be in all my gtk2 apps, as it's appearing throughout xfce4 and any g-apps I run. Does anybody know of a fix to this problem?

 

Okey, thanks.

----------

## solka

 *ksuther wrote:*   

> 
> 
> Since compiling 0.6.7.99.902/903, my fonts in most applications look about 6 points larger than they should be. It seems to be in all my gtk2 apps, as it's appearing throughout xfce4 and any g-apps I run. Does anybody know of a fix to this problem?

 

Try changing the font dimension with the command 'switch2'.

----------

## ksuther

I remembered to use switch2 after I posted, but in Firefox I still have some weird font issues. Whenever I select some text, or hover or click links, the text on the page will shift up or down one or two pixels, and it looks really weird. I haven't had this problem previous to switching to xorg, but I remember my friend had it before in XFree 4.3. Does anybody know what would be causing this?

Thanks

----------

## e2k

Everything worked like a charm, but I can't seem to get the scands (ä, ö and å) working in aterm? They worked fine before, what to do?

EDIT: Doesn't work in eterm either.

----------

## Ateo

I'm confused.

Why does this (and other) HOWTOs make it seem so difficult to install fonts when it is a simple task? All I did to install new fonts was create a new folder (with all of my TTF fonts) into /usr/share/fonts, modified /etc/X11/xorg.conf, ran fc-cache -fv and restarted X. That was pretty much it.

Are the instructions contained within this original post of this thread really necessary?

----------

## Stormy Eyes

Good job on the tutorial. I've used it on all the machines running X at home and it looks fecking great!

----------

## eeknay

I'd like to say thanks, this is a great howto.  :Smile: 

----------

## palsyboy

Thank you immensely, solka.  You've made my day.  :Smile: 

----------

## ozt

I've followed this howto and my fonts got much better until a couple of days ago when I started X. All fonts had become blur and bold  :Sad: , and I'm sure I haven't touched any of my configs.

Snapshot

http://members.chello.se/hajder/bold.png

help?

----------

## palsyboy

ozt, I don't see any flaws whatsoever in that image.  All the fonts look fine, including what you circled.  Is something possibly wrong with your monitor?

----------

## ozt

Hmm..maybe it's my resolution :S. But the thing is that ALL my links are bold now.

Edit: I reset my monitor to factory settings and suddenly it became more pleasant to look at  :Smile: . But the mystery of the bold fonts remains!   :Evil or Very Mad: 

----------

## donjuan

Thank You!

Now I can type my optics lab write-up using Times New Roman as required.  :Smile: 

One thing though, my mouse cursor suddenly changed when I installed the fonts.  Is that just an added feature?  I'm not complaining though, because it looks kinda cool.  :Cool: 

----------

## solka

Hey all,

I'm really sorry but currently I'm busy for school so I don't have much spare time.

I'm happy to see that this HOWTO still makes people satisfied  :Wink: 

However, as torklingberg said some posts above for the cursor question you only have to move FontPath "/usr/share/fonts/artwiz/" to the end of the list.

Cheers,

solka

----------

## Piper Dawn

I'm having troubles with fonts in Firefox; changing the prefs as suggested makes no noticeable difference, and I've compiled it with GTK2 support without the moznoxft flag.

Ideally I'd like my fonts to resemble those in ozt's screenshot, as that's essentially what they looked like on my Slackware installation.

Included is a screenshot of my own for your viewing pleasure: note the k's, v's and x's in particular.

http://tinypic.com/f8ac9

Any help would be greatly appreciated.

[edit: nevermind; I uncommented the "autohint" part of ~/.fonts.conf and now it's working perfectly.

----------

## ozt

 *Piper Dawn wrote:*   

> I'm having troubles with fonts in Firefox; changing the prefs as suggested makes no noticeable difference, and I've compiled it with GTK2 support without the moznoxft flag.
> 
> Ideally I'd like my fonts to resemble those in ozt's screenshot, as that's essentially what they looked like on my Slackware installation.
> 
> Included is a screenshot of my own for your viewing pleasure: note the k's, v's and x's in particular.
> ...

 

I'm glad it worked out. But your links are not bold  :Sad: ..lucky you

Edit: I just noticed that the fonts in "Welcome to Opera" (the window that pop-ups when you start Opera) are bold too. Even the text in the address bar in Opera is bold. So I guess it's something set system wide. 

any ideas?

----------

## Fanatic

How do you enable antialiasing on Opera? I got it working on Firefox but Opera isn't antialiased :/

----------

## fdavid

 *Ateo wrote:*   

> I'm confused.
> 
> Why does this (and other) HOWTOs make it seem so difficult to install fonts when it is a simple task? All I did to install new fonts was create a new folder (with all of my TTF fonts) into /usr/share/fonts, modified /etc/X11/xorg.conf, ran fc-cache -fv and restarted X. That was pretty much it.
> 
> Are the instructions contained within this original post of this thread really necessary?

 

I second your opinion. Installing new fonts and editing the font paths in xorg.conf does the trick, although not completely. (My fonts got better, but not all of them, so I still don't have nice fonts everywhere.) Manipulating the fonts/local.conf does not change anything.

----------

## molecularbear

Wow, this font business is really a mess. I think if I want to solve my font problems I'm going to have to learn a whole lot about fonts on Linux. For example, why do we need to specify font paths for both xfs and xorg? Since xfs is the font server, isn't it just xfs that needs to know about the fonts? The X server renders fonts via xfs, correct? Obviously my understanding of this is very shallow.

I did a number of updates recently, including migrating from xfree to xorg. Following the migration, the font for Konsole, and fonts in Opera look very ugly. KDE fonts generally are okay, but I'd long ago set them all to use Luxi. I tried following the HOWTO, but it didn't get rid of my cruddy fonts. I installed all the fonts listed in the HOWTO, but it seems I am still missing a few directories. Namely:

```
/usr/share/fonts/CID/

/usr/share/fonts/Speedo/

/usr/share/fonts/lfp-fix/
```

This post seems to indicate that Speedo is deprecated.

Another problem I had is that after I added the fonts to my configs, my mouse pointer turned "weird". It turned into this odd art deco like triangular shape. I then found this post where someone had the same problem. It is apparently caused by artwiz-fonts - I removed that font from my configs and got my old mouse pointer back.

----------

## fdavid

 *molecularbear wrote:*   

> Wow, this font business is really a mess. I think if I want to solve my font problems I'm going to have to learn a whole lot about fonts on Linux. For example, why do we need to specify font paths for both xfs and xorg? Since xfs is the font server, isn't it just xfs that needs to know about the fonts? The X server renders fonts via xfs, correct? Obviously my understanding of this is very shallow.

 

Either you use xfs and configure the font paths in fs/config, or you don't use it and configure the font paths in xorg.conf. If you use xfs, the one and only font path you must set in xorg.conf is "unix/:-1".

 *molecularbear wrote:*   

> I did a number of updates recently, including migrating from xfree to xorg. Following the migration, the font for Konsole, and fonts in Opera look very ugly. KDE fonts generally are okay, but I'd long ago set them all to use Luxi. I tried following the HOWTO, but it didn't get rid of my cruddy fonts. I installed all the fonts listed in the HOWTO, but it seems I am still missing a few directories. Namely:
> 
> ```
> /usr/share/fonts/CID/
> 
> ...

 

I encountered exactly the same problems and found exactly the same solutions, so here we go.

----------

## evoweiss

Hi all,

I just followed this guide and it seems to have worked. The only mystery is why I get the following error messages in my Xorg error log file:

```

Could not init font path element /usr/share/fonts/local/, removing from list!

Could not init font path element /usr/share/fonts/encodings/, removing from lis$

Could not init font path element /usr/share/fonts/util/, removing from list!

```

The directories in question are there and I've tried mkfontdir, but I still get the errors. Any idea of what else I can try?

Best,

Alex

----------

## molecularbear

Well, I've spent a good portion of the day researching font issues and have ended up a bit better than when I began. What would be great is if Gentoo would put out a definitive guide to fonts. Font issues appear to be somewhat complicated, especially for something that one would think would be fairly simple. I don't even understand the need for XFS. If you want to use XFS, you specify:

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

in xorg.conf and comment out the other FontPath lines. Then you specify all the font paths in /etc/X11/fs/config. If you don't want to use XFS, you leave that line commented out and specify all your FontPaths within xorg.conf. Whether I used XFS or not seemed to have little bearing on the crappiness of my fonts.

I am still confused by the need to specify fonts at all in /etc/X11/ when /etc/fonts/fonts.conf seems to do this already. The HOWTO that started this thread adds further confusion by telling you to add a bunch of paths to /etc/fonts/local.conf. But one of the directories specified in my /etc/fonts/fonts.conf is /usr/share/fonts. From what I could tell, fc-cache examines all subdirectories of the directories given in /etc/fonts/fonts.conf. If I add those paths given in the HOWTO, it examines the directories twice. So I think those changes to local.conf given in the HOWTO are not needed.

Another thing that confuses me about the HOWTO is that it tells you to restart XFS. But the author's xorg.conf shows that XFS is not being used. Therefore restarting XFS would accomplish nothing, correct?

I managed to get a nicer font for Konsole simply by changing the font with Settings->Font. I got Opera looking a little nicer by changing the fonts from within the application, getting some ideas from this thread.

Again, it would be really great if someone who had a deep understanding of fonts on Linux would post an explicit document on the subject. I am assuming that the default font values for KDE applications, Opera, Firefox, etc are not ugly and difficult to read. If that assumption is correct, then these applications should look good in a properly configured system.

----------

## sl70

I followed this HOWTO and now my fonts look beautiful, but the problem now is that when I try to print from Firefox, the browser crashes with a segfault, and I get no output. I have a feeling that it's a fonts permission thing, since I can print fine as root. I went through all the /usr/share/fonts directories and all the font files are either 644 or 444. I can't figure it out. Can anyone help?

Tnx.

----------

## sl70

Well, it's not a permissions problem, since I can print as another regular user. It must be my individual setup. Grrrrrrrr. This is so frustrating.   :Mad: 

----------

## sl70

So, I created a new profile in firefox and now I can print ok, but my fonts don't look as good as before. Back to work....

----------

## F.Ultra

 *Quote:*   

> I am still confused by the need to specify fonts at all in /etc/X11/ when /etc/fonts/fonts.conf seems to do this already

 I think that it has to do with old applications that read the X11 file directly vs newer applications that use some new fancy API for fonts.

----------

## rhill

this whole thing has me completely turned around too.  what the guide says not only contradicts itself, but it contradicts the version in the wiki (http://gentoo-wiki.com/HOWTO_Xorg_and_Fonts).  the wiki seems more up-to-date but it's still a puzzle.

one thing that seems important is the order the fonts dirs are listed in xorg.conf.  like if Type1 and TTF both have a version of the same font, whichever one that comes first in xorg.conf is the one it uses.  that's just my guess, but it seems i can change the appearance of my menu and terminal font by changing the order.

also, freetype's webpage says it does both truetype and Type1 fonts, so why do we also load the Type1 module in xorg.conf?  or should we not be doing that?

something tells me tonights going to be a google night. =/

----------

## rhill

well it took me a while, but i finally got it worked out.  i can't believe how much nicer everything looks now.

i kinda used a combination of this guide, the wiki guide, a bunch of old XFree HOWTO's i found on TLDP.org, and a few pages from the four corners of the net.  

i don't have everything set-up exactly right yet and i want to do a bit more research and trial and error work first before i post a quick walkthrough of what i did.  in the meantime, these will put anyone on the right track:

http://www.tldp.org/HOWTO/Font-HOWTO/index.html

http://www.tldp.org/HOWTO/FDU/index.html

they're both pretty outdated, but still good.  the first explains everything about fonts and X, and the second is a guide to deuglifying XFree.  the latter was hugely helpful.  i'm seriously considering  bringing it up to date, maybe rewrite it for Gentoo and putting it on the wiki or submitting it as a Gentoo Font Guide.   :Very Happy: 

----------

## rhill

here's what i ended up with in my xorg.conf fontpath in the end.

```
        FontPath        "/usr/share/fonts/ttf-bitstream-vera"

        FontPath        "/usr/share/fonts/TTF"

        FontPath        "/usr/share/fonts/Type1"

        FontPath        "/usr/share/fonts/lfp-fix"

        FontPath        "/usr/share/fonts/corefonts"

        FontPath        "/usr/share/fonts/terminus"

        FontPath        "/usr/share/fonts/artwiz-aleczapka-en

        FontPath        "/usr/share/fonts/artwiz"

        FontPath        "/usr/share/fonts/misc:unscaled"

        FontPath        "/usr/share/fonts/75dpi:unscaled"

        FontPath        "/usr/share/fonts/100dpi:unscaled"

        FontPath        "/usr/share/fonts/misc"

        FontPath        "/usr/share/fonts/75dpi"

        FontPath        "/usr/share/fonts/100dpi"
```

left local.conf alone, edited .font.conf to turn AA and autohinting on.  never looked better.Last edited by rhill on Mon Dec 13, 2004 8:01 pm; edited 1 time in total

----------

## Quantum Skyline

Thanks for the howto!  Now I have an answer to Cleartype.

----------

## Corona688

This howto was really useful.  Everything's antialiased now  :Very Happy:   Couple things:

You don't need to edit the firefox user preferences file manually -- just type "about:config" in your address bar and you can modify the same settings there.

If your font sizes seem to change randomly, X probably can't make up it's mind about how big your screen is.  Specify it manually in your "Monitor" section like this and your fonts will change size no more:

```
Section "Monitor"

    Identifier "Dell"

    VendorName "Plug'n Play"

    ModelName "Dell D1025TM"

    HorizSync 30-85

    VertRefresh 50-120

# DisplaySize WIDTH_IN_MM HEIGHT_IN_MM

    DisplaySize 434 406

EndSection
```

Under KDE, also head to Control Center -> Appearances and Themes -> Fonts, and check "Use anti-aliasing for fonts".

----------

## robet

I don't think you even have to do anything w/ Firefox after following the steps and restarting X. It just became beautiful on it's own.

----------

## ursusarctos

After setting the fontpaths in xorg.config, my terminals no longer display in color properly.  Xterm opens, but will not show green or red, giving this error message:

```

xterm: Cannot allocate color green

```

Aterm will not even start, giving the message

```

aterm: can't load color "Black", colorID = 0, (29)

aterm: can't load color "Black", colorID = 0, (29)

aterm: aborting

```

I've been using xterms without color, but this isn't a very good solution.  Any suggestions on how to fix?  Feel free to move discussion to another topic so that the howto doesn't get cluttered....

----------

## converter

 *ursusarctos wrote:*   

> After setting the fontpaths in xorg.config, my terminals no longer display in color properly.  Xterm opens, but will not show green or red, giving this error message:
> 
> ```
> 
> xterm: Cannot allocate color green
> ...

 

Is there an "RgbPath" entry in your X config file? Mine looks like:

Section "Files"

        RgbPath      "/usr/X11R6/lib/X11/rgb"

...

Does /usr/X11R6/lib/X11/rgb.txt exist?

From the xorg.conf man page:

```

       RGBPath "path"

              sets  the  path name for the RGB color database.  When this entry is not specified in the config file, the

              server falls back to the compiled-in default RGB path, which is:

                  /usr/X11R6/lib/X11/rgb

       Note that an implicit .txt is added to this path if the server was compiled to use text rather than binary format

       RGB color databases.

```

----------

## chuliomartinez

The xserver (xorg or xfree it doesn't matter) use their own freetype lib. E.g. don't link to the freetype2 lib. Sure it is the same code but probably older than the current freetype version and compiled with flags you cannot alter without compiling the xserver. So it is in my opinion better to use the xfs which DOES link to freetype, thus having better rendering with every new freetype version:) For example if you want byte code interpreter you have to compile freetype with a special option.

----------

## drphibes

 *chuliomartinez wrote:*   

> The xserver (xorg or xfree it doesn't matter) use their own freetype lib. E.g. don't link to the freetype2 lib. Sure it is the same code but probably older than the current freetype version and compiled with flags you cannot alter without compiling the xserver. So it is in my opinion better to use the xfs which DOES link to freetype, thus having better rendering with every new freetype version:) For example if you want byte code interpreter you have to compile freetype with a special option.

 

While it's true that loading the module "freetype" will cause the X server to load its built-in version of freetype, it won't be used. 

```
$ grep -i freetype /var/log/Xorg.0.log

(II) LoadModule: "freetype"

(II) Loading /usr/X11R6/lib/modules/fonts/libfreetype.so

(II) Module freetype: vendor="X.Org Foundation & the After X-TT Project"

(II) Loading font FreeType
```

The reason is simply that the freetype package emerged separately is installed to /usr/lib and this path will have precedence over the path /usr/X11R6/lib/modules/fonts/.   You can verify this by using ldd to display the libaries used by any program that requires some font rendering, e.g. 

```
$ ldd `which xclock`| grep freetype

libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0xb7f3a000)
```

The only way that the Xorg version of freetype 2 will be used is if you go out of your way to re-arrange the paths ld.so uses to search for libs, or if some application happened to have been built with an rpath directive to the linker forcing it to use that lib, or, finally, if you delete the separate freetype package (which you do not want to do of course).

If you have freetype installed separately, there is absolutely no reason to load the module "freetype" in your xorg.conf -- it won't be used.   

doc

----------

## chuliomartinez

Ok please correct me if I'm wrong.

1. Application ask xserver or xfs to render the fonts for them?

   - or do they ask freetype directly? (don'y thing so)

   - how does an app know whenether to ask xfs or xserver for fonts.

   (does x delegate these calls if xfs is running thus making it transparent to the apps?)

2. Xserver will use any freetype lib it finds first?

(ok you already answered this one)

I would love to know more about the font handling (and don't feel like inspecting source right now:) so please share with me:)

----------

## drphibes

whether or not xfs is running is completely transparent to the application.  most modern x applications use higher-level toolkits to display widgets (e.g. gtk+) and fonts (e.g. pango) and don't call freetype directly.

http://www.freetype.org/david/unix-font-rendering.html#x11-render

----------

## Zarhan

As of xorg 6.8.2 at least, ttf-bitstream-vera fonts are now included with xorg, so no need to install them separately anymore.

----------

## Apreche

I just did this howto and I can say that it definitely made a huge difference.  On my LCDs all the fonts look great.  

However, I have a problem still.  In some places, like (g)vim and terminals I use very small monospaced fonts for programming and such.  Specifically fonts like the proggy are destroyed by the configuration in this howto.  I have these fonts downloaded and stored in ~/.fonts and I can use them just fine.  But th ey are all deformed and ugly as sin.  How can I configure xorg to not uglify these fonts?

----------

## MattSharp

Great how-to but I am having a couple of problems. 

1). In Konsole, using Bitstream Vera Sans Mono, the right side of "m" disapears, so it looks like an "n" overlapped with an "r" if that makes any sense. That is using size 10. If I increase to 11, problem is solved.

2) In Firefox, with fonts smaller than 9 (and to a lesser extent fonts that are size 9) the letters are too close together and it doesn't look very good. Has anyone seen this?

----------

## ilm

I'm hoping someones still watching this thread!!!  :Wink: 

Anyway, I tried to follow the HowTo, but I seem to be missing something:

1) In terms of USE flags, I already had a truetype flag.  Is this the same as truetype-fonts???

2) I have no /etc/fonts/local.conf file in my system   :Confused: 

3) I had no font paths in my /etc/X11/xorg.conf file, so am unsure of where to place these lines

4) I also have no ~/.fonts.conf, so am not sure how to set up antialiasing, etc.

However, the fonts all seem to work.  :Confused: 

On a side note, am I required to have xfs running???

Hope someone can help!!!!!!

----------

## Hijacker

Hey all,

I followed the Guide and got fancy AA running everywhere, on all apps now. Looks great =)

But still, there's one app which refuses to apply anti aliasing. This is Zend Studio, the PHP framework. This is running off of java... are there some special settings I might have to check, when running Java applications? Or is that the wrong direction?

If anyone got a clue what I could adjust to get AA working with Zend Studio, I'd be glad if you told me  :Smile: 

Thanks,

Hijacker

----------

