You are not logged in.

#1 2021-12-26 22:02:26

aardwolf
Member
From: Belgium
Registered: 2005-07-23
Posts: 304

[solved] Monospace font made non-monospace by ligatures

Somehow in one of my Archlinux installations, the default monospace font has ligatures: letter combinations such as ff and fi fuse together take up only 1 space, instead of 2 like those 2 letters should in a monospace font. This makes source code editing harder, and even causes visual bugs in some terminal emulators that aren't expecting the fixed width font to have non-fixed-width ascii character combinations

This seems to be happening in multiple fonts with different names, e.g. "Nimbus Mono" as well as a font simply called "Monospace". Fonts which don't have this issue on another Arch installation I use.

I found an old thread here, but it doesn't help me because this font is the default *everywhere* for me, including in things where you can't configure the font (afaik) like the chrome developer tools:

https://bbs.archlinux.org/viewtopic.php?id=238832

There's also an item on the archwiki for this, but it doesn't help me either: it shows some XML, but it doesn't show where to put that XML, and in general I also am quite sure a simpler solution must be possible like getting rid of that font:

https://wiki.archlinux.org/title/Font_c … aced_fonts

Given that one of my Arch installations doesn't have this issue, and the other one does, I'm quite sure there has to be a simpler solution than the XML one from the wiki.

In the font settings of Cinnamon, the default Monospace font is set to "Source Code Pro Regular", one which does not have the ligatures problem. Given that 99% of the applications with monospace fonts I use do have the issue, clearly the cinnamon setting isn't very authoritative and not the solution.

My questions are:

-Any idea what can cause the default monospace font of Arch to have these ligatures?

-How can I get rid of this monospace font and get ones that don't use ligatures instead? This is happening in things that don't have their own font configuration (e.g. chrome devtools), so it's got to be some default of the OS instead

Thanks!

Last edited by aardwolf (2021-12-27 00:04:08)

Offline

#2 2021-12-26 23:14:07

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,447
Website

Re: [solved] Monospace font made non-monospace by ligatures

aardwolf wrote:

-Any idea what can cause the default monospace font of Arch to have these ligatures?

One of A) no monospace font installed, B) a bad monospace font installed, and / or C) a font-config setting (like that XML from the wiki) setting ligatures to be on.

aardwolf wrote:

-How can I get rid of this monospace font and get ones that don't use ligatures instead? This is happening in things that don't have their own font configuration (e.g. chrome devtools), so it's got to be some default of the OS instead

To answer the second, a very large majority of programs will use fontconfig and it's settings to select and configure fonts.  So the answer to the first part is to identify what's wrong with your fontconfig settings, then fix it.  To start, what's the output of the following:

fc-match monospace

"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2021-12-26 23:36:01

aardwolf
Member
From: Belgium
Registered: 2005-07-23
Posts: 304

Re: [solved] Monospace font made non-monospace by ligatures

Alright, that shows the Nimbus font with the issue!

I must say the wiki about font config is pretty confusing to me. It says you shouldn't edit the central config file because fontconfig overwrites it, it lists personal config files but none of those exist on my system (and doesn't tell what their format is to allow to create one, I miss the days when you could configure everything of linux with text files that were self explanatory...), and it doesn't seem to list any commands with which to set fontconfig values.

Also, "cat /etc/fonts/fonts.conf | grep -v Nimbus" shows nothing, so this is not the file responsible for having fontconfig choose Nimbus as far as I can tell

What's the way to change the default monospace font of fontconfig?

Thanks!

Last edited by aardwolf (2021-12-26 23:39:37)

Offline

#4 2021-12-27 00:00:52

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,447
Website

Re: [solved] Monospace font made non-monospace by ligatures

aardwolf wrote:

I must say the wiki everything about font config is pretty confusing to me pretty much everyone.

Fixed that for you.

aardwolf wrote:

It says you shouldn't edit the central config file because fontconfig overwrites it, it lists personal config files but none of those exist on my system

Yes, you just create them yourself (or create symlinks to templates distributed with fontconfig).

You can explicitly set a default monospace font with a fontconfig excerpt (XML file) but you could also likely just fix this by installing a better monospace font.  You said your other arch system doesn't have this problem - so what's the difference in which fonts are installed?  If you don't have strong preferences for something in particular, ttf-dejavu will provide very good fonts as defaults including monospace that fontconfig will likely use before falling back to nimbus (i.e., I suspect it's using nimbus because no other more common monospace font is available).


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#5 2021-12-27 00:03:35

aardwolf
Member
From: Belgium
Registered: 2005-07-23
Posts: 304

Re: [solved] Monospace font made non-monospace by ligatures

Oh yes, ttf-dejavu did it! Installing that font immediately made fc-match monospace show the dejavu font, and that's indeed also a good set of fonts I use on the other Archlinux. That should fix this issue.

Before this I had even deleted all the symlinks with nimbus in the name from /etc/fonts/conf.d/ and fc-match was still returning nimbus.

But solved now, thanks!

Last edited by aardwolf (2021-12-27 00:05:34)

Offline

Board footer

Powered by FluxBB