GNU bug report logs - #73777
set-fontset-font doesn't set :size for specific characters when using some fonts

Previous Next

Package: emacs;

Reported by: Rodrigo Morales <rodrigo-mailing-lists <at> morales.pe>

Date: Sat, 12 Oct 2024 19:12:01 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 73777 in the body.
You can then email your comments to 73777 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#73777; Package emacs. (Sat, 12 Oct 2024 19:12:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Rodrigo Morales <rodrigo-mailing-lists <at> morales.pe>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 12 Oct 2024 19:12:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Rodrigo Morales <rodrigo-mailing-lists <at> morales.pe>
To: <bug-gnu-emacs <at> gnu.org>
Subject: set-fontset-font doesn't set :size for specific characters when
 using some fonts
Date: Sat, 12 Oct 2024 14:10:25 -0500
I am using GNU Emacs 29.4 in Ubuntu 22.04.5 LTS.

Today, I was trying to change the font size for the character =“= (#x201C, LEFT DOUBLE QUOTATION MARK) using the sexp shown below. I noticed an inconsistency: that sexp only sets the size for the character =“= when specific fonts are used.

#+BEGIN_SRC elisp
(set-fontset-font t ?“ (font-spec :family "Noto Sans Mono" :size 50))
#+END_SRC

In the section below, I describe minimal reproducible experiments. In the experiments, I use the file =/tmp/a.txt= containing the contents of the code block below:

#+HEADER: :tangle /tmp/a.txt
#+BEGIN_SRC text
a “ b
#+END_SRC

** Experiment 1 (:size for #x201C is not set): Set :size for #x201C

I started Emacs using the command shown below:

#+HEADER: :eval no
#+BEGIN_SRC sh
./src/emacs -Q /tmp/a.txt
#+END_SRC

The code block below shows the font reported for each character by calling =what-cursor-position= with a prefix argument. Screenshot: https://archive.is/9LxOH

#+BEGIN_SRC text
a: ftcrhb:-GOOG-Noto Sans Mono-regular-normal-normal-*-16-*-*-*-*-0-iso10646-1 (#x44)
“: ftcrhb:-GOOG-Noto Sans Mono-regular-normal-normal-*-16-*-*-*-*-0-iso10646-1 (#x209)
b: ftcrhb:-GOOG-Noto Sans Mono-regular-normal-normal-*-16-*-*-*-*-0-iso10646-1 (#x45)
#+END_SRC

Then, I evaluated the sexp shown below. Upon evaluating it, the size of the character “ (#x201C, LEFT DOUBLE QUOTATION MARK) didn't seem to increase. The second code block below shows the font reported for each character by calling =what-cursor-position= with a prefix argument. Screenshot: https://archive.ph/rVZSt

#+begin_src elisp
(set-fontset-font t ?“ (font-spec :family "Noto Sans Mono" :size 50))
#+end_src

#+BEGIN_SRC text
a: ftcrhb:-GOOG-Noto Sans Mono-regular-normal-normal-*-16-*-*-*-*-0-iso10646-1 (#x44)
“: ftcrhb:-GOOG-Noto Sans Mono-regular-normal-normal-*-16-*-*-*-*-0-iso10646-1 (#x209)
b: ftcrhb:-GOOG-Noto Sans Mono-regular-normal-normal-*-16-*-*-*-*-0-iso10646-1 (#x45)
#+END_SRC

** Experiment 2 (:size for #x201C is not set): Pass "Noto Sans Mono 10" to set-frame-font, then set :size for #x201C

I started Emacs using the command shown below:

#+HEADER: :eval no
#+BEGIN_SRC sh
./src/emacs -Q /tmp/a.txt
#+END_SRC

First, I evaluated the sexp shown in the first code block below. The second code block below shows the font reported for each character by calling =what-cursor-position= with a prefix argument. Screenshot: https://archive.ph/PVc8q

#+begin_src elisp
(set-frame-font "Noto Sans Mono 10" nil t)
#+end_src

#+BEGIN_SRC text
a: ftcrhb:-GOOG-Noto Sans Mono-regular-normal-normal-*-15-*-*-*-*-0-iso10646-1 (#x44)
“: ftcrhb:-GOOG-Noto Sans Mono-regular-normal-normal-*-15-*-*-*-*-0-iso10646-1 (#x209)
b: ftcrhb:-GOOG-Noto Sans Mono-regular-normal-normal-*-15-*-*-*-*-0-iso10646-1 (#x45)
#+END_SRC

Then, I evaluated the sexp shown below. Upon evaluating it, the size of the character “ (#x201C, LEFT DOUBLE QUOTATION MARK) didn't seem to increase. The second code block below shows the font reported for each character by calling =what-cursor-position= with a prefix argument. Screenshot: https://archive.is/AIuP0

#+begin_src elisp
(set-fontset-font t ?“ (font-spec :family "Noto Sans Mono" :size 50))
#+end_src

#+BEGIN_SRC text
a: ftcrhb:-GOOG-Noto Sans Mono-regular-normal-normal-*-15-*-*-*-*-0-iso10646-1 (#x44)
“: ftcrhb:-GOOG-Noto Sans Mono-regular-normal-normal-*-15-*-*-*-*-0-iso10646-1 (#x209)
b: ftcrhb:-GOOG-Noto Sans Mono-regular-normal-normal-*-15-*-*-*-*-0-iso10646-1 (#x45)
#+END_SRC

** Experiment 3 (:size for #x201C is set): Pass "Fixed 5" to set-frame-font, then set :family and :size for #x201C

I started Emacs using the command shown below:

#+HEADER: :eval no
#+BEGIN_SRC sh
./src/emacs -Q /tmp/a.txt
#+END_SRC

First, I evaluated the sexp shown in the first code block below. The second code block below shows the font reported for each character by calling =what-cursor-position= with a prefix argument. Screenshot: https://archive.is/v4Sr9

#+begin_src elisp
(set-frame-font "Fixed 5" nil t)
#+end_src

#+BEGIN_SRC text
a: ftcrhb:-Misc-Fixed-regular-normal-normal-*-7-*-*-*-c-50-iso10646-1 (#x62)
“: ftcrhb:-Misc-Fixed-medium-normal-normal-ja-13-*-*-*-c-120-iso10646-1 (#x3A3)
b: ftcrhb:-Misc-Fixed-regular-normal-normal-*-7-*-*-*-c-50-iso10646-1 (#x63)
#+END_SRC

Then, I evaluated the sexp shown below. Upon evaluating it, the size of the character “ (#x201C, LEFT DOUBLE QUOTATION MARK) significantly increased. The second code block below shows the font reported for each character by calling =what-cursor-position= with a prefix argument. Screenshot: https://archive.is/KYRGd

#+begin_src elisp
(set-fontset-font t ?“ (font-spec :family "Noto Sans Mono" :size 50))
#+end_src

#+BEGIN_SRC text
a: ftcrhb:-Misc-Fixed-regular-normal-normal-*-7-*-*-*-c-50-iso10646-1 (#x62)
“: ftcrhb:-GOOG-Noto Sans Mono-regular-normal-normal-*-50-*-*-*-*-0-iso10646-1 (#x209)
b: ftcrhb:-Misc-Fixed-regular-normal-normal-*-7-*-*-*-c-50-iso10646-1 (#x63)
#+END_SRC

** Conclusion

When the default font is not changed (see experiment 1) or is set using =(set-frame-font "Noto Sans Mono 10" nil t)= (see experiment 2), the sexp =(set-fontset-font t ?“ (font-spec :family "Noto Sans Mono" :size 50))= didn't seem to increase the size of the character “ (#x201C, LEFT DOUBLE QUOTATION MARK).

When the default font is set using =(set-frame-font "Fixed 5" nil t)= (see experiment 3), the sexp =(set-fontset-font t ?“ (font-spec :family "Noto Sans Mono" :size 50))= significantly increased the size of the character “ (#x201C, LEFT DOUBLE QUOTATION MARK).

To me, the expected behavior is that =(set-fontset-font t ?“ (font-spec :family "Noto Sans Mono" :size 50))= sets =:family= and =:size= for “ (#x201C, LEFT DOUBLE QUOTATION MARK) regardless of the font that is being used.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#73777; Package emacs. (Fri, 18 Oct 2024 06:29:01 GMT) Full text and rfc822 format available.

Message #8 received at 73777 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Rodrigo Morales <rodrigo-mailing-lists <at> morales.pe>
Cc: 73777 <at> debbugs.gnu.org
Subject: Re: bug#73777: set-fontset-font doesn't set :size for specific
 characters when using some fonts
Date: Fri, 18 Oct 2024 09:27:36 +0300
> From: Rodrigo Morales <rodrigo-mailing-lists <at> morales.pe>
> Date: Sat, 12 Oct 2024 14:10:25 -0500
> 
> 
> I am using GNU Emacs 29.4 in Ubuntu 22.04.5 LTS.
> 
> Today, I was trying to change the font size for the character =“= (#x201C, LEFT DOUBLE QUOTATION MARK) using the sexp shown below. I noticed an inconsistency: that sexp only sets the size for the character =“= when specific fonts are used.
> 
> #+BEGIN_SRC elisp
> (set-fontset-font t ?“ (font-spec :family "Noto Sans Mono" :size 50))
> #+END_SRC

Before I start digging into how we handle :size in a fontset, I have
two questions:

 . did you reset use-default-font-for-symbols to nil? without that,
   Emacs prefers to use the default face's font for punctuation and
   symbols, effectively disregarding the fontsets
 . which fonts did you find problematic in this case? you say
   "specific fonts", but it is not clear which fonts exhibit this
   behavior

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#73777; Package emacs. (Sat, 19 Oct 2024 00:57:02 GMT) Full text and rfc822 format available.

Message #11 received at 73777 <at> debbugs.gnu.org (full text, mbox):

From: Rodrigo Morales <rodrigo-mailing-lists <at> morales.pe>
To: Eli Zaretskii <eliz <at> gnu.org>, Rodrigo Morales
 <rodrigo-mailing-lists <at> morales.pe>
Cc: 73777 <at> debbugs.gnu.org
Subject: Re: bug#73777: set-fontset-font doesn't set :size for specific
 characters when using some fonts
Date: Fri, 18 Oct 2024 19:55:39 -0500
>  . did you reset use-default-font-for-symbols to nil? without that,
>    Emacs prefers to use the default face's font for punctuation and
>    symbols, effectively disregarding the fontsets

No. I didn't know that the variable use-default-font-for-symbols existed
when I wrote that message. Now that I know of its existence, I believe
that Emacs behaves consistently with regards to what I mentioned in my
first message.

>  . which fonts did you find problematic in this case? you say
>    "specific fonts", but it is not clear which fonts exhibit this
>    behavior

I thought that the font which was problematic was "Noto Sans Mono"
because when I used that font (in "Experiment 1" and "Experiment 2"), I
could not increase the size of the character “ (#x201C, LEFT DOUBLE
QUOTATION MARK) by evaluating (set-fontset-font t ?“ (font-spec :family
"Noto Sans Mono" :size 50)), . However, when I used "Fixed 5" (in
"Experiment 3"), evaluating (set-fontset-font t ?“ (font-spec :family
"Noto Sans Mono" :size 50)) did increase the size of the character
(#x201C, LEFT DOUBLE QUOTATION MARK).

Now that I know that the variable use-default-font-for-symbols controls
whether Emacs should honor fontsets, I don't think there's a problematic
font, instead it was my fault for not correctly knowing the variable
that instruct Emacs that it shoud honor fontsets.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#73777; Package emacs. (Sat, 19 Oct 2024 06:38:01 GMT) Full text and rfc822 format available.

Message #14 received at 73777 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Rodrigo Morales <rodrigo-mailing-lists <at> morales.pe>
Cc: 73777 <at> debbugs.gnu.org
Subject: Re: bug#73777: set-fontset-font doesn't set :size for specific
 characters when using some fonts
Date: Sat, 19 Oct 2024 09:36:51 +0300
> From: Rodrigo Morales <rodrigo-mailing-lists <at> morales.pe>
> CC: <73777 <at> debbugs.gnu.org>
> Date: Fri, 18 Oct 2024 19:55:39 -0500
> 
> >  . did you reset use-default-font-for-symbols to nil? without that,
> >    Emacs prefers to use the default face's font for punctuation and
> >    symbols, effectively disregarding the fontsets
> 
> No. I didn't know that the variable use-default-font-for-symbols existed
> when I wrote that message. Now that I know of its existence, I believe
> that Emacs behaves consistently with regards to what I mentioned in my
> first message.
> 
> >  . which fonts did you find problematic in this case? you say
> >    "specific fonts", but it is not clear which fonts exhibit this
> >    behavior
> 
> I thought that the font which was problematic was "Noto Sans Mono"
> because when I used that font (in "Experiment 1" and "Experiment 2"), I
> could not increase the size of the character “ (#x201C, LEFT DOUBLE
> QUOTATION MARK) by evaluating (set-fontset-font t ?“ (font-spec :family
> "Noto Sans Mono" :size 50)), . However, when I used "Fixed 5" (in
> "Experiment 3"), evaluating (set-fontset-font t ?“ (font-spec :family
> "Noto Sans Mono" :size 50)) did increase the size of the character
> (#x201C, LEFT DOUBLE QUOTATION MARK).
> 
> Now that I know that the variable use-default-font-for-symbols controls
> whether Emacs should honor fontsets, I don't think there's a problematic
> font, instead it was my fault for not correctly knowing the variable
> that instruct Emacs that it shoud honor fontsets.

It's an obscure variable, not mentioned in any manuals (because we
don't believe someone will want to specify a separate font for
punctuation characters).  It's a little wonder you didn't know about
it.

So does this mean we can now close this bug?  Or are there any
left-overs we still need to handle?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#73777; Package emacs. (Sat, 19 Oct 2024 16:18:02 GMT) Full text and rfc822 format available.

Message #17 received at 73777 <at> debbugs.gnu.org (full text, mbox):

From: Rodrigo Morales <rodrigo-mailing-lists <at> morales.pe>
To: Eli Zaretskii <eliz <at> gnu.org>, Rodrigo Morales
 <rodrigo-mailing-lists <at> morales.pe>
Cc: 73777 <at> debbugs.gnu.org
Subject: Re: bug#73777: set-fontset-font doesn't set :size for specific
 characters when using some fonts
Date: Sat, 19 Oct 2024 11:17:22 -0500
Eli Zaretskii <eliz <at> gnu.org> writes:

> So does this mean we can now close this bug?  Or are there any
> left-overs we still need to handle?

We can close this bug.




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sat, 19 Oct 2024 16:20:03 GMT) Full text and rfc822 format available.

Notification sent to Rodrigo Morales <rodrigo-mailing-lists <at> morales.pe>:
bug acknowledged by developer. (Sat, 19 Oct 2024 16:20:03 GMT) Full text and rfc822 format available.

Message #22 received at 73777-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Rodrigo Morales <rodrigo-mailing-lists <at> morales.pe>
Cc: 73777-done <at> debbugs.gnu.org
Subject: Re: bug#73777: set-fontset-font doesn't set :size for specific
 characters when using some fonts
Date: Sat, 19 Oct 2024 19:19:05 +0300
> From: Rodrigo Morales <rodrigo-mailing-lists <at> morales.pe>
> CC: <73777 <at> debbugs.gnu.org>
> Date: Sat, 19 Oct 2024 11:17:22 -0500
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > So does this mean we can now close this bug?  Or are there any
> > left-overs we still need to handle?
> 
> We can close this bug.

Thanks, closing.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#73777; Package emacs. (Mon, 21 Oct 2024 09:50:02 GMT) Full text and rfc822 format available.

Message #25 received at 73777 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 73777 <at> debbugs.gnu.org, Rodrigo Morales <rodrigo-mailing-lists <at> morales.pe>
Subject: Re: bug#73777: set-fontset-font doesn't set :size for specific
 characters when using some fonts
Date: Mon, 21 Oct 2024 11:47:56 +0200
>>>>> On Sat, 19 Oct 2024 09:36:51 +0300, Eli Zaretskii <eliz <at> gnu.org> said:
    >> 
    >> Now that I know that the variable use-default-font-for-symbols controls
    >> whether Emacs should honor fontsets, I don't think there's a problematic
    >> font, instead it was my fault for not correctly knowing the variable
    >> that instruct Emacs that it shoud honor fontsets.

    Eli> It's an obscure variable, not mentioned in any manuals (because we
    Eli> don't believe someone will want to specify a separate font for
    Eli> punctuation characters).  It's a little wonder you didn't know about
    Eli> it.

Itʼs in the docstring for `set-fontset-font' and in the manuals as of
emacs-30.

Robert
-- 




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 18 Nov 2024 12:24:13 GMT) Full text and rfc822 format available.

This bug report was last modified 214 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.