Solved Recommended Xorg Font Configuration Method

As suggested in many posts, many times on this forum and in the Handbook - I removed my old /usr/local/etc/X11/xorg.conf configuration file, and let Xorg do its auto-detection thing.

However, after running startx, Xorg ran OK but I couldn't open x11/xterm or x11/rxvt-unicode and my window managers menus (etc.) were messed up due to my font of choice not being recognised (x11-fonts/terminus-font)

I checked the Handbook, which had this to say:
Code:
To have the X server detect these fonts, add an appropriate line to the X server configuration file (/etc/X11/xorg.conf), which reads:
FontPath "/usr/local/share/fonts/urwfonts/"
So much for removing /usr/local/etc/X11/xorg.conf!

I read on, and it says:
Code:
A third way is to use the new /usr/local/etc/fonts/local.conf as demonstrated in Section 5.5.3, “Anti-Aliased Fonts”.
Code:
To control which fonts are anti-aliased, or to configure anti-aliasing properties, create (or edit, if it already exists) the file /usr/local/etc/fonts/local.conf. Several advanced features of the Xft font system can be tuned using this file; this section describes only some simple possibilities. For more details, please see fonts-conf(5).
So I did, but I must be doing it wrong, because I still have the same problem (terminus-font not being used).

I tried creating a /usr/local/etc/fonts/local.conf and using bits from the example from fonts-conf(5)(). Didn't work.

Then I tried copying /usr/local/etc/fonts/fonts.conf to /usr/local/etc/fonts/local.conf

Then I tried creating ~/.config/fontconfig/fonts.conf based on the previous files, but that didn't work either.

Of course each time I ran fc-cache -f and restarted Xorg, but it was the same result every time.

The current contents of my ~/.config/fontconfig/fonts.conf and /usr/local/etc/fonts/local.conf are just copied from the default /usr/local/etc/fonts/fonts.conf.

What is the correct way to do this?
 
Last edited:
I use fonts.conf under /usr/local/etc/X11/xorg.conf.d/ with extra fonts paths. Suggestion to remove xorg.conf means that system doesn't need full and manual Xorg configuration. Providing a hint if you need something special is the correct way.
 
Thanks tobik. That worked fine for me. However, I was hoping to find an automatic solution - one that automagically detects installed fonts.

I tried adding my fonts.conf to /usr/local/etc/X11/xorg.conf.d but I got the following error:
Code:
[  7175.204] (==) Log file: "/var/log/Xorg.0.log", Time: Wed Feb 15 17:12:22 2017
[  7175.205] (==) Using config file: "/usr/local/etc/X11/xorg.conf"
[  7175.205] (==) Using config directory: "/usr/local/etc/X11/xorg.conf.d"
[  7175.205] Parse error on line 1 of section (null) in file /usr/local/etc/X11/xorg.conf.d/fonts.conf
        "<?xml" is not a valid keyword in this section.
[  7175.205] (EE) Problem parsing the config file
[  7175.205] (EE) Error parsing the config file
[  7175.205] (EE)
Fatal server error:
[  7175.205] (EE) no screens found(EE)
[  7175.205] (EE)
May I see the contents of your /usr/local/etc/X11/xorg.conf.d/fonts.conf?
 
The fonts.conf isn't XML, so putting XML tags in it would be an error. Perhaps it's something your editor added?

This is what I use:
Code:
Section "Files"
        FontPath     "/usr/local/share/fonts/bitstream-vera/"
        FontPath     "/usr/local/share/fonts/cyrillic/"
        FontPath     "/usr/local/share/fonts/webfonts/"
        FontPath     "/usr/local/share/fonts/dejavu/"
        FontPath     "/usr/local/share/fonts/terminus-font/"
EndSection
As you can see it's basically just a snippet from a full xorg.conf.
 
Ah, I seem to have misunderstood what abishai wrote; I thought s/he simply copied /usr/local/etc/fonts/fonts.conf to /usr/local/X11/xorg.conf.d.

OK, thank you both. Both solutions work for me:
  1. xset +fp /usr/local/share/fonts/terminus-font in ~/.xinitrc or ~/.xsession.
  2. Creating a simple (non-xml) fonts.conf in /usr/local/etc/X11/xorg.conf.d

However, I would prefer my fonts to be automatically detected, like the rest of X.

Does anyone know why my original attempt didn't work? (The third way using /usr/local/etc/fonts/local.conf as demonstrated in Section 5.5.3, “Anti-Aliased Fonts”).

I would prefer to have such an auto-detecting solution for xorg AND fonts.

EDIT: Nevertheless, I'll mark this as solved, as there are two working (albeit non-automatic) solutions.
 
Last edited:
Back
Top