Subject: bug#71025: set-fontset-font doesn't show some scripts as glyphless characters

From: Eli Zaretskii <[email-masked]>
Date: Mon, 20 May 2024 21:02:23 +0300

> From: Rodrigo Morales <[email-masked]>
> CC: <[email-masked]>
> Date: Mon, 20 May 2024 11:49:21 -0500
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> > Do you have site-init files in your Emacs installation?  Or some
> > early-init file?  Maybe something other than the init file is
> > affecting this.  Otherwise, I have no idea why this doesn't work for
> > you, as it does for me.
> 
> load-history doesn't show other files in the ~/.config directory besides
> ~/.config/emacs/init.el. Here's how I found it out.
> 
> I used the same configuration file.
> 
> #+HEADER: :tangle ~/.config/emacs/init.el
> #+BEGIN_SRC elisp
> (set-fontset-font t 'brahmi nil)
> (set-fontset-font t 'egyptian nil)
> (set-fontset-font t 'ethiopic nil)
> (set-fontset-font t 'tagbanwa nil)
> (set-fontset-font t 'han nil)
> #+END_SRC
> 
> When Emacs GUI opened, I visited the file =/tmp/a.txt=. Brahmi and Egyptian Hieroglyphs were shown as hexadecimal codes. Amharic and Tagbanwa and Chinese were shown with other fonts. I used =describe-char= to find out which font those scripts were using.
> 
> Amharic: ftcrhb:-GOOG-Noto Sans Ethiopic-regular-normal-normal-*-12-*-*-*-*-0-iso10646-1 (#x2B)
> Tagbanwa: ftcrhb:-GOOG-Noto Sans Tagbanwa-regular-normal-normal-*-12-*-*-*-*-0-iso10646-1 (#x12)
> Chinese: ftcrhb:-GOOG-Noto Sans CJK KR-regular-normal-normal-*-12-*-*-*-*-0-iso10646-1 (#x2703)
> 
> #+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
> 
> I launched =emacs= and I pressed =C-h v load-history RET=. The content of the =*Help*= buffer can be found here: http://web.archive.org/web/20240520161841/http://0x0.st/XPww.txt . I searched =.config= inside the =*Help*= buffer and I only found one match: =/home/rodrigo/.config/emacs/init.el=, so I don't think there are other configuration files that are influencing this behavior.
> 
> > Or maybe your default font supports those scripts, in which case Emacs
> > will use it regardless of the fontset setup?  What happens if you
> > change the default font to something that doesn't support these scripts?
> 
> I changed the default font to =Cozette=.
> 
> #+HEADER: :tangle ~/.config/emacs/init.el
> #+BEGIN_SRC elisp
> (add-to-list 'default-frame-alist '(font . "Cozette"))
> (set-fontset-font t 'brahmi nil)
> (set-fontset-font t 'egyptian nil)
> (set-fontset-font t 'ethiopic nil)
> (set-fontset-font t 'tagbanwa nil)
> (set-fontset-font t 'han nil)
> #+END_SRC
> 
> When Emacs GUI opened, I visited the file =/tmp/a.txt=. Brahmi and Egyptian Hieroglyphs were shown as hexadecimal codes. Amharic and Tagbanwa and Chinese were shown with other fonts. I used =describe-char= to find out which font those scripts were using.
> 
> Amharic: ftcrhb:-GNU -Unifont Sample-regular-normal-normal-*-13-*-*-*-d-0-iso10646-1 (#x1221)
> Tagbanwa: ftcrhb:-GNU -Unifont Sample-regular-normal-normal-*-13-*-*-*-d-0-iso10646-1 (#x176C)
> Chinese: ftcrhb:-GNU -Unifont Sample-regular-normal-normal-*-13-*-*-*-d-0-iso10646-1 (#x4F5F)
> 
> Because Unifont was being used for those scripts, I decided to delete
> that font from my system just to see what happens. I removed
> =unifont-15.1.05.bdf= from the directory =~/.fonts= and executed
> =fc-cache -f=. I launched Emacs again and visited =/tmp/a.txt=. I used
> =describe-char= to find out the font that were using for those
> scripts.
> 
> Amharic: ftcrhb:-GOOG-Noto Sans Ethiopic-regular-normal-normal-*-13-*-*-*-*-0-iso10646-1 (#x2B)
> Tagbanwa: ftcrhb:-GOOG-Noto Sans Tagbanwa-regular-normal-normal-*-13-*-*-*-*-0-iso10646-1 (#x12)
> Chinese: ftcrhb:-GOOG-Noto Sans CJK KR-regular-normal-normal-*-13-*-*-*-*-0-iso10646-1 (#x2703)
> 
> Note that these fonts were the same used as when I didn't change the
> default font through =(add-to-list 'default-frame-alist '(font . "Cozette"))=.

I can only say that I can reproduce none of these strange behaviors.
I have no idea what happens on your system, sorry.