Solved terminal font messed up after updating packages for select characters

I updated my system on October 13 and my font is messed up for a few characters:

Code:
fi
fl


If I type ai or al, the problem doesn't occur, but for fi, or fl, it does.

It seems like a fixed-width font issue, but I'm not sure why or what would have changed just by updating my packages.


 
I am curious what is your font and your terminal ?
Having these details could encourage people with the same settings to join the discussion and help you.
 
I am unsure of the font, I don't believe I have any special settings anywhere for that. I am using kitty for my terminal.

On that note, if I use xfce4-terminal, there are no issues, it is just with kitty.
 
I am using kitty for my terminal.
Then check its config for font settings.

 
Yes, I checked that, I have only colors:

Code:
# https://github.com/dexpota/kitty-themes/blob/master/themes/Apprentice.conf
# Apprentice by Romain Lafourcade, https://github.com/romainl
# This work is licensed under the terms of the MIT license.
# For a copy, see https://opensource.org/licenses/MIT.

cursor     #c7c7c7
cursor_text_color #feffff
selection_foreground #3e3e3e
selection_background #c1ddff
foreground #c8c8c8
background #323232
color0     #252525
color8     #555555
color1     #be7472
color9     #ff9900
color2     #709772
color10    #97bb98
color3     #989772
color11    #fefdbc
color4     #7199bc
color12    #9fbdde
color5     #727399
color13    #989abc
color6     #719899
color14    #6fbbbc
color7     #7f7f7f
color15    #feffff

Removing the configuration altogether didn't make any difference in the font issue. It just changed the colors.
 
If you don't have a proper configuration file I am not sure of what you can expect from a highly configurable terminal like kitty.
Copy the one from the online doc into your kitty directory ~/.config/kitty/kitty.conf and start from there.
The freebsd port comes with the offline documentation installed on the system, so you can open the file in your browser and see what you can do with the fonts /usr/local/share/doc/kitty/conf.html#fonts .

IIRC kitty development is active, you can expect some changes from time to time, just check the changelog if you are not sure of what happened, that's what I do when I am a bit lost with a software when it gets funky.

Have fun :)

EDIT:
The config file actually is already available on the system with the rest of the doc, so you can just copy it directly with cp /usr/local/share/doc/kitty/_downloads/433dadebd0bf504f8b008985378086ce/kitty.conf ~/.config/kitty/
 
I see ligatures in the code blocks above - what makes no sense at all for monospace fonts. FreeBSD 13.2, Firefox here. But I won't investigate where they come from.
 
Accorrding to the x11/kitty website, the fonts "are derived automatically, by the OSes font system". kitty +list-fonts brings up a list and variants. The ligatures seem to be something from inside x11/kitty.

The combination indeed are ligatures -- one sign to combine two characters. Typing `f i` (without the space) you can see the two letters immediately flip together as fi (close together). In other terminal emulators this behaviour is not seen.

The other thing is that the `i` in the ligature is sans serif, whereas a sole `i` or in combinattion with another character makes a serif `i` with my Inconsolata (serif) terminal font.

The trailing space after the ligature indeed is a bit sloppy. The ligature takes two positions, but only uses one (that's the definition of a ligature). When you delete the space within the word, the `i` disappears and only the `f` stays.

x11-kitty_ligature_empty_space.png


Try with ligatures disabled, that should/could make a difference between fi and f i -- see the Kitty website or Arch manpage.

Further explanation of the use of ligatures in x11/kitty is here -- it's quite impressive, as long as ligature character codes don't mess things up! A one code ligature character may be interpreted different from a meant two separate character codes. Copying find <something> from kitty to shells/fish however gave no problems.

Using typographic features in a terminal emulator is something for debate.
 
Thanks for the information. That is way above my head in terms of the English language.

If I read that correctly: https://sw.kovidgoyal.net/kitty/conf/

I am supposed to update ~/.config/kitty/kitty.conf as follows:
Code:
disable_ligatures always

I tried that after I exited all my kitty windows and no dice.

I do think that is the right track and I also tried font_features -liga, but to no avail.

Yeah, as I said, I never knew the word ligature until this issue cropped up. It definitely isn't something I use everyday. As long as I can read the text quickly and easily without struggling, is my criteria.
 
Any chance your monospace font is "Noto Sans Mono"? Asking because of https://techhub.social/@zirias/111221578569456366

Also, system-wide workaround copied from this thread:
Code:
$ cat /usr/local/etc/fonts/conf.d/29-local-noto-mono-fixup.conf 
<?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>

While there, I also changed my system-wide default for which monospace font to use ? (you probably don't have the font I'm using here, but could pick another one)
Code:
$ cat /usr/local/etc/fonts/conf.d/99-local-default-monospace.conf 
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<fontconfig>
  <description>Configure the default monospace font</description>
  <match target="pattern">
    <test name="family" qual="any">
      <string>monospace</string>
    </test>
    <edit binding="strong" mode="prepend" name="family">
      <string>Consolas Nerd Font</string>
    </edit>
  </match>
</fontconfig>
 
Not being a type font specialist, but looking at that screen shot from Ed Maste, it indeed looks like a spacing issue. I don't know of any ligatures that are "composed" by space reduction only (referring to the "spacing" mentioned). Usually there is some merging of the components involved, wikipedia: Ligature (writing). Also, when dealing with Unicode, a ligature is referenced as one code point as I understand it.
 
Erichans A ligature certainly is a separate glyph in a font. Whether it has its own code point in some encoding is IMHO not that relevant here. The problem is, in a monospace font, every glyph has exactly the same width. So, a ligature just looks "compressed". I actually wonder why there are ligatures in monospace fonts at all... anyways, font renderers should not normally use them for monospace fonts, and discovering that the "Noto Sans Mono" font misses the property that identifies it as a monospace font, I think this might be the cause of the problem.
 
<?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>
That was the fix!

Thanks!
 
  • Like
Reactions: mro
I would like to disable ligatures system wide. Ideas?
Ligatures are something for printed text to make the print look better and better readable. Terminal emulators and text editors, and the tasks you perform with it, are not meant to use that kind of typgraphic things. They are designed to type commands and print output, nothing more. That is why a TTY can't do those things.

The visual eye candy might look nice at first glance, but comes with its limitations in an environment that isn't aimed at those things.

Visual better kerning of characters, ligatures, smart quotes, etc. can be triggered in an editor with the proper textproc/hs-pandoc or \LaTeX\ commands and tags, and only with proportional fonts. They are commands inside a plain text to make pre-print documents to be printed on paper or PDF.

It's the behaviour to the First Principle in the UNIX Philosophy: use the program it is designed for, and don't misuse or complicate programs by implementing or adding new 'features'.

System wide disablement of ligatures is between chair and keyboard following UNIX Philosophy.
 
Continuing from <https://forums.freebsd.org/threads/91211/>

Maybe relevant:


My view of <https://www.freebsd.org/releases/14.0R/relnotes/#upgrade> is ligature-free:

1701475355736.png


I did allow installation of x11-fonts/noto-basic, but refrain from using Noto Sans Mono where I don't like the current effect.

Currently preferred in applications such as Firefox: Victor Mono, x11-fonts/victor-mono-ttf.

YMMV, its italics can not please everyone.

No .conf file required.

Code:
% pkg info --list x11-fonts/noto-basic | grep -i mono
        /usr/local/share/fonts/noto/NotoSansMono-Bold.ttf
        /usr/local/share/fonts/noto/NotoSansMono-Regular.ttf
% file /usr/local/etc/fonts/conf.avail/29-local-noto-mono-fixup.conf
/usr/local/etc/fonts/conf.avail/29-local-noto-mono-fixup.conf: cannot open `/usr/local/etc/fonts/conf.avail/29-local-noto-mono-fixup.conf' (No such file or directory)
% pkg iinfo victor
victor-mono-ttf-1.5.4
%
 

Attachments

  • 1701475582396.png
    1701475582396.png
    33.4 KB · Views: 94
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:

From the issue in GitHub:

… ligatures such as f_i and f_l are nice, but it’s confusing to have them on by default in a monospace font. …

My limited understanding, <https://github.com/notofonts/latin-greek-cyrillic/issues/167>:
  • probably does relate to what's discussed here
  • might be only part of the picture.
(I found my way to 167 via a few other issues, most of which were closed. Readers can perform their own searches, at <https://github.com/notofonts/latin-greek-cyrillic/issues>.)

A bigger picture, this ligature in Thunderbird probably does not involve Noto Sans Mono:

1701510627089.png


… 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?
 
Currently preferred in applications such as Firefox: Victor Mono, x11-fonts/victor-mono-ttf.

YMMV, its italics can not please everyone.

No .conf file required.

I forgot, Victor Mono does use ligatures. kitty screenshot attached. <https://github.com/rubjo/victor-mono/issues/118> two years ago there was a one-off export without ligatures.

Now, I wonder why my Firefox preference for Victor Mono (pictured above) does not have the fi ligature in monospaced fi.

I checked with a clean (refreshed) Firefox profile. The ligature disappears immediately after I OK a change from monospace to Victor Mono.
 

Attachments

  • 1701511804395.png
    1701511804395.png
    112.2 KB · Views: 95
Back
Top