You are not logged in.

#1 2016-09-18 16:11:20

198Joe
Member
From: Italy
Registered: 2016-09-16
Posts: 14

[SOLVED] Xorg uses one font for everything

Hello everyone! I need some help with my font settings. I use Openbox as WM.

I was trying to change the font Conky uses, and I installed, through pacman, the adobe-source-code-pro. I then changed settings in conky.conf but to no success.
After reading https://wiki.archlinux.org/index.php/font_configuration and looking at the font paths my xorg used, I noticed there was no path specified for /usr/share/fonts/adobe-source-code-pro. So, I decided to add a .conf file to /etc/X11/xorg.conf.d/ so that I could set the font path manually.
Following the wiki, I created /etc/X11/xorg.conf.d/10-fonts.conf:

Section "Files"
 FontPath "/usr/share/fonts/adobe-source-code-pro/"
EndSection

Then, I restarted Xorg and everything was set as Source Code Pro font, including the openbox theme I use and the browser. I thought I needed to specify all the other font paths, so that every application could find the font it was originally set to. And so did I.
Nothing really changed, so I decided to delete the 10-fonts.conf file I just created. And to my surprise, once xorg was restarted, everything was still in Source Code Pro font.
I don't understand how that is possible! Once I deleted my conf file, I thought xorg would go back to the default font settings, but apparently it doesn't, so now I'm stuck on this font. I'm sure I did something wrong, maybe I should have make xorg point at a different path, I don't know.
So my question is: is it possible to go back to the fonts xorg was using before I created that .conf file? Also, why didn't it work?
Thanks.

EDIT: If it can help, this is my xorg font path output (and there's no 10-fonts.conf file in the /etc/X11/xorg.conf.d/ directory)

[joe@Arch ~]$ grep /fonts ~/.local/share/xorg/Xorg.0.log
[  3231.752] (WW) The directory "/usr/share/fonts/Type1/" does not exist.
[  3231.752] (WW) `fonts.dir' not found (or not valid) in "/usr/share/fonts/100dpi/".
[  3231.752] 	(Run 'mkfontdir' on "/usr/share/fonts/100dpi/").
[  3231.752] (WW) `fonts.dir' not found (or not valid) in "/usr/share/fonts/75dpi/".
[  3231.752] 	(Run 'mkfontdir' on "/usr/share/fonts/75dpi/").
	/usr/share/fonts/misc/,
	/usr/share/fonts/TTF/,
	/usr/share/fonts/OTF/

UPDATE: After I uninstall the Source Code Pro, everything goes to default settings, as expected. Once I reinstall it, it all goes back to Source Code Pro. I suppose there's some configuration file that points the server or the WM to the specific font, but I deleted the only 10-fonts.conf file I created, so I don't know what I'm currently looking for. Still looking into it.

Last edited by 198Joe (2016-09-18 22:24:12)

Offline

#2 2016-09-18 18:26:52

loqs
Member
Registered: 2014-03-06
Posts: 17,373

Re: [SOLVED] Xorg uses one font for everything

From Font_paths

The font paths initially known to Fontconfig are: /usr/share/fonts/, ~/.local/share/fonts (and ~/.fonts/, now deprecated). Fontconfig will scan these directories recursively.

To see a list of known Fontconfig fonts:

$ fc-list : file

198Joe wrote:

I suppose there's some configuration file that points the server or the WM to the specific font, but I deleted the only 10-fonts.conf file I created, so I don't know what I'm currently looking for.

Fontconfig_configuration
Replace_or_set_default_fonts
After installing Adobe Source Code Pro would suggest checking if Fontconfig is matching everything to Adobe Source Code Pro

$ fc-match
$ fc-match sans
$ fc-match serif
$ fc-match monospace

Offline

#3 2016-09-18 19:19:03

198Joe
Member
From: Italy
Registered: 2016-09-16
Posts: 14

Re: [SOLVED] Xorg uses one font for everything

I am really struggling to understand all of this, and in particular why it all happened after I created that configuration file for Xorg.
I did read those articles before, I have all my fonts installed in /usr/share/fonts and they all appear when I fc-list : file.

However I did not have ~/.config/fontconfig/fonts.conf, so I created the directory and this file:

 <?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>

  <match target="pattern">
   <test qual="any" name="family"><string>sans</string></test>
 </match>

</fontconfig>

Everything is still set to Source Code Pro.

When I tried fc-match

[joe@Arch ~]$ fc-match
SourceCodePro-Regular.otf: "Source Code Pro" "Regular"
[joe@Arch ~]$ fc-match sans
SourceCodePro-Regular.otf: "Source Code Pro" "Regular"
[joe@Arch ~]$ fc-match serif
SourceCodePro-Regular.otf: "Source Code Pro" "Regular"
[joe@Arch ~]$ fc-match monospace
SourceCodePro-Regular.otf: "Source Code Pro" "Regular"

I'm really lost here, because I don't understand the way fontconfig works and how it is connected to that one file I originally created.

EDIT
I seem to have found a solution by using this example https://wiki.archlinux.org/index.php/Fo … n/Examples

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>

<!-- Default font (no fc-match pattern) -->
 <match>
  <edit mode="prepend" name="family">
   <string>Noto Sans</string>
  </edit>
 </match>

</fontconfig>

Before I mark it as SOLVED, can somebody explain to me why this is all happened in the first place? How come a configuration file for X ended up changing a setting that wasn't even there until I created a fonts.conf file? Thanks for the help anyway smile

Last edited by 198Joe (2016-09-18 19:36:03)

Offline

#4 2016-09-18 19:53:20

loqs
Member
Registered: 2014-03-06
Posts: 17,373

Re: [SOLVED] Xorg uses one font for everything

198Joe wrote:

How come a configuration file for X ended up changing a setting that wasn't even there until I created a fonts.conf file?

Why do you think the xorg snippet had any effect?

198Joe wrote:

Then, I restarted Xorg and everything was set as Source Code Pro font, including the openbox theme I use and the browser. I thought I needed to specify all the other font paths, so that every application could find the font it was originally set to. And so did I.
Nothing really changed, so I decided to delete the 10-fonts.conf file I just created. And to my surprise, once xorg was restarted, everything was still in Source Code Pro font.

Is the following not an accurate interpretation of what you did?
The first time you noticed a change was after the X server was restarted which would also force a restart of all graphical applications.
You add the xorg snippet and restart the X server and nothing has changed.
You remove the xorg snippet and restart the X server and nothing has changed.
You remove the adobe-source-code-pro package original appearance is restored.

Offline

#5 2016-09-18 22:21:47

198Joe
Member
From: Italy
Registered: 2016-09-16
Posts: 14

Re: [SOLVED] Xorg uses one font for everything

What I don't understand is why the global font didn't go back to the default one after I deleted the 10-fonts.conf. My (very basic) understanding of Xorg is that, if you want to change some settings to use in your session (like a font), you can do so by creating an appropriate xx-whatever.conf file in /etc/X11/xorg.conf.d. Once started, the server will use the settings specified in that directory along with the default ones for the other stuff. BUT, if I delete one such .conf file, I expect X server to go back to the default settings for that particular element! That's why I didn't think the font would stay Source Code Pro, but instead reverted back to Noto Sans. The only way I can explain this is that my .conf file has set that font permanently, so that only specifying a new default one would get me back to Noto Sans.

Another example: my Arch Linux is installed on an laptop with the optimus technology (bumblebee installed and working). When I first started Xorg I noticed it was running using my Nvidia card, so I had to create a 20-intel.conf to use the integrated Intel card instead. If what I've seen with this font problem applies to all the other .conf files, then I expect the next X sessions to always work on the intel card, even if I delete 20-intel.conf, because it has now changed the setting permanently somewhere else! And I honestly don't think it would work that way, from what I've understood so far.
I should probably get more into X server and its configuration. By the way, thank you very much for your help! smile My brain was going crazy with that font all over the screen!

Last edited by 198Joe (2016-09-18 22:28:36)

Offline

#6 2016-09-18 22:43:52

loqs
Member
Registered: 2014-03-06
Posts: 17,373

Re: [SOLVED] Xorg uses one font for everything

198Joe wrote:

BUT, if I delete one such .conf file, I expect X server to go back to the default settings for that particular element!

Fontconfig is independant of the X server.  It would go back to the original behavior if the before and after situations were the same.  As the adobe-source-sans-pro-fonts remained installed in the after situation Fontconfig had a different set of fonts to match against so the match results were different.
Edit:
If any of the applications you had been testing with had used the X servers built in font rendering rather than Fontconfig then would expect to see a difference with that application.
Having two independent font rendering systems can cause confusion .

Last edited by loqs (2016-09-18 23:28:58)

Offline

#7 2016-09-19 01:04:09

198Joe
Member
From: Italy
Registered: 2016-09-16
Posts: 14

Re: [SOLVED] Xorg uses one font for everything

loqs wrote:

  As the adobe-source-sans-pro-fonts remained installed in the after situation Fontconfig had a different set of fonts to match against so the match results were different.

Okay, that makes more sense to me now. So basically installing any new font will alter the way Fontconfig acts (match against the set of fonts) and there may be some global changes unless I specify the default font I want, as I did in the fonts.conf file.

loqs wrote:

If any of the applications you had been testing with had used the X servers built in font rendering rather than Fontconfig then would expect to see a difference with that application.

It's only been one week since I've installed Arch, so I could only check fonts on Chromium, Spotify and Conky. All of them were using Fontconfig apparently!

Offline

Board footer

Powered by FluxBB