For the configuration "mix and match" part of the question - the answer is "kind of".
The xorg.conf
man page lists the configuration sources in order of precedence, and states "When the same information is supplied in more than one way, the highest precedence mechanism is used".
By observation (since "same information" and "more than one way" aren't clearly defined in the man page, to my mind), this means you cannot override/update a section in xorg.conf
(like Section "Files"
for fonts) with an xorg.conf.d
file since that has lower precedence. Although lower precedence files are read and parsed, section contents are silently disregarded for those sections that already exist at a higher precedence.
The current Nvidia driver (396, on Linux only) does now use an xorg.conf.d
fragment, but only for the Linux DRM Xorg driver, it still creates a near-monolithic xorg.conf
during installation.
Happily, nvidia-xconfig
does not change this section, so if it helps you could comment it out of xorg.conf
and migrate it into one or more xorg.conf.d
files. Multiple duplicate sections at the same precedence, i.e. all within a single xorg.conf.d
directory, does result in merged values as hoped.
An easy way to generate the directives is:
fc-list -f 'Fontpath "%{file|dirname}"\n' : | sort -u
This uses the formatted output (-f
) of fc-list
to create the required configuration lines, %{file}
is the filename of each font, |dirname
is a filter that outputs the directory name (exactly like the dirname
shell command), then sort -u
for unique paths. You may wish to reorder the paths if you have many fonts, if you have bitmap versions you can do something like this to reorder:
fc-list -f ' Fontpath "%{file|dirname}"\n' :scalable=true | sort -u
fc-list -f ' Fontpath "%{file|dirname}"\n' :scalable=false | sort -u
You can paste that output as required - or - as an example of all the steps (as root)
# extract Files section from xorg.conf to a separate conf
sed -n '/^Section..Files/,/^EndSection/p' \
< /etc/X11/xorg.conf > /etc/x11/xorg.conf.d/10-section-files.conf
# comment out Files section in xorg.conf
sed -i.bak '/^Section..Files/,/^EndSection/ s/^/#/' /etc/X11/xorg.conf
# paths for scalable fonts
( echo 'Section "Files"';
fc-list -f ' Fontpath "%{file|dirname}"\n' :scalable=true | sort -u;
echo 'EndSection' ) > /etc/X11/xorg.conf.d/20-fontpath.conf
# paths for non-scalable fonts
( echo 'Section "Files"';
fc-list -f ' Fontpath "%{file|dirname}"\n' :scalable=False | sort -u;
echo 'EndSection' ) > /etc/X11/xorg.conf.d/30-fontpath-fixed.conf
Reorder and remove duplicates if required, and restart X.
For completeness, you can also modify the font paths on the fly with xset
, e.g.
xset +fp /usr/local/share/fonts/TTF
Check the current paths with xset q
. You could trivially modify this to add such commands to your .xinitrc
script so font paths persist independently of any subsequent X configuration changes, and save restarting X too.