all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tim Ruffing <crypto@timruffing.de>
To: Po Lu <luangruo@yahoo.com>, Eli Zaretskii <eliz@gnu.org>
Cc: 67810@debbugs.gnu.org
Subject: bug#67810: 29.1; fonts use synthetic bold on Linux / pgtk
Date: Thu, 14 Dec 2023 16:06:32 +0100	[thread overview]
Message-ID: <723b91276f83652bc6867f95630e1057c05ffb26.camel@timruffing.de> (raw)
In-Reply-To: <87h6klja8c.fsf@yahoo.com>


On Thu, 2023-12-14 at 13:19 +0200, Eli Zaretskii wrote:
> One can always insert an icon with the likes of
> 
>   (propertize "ICON" 'face '(:weight medium))

Sure, but do you think that's a proper solution to add this whenever
buffer contents change? What if the user visits a file with an icon? I
don't know enough about the internals of emacs, but this still seems
the wrong approach to me?  

On Thu, 2023-12-14 at 19:26 +0800, Po Lu wrote:
> The only existing variable which controls font display through
> matching
> fonts against a regexp has been effectively abandoned over the years,
> and is nonfunctional on all systems besides X and Android.
> (Grep for Vvertical_centering_font_regexp: only sfntfont.c and
> xfont.c
> consult it.)
> 
> A compelling reason for us _not_ to introduce more such variables, as
> they will soon fall into disuse and neglect.
> 
> 

Makes sense. But then I suspect a boolean toggle is equally bad, as it
would equally fall into disuse.

> Yes, and don't these packages require using their own specialized
> icon fonts to begin with?

Yes, packages like all-the-icons and nerd-icons do require specialized.
fonts. But I'm not sure what this implies. What do you suggest that
these packages do?

I mean, a crude hack is to make emacs believe that the specialized
fonts are already bold. But even this is not too easy. AFAIU, this
cannot be done in elisp (because font objects are not modifiable), so
the packages can't do this emacs.

What one can always do is to distribute patched font files. I could
install a patched font of the icon font that claims it's bold. But
that's also a rather crude hack.

But thanks to your explanation, I managed to come up with a different
workaround. The following effectively makes emacs believe that the
fonts are bold without the need to patch a font


  <!-- Make fontconfig believe that this is a bold font.
       This prevents emacs from applying overstriking when trying to
       render bold icons.
       See: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=67810

       Run `fc-cache -r` after making modifications here. -->
  <match target="scan">
    <test name="family" compare="contains">
      <string>Symbols Nerd Font</string>
    </test>
    <edit name="weight" mode="assign">
      <const>bold</const>
    </edit>
  </match>


That's still a bit crude due to the way emacs uses fontconfig. AFAIU
the way fontconfig typically is supposed to handle this is via
target="font" or target="match", i.e., the font is correctly parsed
into fontconfig's database but only when applications *query* for the
font, config tweaks apply and applications get a modified view, e.g.,
with weight=bold in this case. 

But this snippet here with target="scan" actually modifies the entry in
the fontconfig database because this is the only thing that works with
emacs. This is probably the same these two bugs:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25147 
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=17792 .






  reply	other threads:[~2023-12-14 15:06 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-13 12:03 bug#67810: 29.1; fonts use synthetic bold on Linux / pgtk Tim Ruffing
2023-12-13 12:39 ` Eli Zaretskii
2023-12-13 13:28   ` Tim Ruffing
2023-12-13 13:39     ` Eli Zaretskii
2023-12-13 15:09       ` Tim Ruffing
2023-12-13 15:43         ` Tim Ruffing
2023-12-14  0:09         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-14  7:28           ` Eli Zaretskii
2023-12-14  9:32             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-14  9:54             ` Tim Ruffing
2023-12-14 10:04               ` Eli Zaretskii
2023-12-14 10:37                 ` Tim Ruffing
2023-12-14 11:19                   ` Eli Zaretskii
2023-12-14 11:26                 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-14 15:06                   ` Tim Ruffing [this message]
2023-12-14 22:55                     ` Stefan Kangas
2024-01-11 15:50                       ` Tim Ruffing
2024-01-12  1:46                         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-12  8:37                           ` Eli Zaretskii
2024-01-12  9:59                             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-12 11:46                               ` Eli Zaretskii
2024-01-12 12:20                                 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-12 12:30                                   ` Eli Zaretskii
2024-01-12 13:12                                     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-12 14:12                                       ` Eli Zaretskii
2024-01-13  0:46                                         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-13  6:59                                           ` Eli Zaretskii
2024-01-14  1:02                                             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-14  6:24                                               ` Eli Zaretskii
2024-01-14  8:09                                                 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-14  9:33                                                   ` Eli Zaretskii
2024-01-14 13:44                                                     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-14 14:03                                                       ` Eli Zaretskii
2024-01-14 14:19                                                         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-14 14:55                                                           ` Eli Zaretskii
2024-01-15 13:11                                             ` Tim Ruffing
2024-01-13  6:37                           ` Stefan Kangas
2024-01-14  0:55                             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-14  5:23                               ` Stefan Kangas
2024-01-14 10:20                                 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-14 12:21                                   ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-14 14:10                                     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-14 16:37                                       ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-15  0:36                                         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-15 13:56                                           ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-15 14:02                                             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=723b91276f83652bc6867f95630e1057c05ffb26.camel@timruffing.de \
    --to=crypto@timruffing.de \
    --cc=67810@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=luangruo@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.