Ligatures in monospaced fonts in Firefox

I'm using FreeBSD 14 with firefox-120.0_1,2 and the noto-2.0 meta package installed.

When browsing websites that contain monospaced passages (such as code examples), I encounter the problem that certain character sequences are replaced with ligatures (see attached image).

Of course, this is undesirable because it messes up alignment and columns (apart from being ugly).

Can other people reproduce this problem, and do you know which mechanism or which software component causes this? What can I do to stop it?
 

Attachments

  • ligatures-screenshot-marked.png
    ligatures-screenshot-marked.png
    216.5 KB · Views: 202
  • Like
Reactions: mro
I don't remember the post in the forums, but basically put this files here
/usr/local/etc/fonts/conf.avail/29-local-noto-mono-fixup.conf
Code:
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<fontconfig>
  <description>Disable ligatures for monospaced fonts to avoid ff, fi, ffi, etc. becoming only one character wide</description>
  <match target="font">
    <test name="family" compare="eq">
      <string>Noto Sans Mono</string>
    </test>
    <edit name="fontfeatures" mode="append">
      <string>liga off</string>
      <string>dlig off</string>
    </edit>
  </match>
</fontconfig>
And then go to /usr/local/etc/fonts/conf.d
and do as root: ln -s /usr/local/etc/fonts/conf.avail/29-local-noto-mono-fixup.conf
 
Thank you, that solved the issue instantly (I didn't even need to restart my webbrowser ?).

I'm still interested in the underlying issue though. What exactly is causing this problem? Isn't that a bug of some sort? Why would anyone want automatic ligatures in monospaced fonts? (I would even argue that automatic ligatures in general can be problematic, as they are language dependent, e.g. in German, see German Wikipedia on ligatures.)
 
My guess is it's a glitch in the "Noto Sans Mono" font, it doesn't seem to have the spacing=100 property used to mark monospace fonts:
Code:
$ fc-list :family=Noto\ Sans\ Mono family spacing
Noto Sans Mono
$ fc-list :spacing=mono family spacing
gallant12x22:spacing=100
Andale Mono:spacing=100
Luxi Mono:spacing=100
DejaVu Sans Mono:spacing=100
micro.pcf:spacing=100
Consolas Nerd Font:spacing=100
Hack:spacing=100
OCR A:spacing=100
deccurs.pcf:spacing=100
Courier 10 Pitch:spacing=100
decsess.pcf:spacing=100
Adobe Courier:spacing=100
Courier:spacing=100
B&H LucidaTypewriter:spacing=100
Consolas:spacing=100
cursor.pcf:spacing=100
Cursor:spacing=100
Courier New:spacing=100
So it might make sense auto-rendering of ligatures is enabled unless explicitly disabled. Well, just a theory.
 
Can you edit your subject line?
I'm not sure if I actually can. I don't see a button. Maybe I can't because I'm a new user to the forum?

To clarify that it's not monospaced fonts in general, and not specific to Firefox.
I still don't understand what exactly is the problem, or rather: where is the problem. According to sirias, it's a problem of the "Noto Sans Mono" font:
My guess is it's a glitch in the "Noto Sans Mono" font, it doesn't seem to have the spacing=100 property used to mark monospace fonts: […]
But if it's a problem of "Noto Sans Mono" font, how is this related to non-monospaced fonts? I don't understand.

Is the problem on the console the same problem?
 
It's mysterious :)

I don't see that extra "..." button next to "Unwatch". I only see "Jump to new" and "Unwatch".
 
But if it's a problem of "Noto Sans Mono" font, how is this related to non-monospaced fonts? I don't understand.
Huh? My assumption is that "Noto Sans Mono" is treated as if it was non-monospaced, because it doesn't have the spacing property used to mark monospace fonts. This assumes no renderer would ever automatically apply ligatures for monospaced fonts.

Is the problem on the console the same problem?
What problem on the console?
 
What problem on the console?
I meant one of the other linked threads. I think it actually were problems in the terminal, not the console.

My point is, I'm not really sure which component caused the issue in my case, and whether it only applies to the Noto monospaced fonts, or whether it's Firefox related or not.

I guess it's not a Firefox issue, but I don't really understand it yet. I only encountered the issue in Firefox so far.
 
which component caused the issue
it's the noto mono font. Whoever uses it as is gets wrong visuals. However, once you convince the consumers that it's a monospace font (by setting the appropriate flag in either the font file or via the additional meta data) the rendering is as should be.

The package maintainers may add a patch (to the package) and/or report upstream to wherever the noto mono font without the monospace flag comes from. They should know.
 
I'm still interested in the underlying issue though. What exactly is causing this problem? Isn't that a bug of some sort? Why would anyone want automatic ligatures in monospaced fonts? (I would even argue that automatic ligatures in general can be problematic, as they are language dependent, e.g. in German, see German Wikipedia on ligatures.)

There is no problem.
I first found the "spacemono" font can do this, so I chose to download that font for certain applications, e.g. my firewall configurator. If you happen to have an interface name with 'fl', well, have fun. :)

Apparently, now others had the same idea.

The idea was to break alignment and routine: as more and more people nowadays act like robots, to give them something unexpected to wake them up.
 
Back
Top