Bug 275758 - x11-fonts/noto-basic and x11-fonts/fontconfig together enable ligatures in "monospace" font
Summary: x11-fonts/noto-basic and x11-fonts/fontconfig together enable ligatures in "m...
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Stephen Hurd
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-14 08:18 UTC by Stephen Hurd
Modified: 2024-03-23 15:49 UTC (History)
11 users (show)

See Also:


Attachments
Local override for monospace (742 bytes, application/xml)
2023-12-14 08:18 UTC, Stephen Hurd
no flags Details
Disable ligatures for Noto Sans Mono (468 bytes, application/xml)
2023-12-15 00:52 UTC, Stephen Hurd
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stephen Hurd freebsd_committer freebsd_triage 2023-12-14 08:18:20 UTC
Created attachment 247041 [details]
Local override for monospace

The Noto Sans Mono has ligatures for fi, ffl, and a few others. When used for monospace text, these ligatures take a single space instead of the expected two (or three).

The first monospace font listed in /usr/local/etc/fonts/conf.d/60-latin.conf is Noto Sans Mono.

As a result, if both x11-fonts/noto-basic and x11-fonts/fontconfig are installed, programs that use fontconfig for monospace (at least by default irc/hexchat and devel/geany) will combine two characters into a single cell when a ligature is used.

This is highly distracting, and can mess up alignment.

My ideal solution would be for either x11-fonts/noto-basic to be patched to fix the ligatures, or x11-fonts/fontconfig be patched to move Noto Sans Mono to the bottom of the list instead of the top.  It seems unreasonable that if noto-basic is installed, all programs using monospace need to be configured to use a different font to actually get monospace behaviour.

Overriding this is not obvious for someone unfamiliar with fontconfig configuration.  I've attached my /usr/local/etc/fonts/local.conf file where I moved Noto Sans Mono to the bottom of the list.
Comment 1 Stephen Hurd freebsd_committer freebsd_triage 2023-12-14 08:28:42 UTC
Related bug which suggests it's been fixed (though a manual download of the font did not appear to be fixed)

https://github.com/notofonts/latin-greek-cyrillic/issues/329
Comment 2 Stephen Hurd freebsd_committer freebsd_triage 2023-12-14 08:31:53 UTC
FreeBSD forum thread:

https://forums.freebsd.org/threads/ligatures-in-monospaced-fonts-in-firefox.91211/
Comment 3 Stephen Hurd freebsd_committer freebsd_triage 2023-12-14 08:37:47 UTC
Another place it's been noted:
https://techhub.social/@zirias/111221578569456366
Comment 4 Stephen Hurd freebsd_committer freebsd_triage 2023-12-15 00:52:45 UTC
Created attachment 247050 [details]
Disable ligatures for Noto Sans Mono

This config is perhaps more suitable... it disables ligatures for Noto Sans Mono rather than changing the preference.
Comment 5 George Mitchell 2024-01-15 13:17:41 UTC
Thanks to all of you for the suggestions.  But here's an odd thing: I use XFCE4 and associated applications, and I observe this problem in Thunderbird and Mousepad -- but not Firefox and not xfce4-terminal.  So there is apparently some way for a clever program to render text in fixed width using Noto Mono but not magically replacing (for example) eff-ell with a ligature.

But by the same token, if I come across a text which uses the Unicode ligature code points, I would expect to see them rendered as ligatures (though it's hard to imagine "ffl" smooshed into one space).  So I don't want the fonts to (in effect) lose the ligature glyphs altogether.
Comment 6 George Mitchell 2024-01-15 17:52:14 UTC
Thanks to email from Bertrand Petit, I now understand the idea that the font itself (okay, it's really fontconfig) is an active player in the game.  Trying Stephen Hurd's 15 December attachment has given me my desired result!

For me, at least, having fontconfig do what it does with ligatures is a flagrant POLA violation.  Not that anyone cares.
Comment 7 Stephen Hurd freebsd_committer freebsd_triage 2024-01-16 04:09:17 UTC
I care!

But it really is the font itself at fault.  It's saying "If you're displaying these characters together, display them like this instead".  Fontconfig is simply doing exactly what the font is telling it to.

We can configure fontconfig to override what the font says, but a monospaced font should be monospaced in all cases, it should not be monospaced except when 'f' is followed by a letter that looks better with different kerning when proportionally spaced.

A "clever" program can just render each character separately, instead of rendering sequences.  This usually makes things look worse, but in this case, it "fixes" the problem.
Comment 8 Fernando Apesteguía freebsd_committer freebsd_triage 2024-01-16 08:02:34 UTC
Reporter is committer, assign accordingly.
Comment 9 Tijl Coosemans freebsd_committer freebsd_triage 2024-01-19 10:47:18 UTC
I've uploaded a patch for review at https://reviews.freebsd.org/D43509.  It includes an update of Noto Sans Mono that seems to fix this bug.
Comment 10 commit-hook freebsd_committer freebsd_triage 2024-03-23 13:46:30 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=3b128ff9f74b28ada2f475f0b816480b1550e5b8

commit 3b128ff9f74b28ada2f475f0b816480b1550e5b8
Author:     Tijl Coosemans <tijl@FreeBSD.org>
AuthorDate: 2024-01-18 13:18:03 +0000
Commit:     Tijl Coosemans <tijl@FreeBSD.org>
CommitDate: 2024-03-23 13:40:46 +0000

    x11-fonts/noto*: Restructure and update

    Split x11-fonts/noto-basic into separate ports so they can be updated
    separately.  Keep noto-basic as a metaport but replace dependencies on
    it with dependencies on individual fonts as needed.

    Adjust x11-fonts/noto-extra to resolve conflicts for now.  Individual
    fonts can be split from this port later.

    Let x11-fonts/noto-emoji install the monochrome Noto Emoji font and
    create a new port x11-fonts/noto-color-emoji for Noto Color Emoji.

    Add the new ports to x11-fonts/noto metaport and make Noto Sans and
    Noto Serif non-optional because script-specific fonts depend on them.

    Upstream does not provide useful tarballs so we create our own and host
    them on LOCAL.  The new ports have a "make noto-fetch" target that
    creates a tarball in DISTDIR.

    List of updates:

    Noto Color Emoji 2.042
    Noto Emoji 2.001
    Noto Sans 2.013
    Noto Sans Mono 2.014
    Noto Sans Symbols 2.003
    Noto Sans Symbols 2 2.008
    Noto Serif 2.013

    PR:             275758
    Differential Revision:  https://reviews.freebsd.org/D43509

 Mk/Uses/noto.mk (new)                         |  71 ++++++++++
 audio/fossmixer/Makefile                      |   6 +-
 benchmarks/ddosify/Makefile                   |   4 +-
 editors/cooledit/Makefile                     |   8 +-
 graphics/lux/Makefile                         |   3 +-
 multimedia/baka-mplayer/Makefile              |   4 +-
 textproc/ibus-typing-booster/pkg-message      |   2 +-
 www/chromium/Makefile                         |   6 +-
 www/iridium/Makefile                          |   5 +-
 www/ungoogled-chromium/Makefile               |   5 +-
 x11-fonts/Makefile                            |   6 +
 x11-fonts/google-fonts/Makefile               |  10 +-
 x11-fonts/noto-basic/Makefile                 |  38 ++----
 x11-fonts/noto-basic/distinfo (gone)          |   3 -
 x11-fonts/noto-basic/pkg-plist (gone)         |  12 --
 x11-fonts/noto-color-emoji/Makefile (new)     |  20 +++
 x11-fonts/noto-color-emoji/distinfo (new)     |   3 +
 x11-fonts/noto-color-emoji/pkg-descr (new)    |   2 +
 x11-fonts/noto-emoji/Makefile                 |  40 +++---
 x11-fonts/noto-emoji/distinfo                 |   6 +-
 x11-fonts/noto-emoji/pkg-descr                |  15 +--
 x11-fonts/noto-extra/Makefile                 |  28 ++--
 x11-fonts/noto-extra/pkg-plist                | 178 --------------------------
 x11-fonts/noto-sans-mono/Makefile (new)       |  51 ++++++++
 x11-fonts/noto-sans-mono/distinfo (new)       |   3 +
 x11-fonts/noto-sans-mono/pkg-descr (new)      |   5 +
 x11-fonts/noto-sans-symbols-2/Makefile (new)  |  17 +++
 x11-fonts/noto-sans-symbols-2/distinfo (new)  |   3 +
 x11-fonts/noto-sans-symbols-2/pkg-descr (new) |   3 +
 x11-fonts/noto-sans-symbols/Makefile (new)    |  25 ++++
 x11-fonts/noto-sans-symbols/distinfo (new)    |   3 +
 x11-fonts/noto-sans-symbols/pkg-descr (new)   |   3 +
 x11-fonts/noto-sans/Makefile (new)            |  87 +++++++++++++
 x11-fonts/noto-sans/distinfo (new)            |   3 +
 x11-fonts/noto-sans/pkg-descr (new)           |   4 +
 x11-fonts/noto-serif/Makefile (new)           |  87 +++++++++++++
 x11-fonts/noto-serif/distinfo (new)           |   3 +
 x11-fonts/noto-serif/pkg-descr (new)          |   4 +
 x11-fonts/noto/Makefile                       |  22 +++-
 x11/plasma5-plasma-integration/Makefile       |   5 +-
 x11/plasma6-plasma-desktop/Makefile           |   3 +-
 x11/plasma6-plasma-integration/Makefile       |   7 +-
 42 files changed, 504 insertions(+), 309 deletions(-)
Comment 11 Tijl Coosemans freebsd_committer freebsd_triage 2024-03-23 14:06:14 UTC
Does the new x11-fonts/noto-sans-mono port fix all the problems?
Comment 12 Nuno Teixeira freebsd_committer freebsd_triage 2024-03-23 15:24:05 UTC
Can't understand the revert of this...
https://cgit.freebsd.org/ports/commit/?id=28472e9722d808739a4d690f6d803a2b1b8f5f98
Comment 13 Po-Chuan Hsieh freebsd_committer freebsd_triage 2024-03-23 15:37:12 UTC
(In reply to Nuno Teixeira from comment #12)

I hanve a bunch of noto* updates. It should be handled in ports 7f02f530584906729308bbd0d051866fdfc22e71 and ports 85e59e9b7f648a2a922710153d5d25cf55ccf0b4.
Comment 14 Gleb Popov freebsd_committer freebsd_triage 2024-03-23 15:49:14 UTC
(In reply to Po-Chuan Hsieh from comment #13)

Are your changes superior to Tijl's ones in the technical aspect? Or did you just choose your variant because it is yours?

You see, Tijl created the Phab diff on January 19 and you never left any comments on it. He lost his time working on this and now you silently dismissed his work. And since both you and Tijl are equal committers, does that means that he can also just revert your changes and reapply his?

I also have a feeling that you updated Noto ports some time ago and was just holding on to your changes to land them in a giant batch. The problem may not have even been arised if you pushed your changes more often.