You are not logged in.

#1 2025-01-26 17:52:40

maglorn
Member
Registered: 2015-11-26
Posts: 5

Font choice

I am puzzled about how a given application chooses (or is assigned) which font to use.

Occasionally when I update fontconfig, I will notice that the font in my terminals (xfce4-terminal) will change, sometimes requiring me to resize the terminals. Within the terminal config, I have the font set to "Monospace Regular 18".  I figure that I have several fonts installed that match that description and that a random one is being assigned.

I may have installed too many fonts.  smile

How do I determine which font the terminal is using?  How can I ensure that the same font is used each time?

Similarly, the recent fontconfig update changed the font used for Discord in one Vivaldi profile, but not in a different Vivaldi profile.

What's my best path forward?

Offline

#2 2025-01-26 17:58:44

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,817
Website

Re: Font choice

"Monospace" is an alias.

Check

fc-match monospace

To assign a specific font use ~/.config/fontconfig/fonts.conf, here's mine:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!-- Set preferred serif, sans serif, and monospace fonts. -->
   <alias>
      <family>serif</family>
      <prefer><family>Liberation Serif</family></prefer>
   </alias>
   <alias>
      <family>sans-serif</family>
      <prefer><family>Liberation Sans</family></prefer>
   </alias>
   <alias>
      <family>monospace</family>
      <prefer><family>JetBrainsMono Nerd Font Mono</family></prefer>
   </alias>
</fontconfig>

Using "sans", "mono", and "serif" in the various applications settings then means you only have to edit fonts.conf to change the font everywhere.


Jin, Jîyan, Azadî

Offline

#3 2025-01-26 19:04:02

maglorn
Member
Registered: 2015-11-26
Posts: 5

Re: Font choice

Thanks.

> fc-match monospace
NotoSansMono-Regular.ttf: "Noto Sans Mono" "Regular"
> fc-list | grep -i mono | wc -l
63

I have lots of choices.

After creating ~/.config/fontconfig/fonts.conf, what do I do to put the changes into effect? Anything less drastic than restarting X?

Offline

#4 2025-01-26 19:07:00

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,817
Website

Re: Font choice

Restarting individual applications should do it, although I have noticed some pick up the change "live".

The desktop UI stuff might need you to log out & back in again though.


Jin, Jîyan, Azadî

Offline

#5 2025-01-26 22:28:13

maglorn
Member
Registered: 2015-11-26
Posts: 5

Re: Font choice

Adjusting the fonts.conf file seemed sufficient for my xfce4-terminals.

The Discord webpages in Vivaldi do not seem to be affected, so I'll need to figure out something for that.

Thanks again.

Last edited by maglorn (2025-01-26 22:41:10)

Offline

#6 2025-01-27 07:41:57

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,817
Website

Re: Font choice

maglorn wrote:

The Discord webpages in Vivaldi do not seem to be affected

Have you set sans as the font in Vivaldi? Some webpages set their own fonts (mine does).


Jin, Jîyan, Azadî

Offline

#7 2025-01-27 20:33:45

maglorn
Member
Registered: 2015-11-26
Posts: 5

Re: Font choice

As I've looked more into this, I'm beginning to doubt that the Discord/Vivaldi thing is a font problem.

I think there is a display problem where a line of text overwrites the lower pixels of the line above. My brain detected that as a font change (and maybe there was a font change as well), because the letters (and vertical spacing) seemed off.

Thanks.

Offline

#8 2025-01-28 01:52:54

maglorn
Member
Registered: 2015-11-26
Posts: 5

Re: Font choice

How would I verify which font an application is using?

For example, how would I test that xfce4-terminal is using the font that I specified on fonts.conf?

Offline

#9 2025-01-28 08:54:58

seth
Member
Registered: 2012-09-03
Posts: 61,581

Re: Font choice

* most secure: debug the code
* pretty safe bet: strace the process, check what font files get opened
* easy: look at it and compare it to the font you've configured - some letters are gonna be relatively unique aligtkRQy are typically good candidates

Offline

Board footer

Powered by FluxBB