Subject: Re: bug#70993: set-fontset-font doesn't use specified font for some scripts

From: Eli Zaretskii <[email-masked]>
Date: Sat, 18 May 2024 11:05:24 +0300

> From: Rodrigo Morales <[email-masked]>
> CC: <[email-masked]>
> Date: Sat, 18 May 2024 01:17:33 -0500
> 
> Eli Zaretskii <[email-masked]> 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

Did you also make Cozette the default font?  If not, why not?  I
thought your intent was to use the same font for all the characters,
including ASCII?  Emacs will use the default font for any non-ASCII
characters that the default font supports, so if you want all of them
to use Cozette, you should start Emacs as "emacs -fn Cozette", or use
add-to-list to customize the 'font' parameter in default-frame-alist.