GNU bug report logs -
#70993
set-fontset-font doesn't use specified font for some scripts
Previous Next
Reported by: Rodrigo Morales <me <at> rodrigomorales.site>
Date: Fri, 17 May 2024 03:32:02 UTC
Severity: normal
Tags: moreinfo
Done: Stefan Kangas <stefankangas <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #17 received at 70993 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
> In any case, it sounds like Emacs rejects the Cozette font for some
> scripts. Why that happens, I don't know, sorry. Can you set font-log
> to nil before you visit your a.txt file, and then post the value of
> font-log after the file is displayed? That could perhaps tell us
> something about the cause of this behavior.
I performed two experiments. I emptied ~/.config/emacs/init.el and
inserted the sexps showed in the first code block below. The content of
=/tmp/a.txt= is shown in the second code block below.
#+HEADER: :tangle ~/.config/emacs/init.el
#+BEGIN_SRC elisp
(set-fontset-font t 'brahmi (font-spec :family "Cozette"))
(set-fontset-font t 'egyptian (font-spec :family "Cozette"))
(set-fontset-font t 'ethiopic (font-spec :family "Cozette"))
(set-fontset-font t 'tagbanwa (font-spec :family "Cozette"))
(set-fontset-font t 'han (font-spec :family "Cozette"))
#+END_SRC
#+HEADER: :tangle /tmp/a.txt
#+BEGIN_SRC text
The following lines were retrieved from the HELLO buffer which is
opened by calling view-hello-file in GNU Emacs 29.3.
Brahmi (๐ฉ๐๐ญ๐ธ๐ณ๐๐ซ๐ป) ๐ฆ๐ซ๐ฒ๐๐ข๐
Egyptian Hieroglyphs (๐๐ค๐๐๐
โ๐๐) ๐
๐ต๐๐ช, ๐๐๐ป๐๐
Amharic (แ แแญแ) แ แแ
Tagbanwa (แฆแชแฏ) แซแฉแฌแฅ แฃแฎแงแฏ
Chinese (ไธญๆ,ๆฎ้่ฏ,ๆฑ่ฏญ) ไฝ ๅฅฝ
#+END_SRC
1. I launched =emacs= without the =-Q= flag so that
=~/.config/emacs/init.el= is read. Then, I evaluated =(setq
font-log nil)=. Then, I evaluated =(find-file
"/tmp/a.txt")=. Brahmi and Egyptian Hieroglyphs were shown as
hexadecimal codes inside boxes. Amharic, Tagbanwa and Chinese
characters were shown using other fonts. Then, I evaluated
=(describe-variable 'font-log)=. The content of the =*Help*= buffer
can be found here:
http://web.archive.org/web/20240518060947/http://0x0.st/XPqh.txt
2. I launched =EMACS_FONT_LOG=1 emacs= without the =-Q= flag so that
=~/.config/emacs/init.el= is read. Then, I evaluated =(find-file
"/tmp/a.txt")=. Brahmi and Egyptian Hieroglyphs were shown as
hexadecimal codes inside boxes. Amharic, Tagbanwa and Chinese
characters were shown using other fonts. Then, I evaluated
=(describe-variable 'font-log)=. The content of the =*Help*= buffer
can be found here:
http://web.archive.org/web/20240518061129/http://0x0.st/XPq7.txt
> In general, the Emacs font search and the related features are
> designed to find good fonts for displaying each character, whereas you
> are trying to do the opposite: force Emacs to choose a font that can
> NOT display characters. The doc string of set-fontset-font explains
> how to set up a fontset so that certain characters have no font: use
> nil for the FONT-SPEC argument. So if you want Amharic and Chinese
> characters to display as glyphless characters, use this:
>
> (set-fontset-font t 'han nil)
> (set-fontset-font t 'ethiopic nil)
I tried what you suggested. However, this didn't make Amharic and
Chinese characters to be shown as glyphless characters. See bug#71025.
> This is indeed a limitation for someone who modifies the fontsets a
> lot during a session, but unless someone submits patches to lift it,
> it will remain a limitation, sorry.
No problem. I will work on a patch when time allows. My initial thought
was that Emacs mantainers assumed that most users don't need to call
set-fontset-font in the middle of an Emacs session, so any user that
tries to do this shouldn't be taken into consideration and those users
need to adapt themselves to that constraint, this way of thinking goes
against the goal of Emacs of being a customizable text editor. However,
your last message proved my initial thoughts wrong.
This bug report was last modified 81 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.