all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Hanwen Guo <g.hanwen@outlook.com>
Cc: 68042@debbugs.gnu.org
Subject: bug#68042: 30.0.50; `face-font' returns nil after adding remap relative for fontset
Date: Tue, 26 Dec 2023 19:49:09 +0200	[thread overview]
Message-ID: <83zfxw97my.fsf@gnu.org> (raw)
In-Reply-To: <ME3P282MB150507B0F2C5762C9BC5E78E9498A@ME3P282MB1505.AUSP282.PROD.OUTLOOK.COM> (message from Hanwen Guo on Tue, 26 Dec 2023 11:47:22 +0000)

tags 68042 notabug
thanks

> From: Hanwen Guo <g.hanwen@outlook.com>
> Date: Tue, 26 Dec 2023 11:47:22 +0000
> msip_labels: 
> 
> Providing the `:fontset' or `:font' face attribute in the `SPEC'
> argument of `face-remap-add-relative' with `FACE' argument being
> `'default' will make the `face-font' function return nil.
> 
> The following Emacs Lisp code can reproduce this behavior under 'emacs
> -Q'.
> 
> (create-fontset-from-fontset-spec
>  (font-xlfd-name
>   (font-spec :family "Source Serif"
>              :registry "fontset-variable pitch regular")))
> 
> (set-face-attribute 'variable-pitch nil
>                     :family "Source Serif"
>                     :fontset "fontset-variable pitch regular")
> 
> (let ((var-pitch (face-attribute 'variable-pitch :family))
>       (var-fontset (face-attribute 'variable-pitch :fontset)))
>   (setq mixed-pitch-variable-cookie
>         (face-remap-add-relative 'default :family var-pitch :fontset var-fontset)))
> 
> (face-font 'default) ;; nil
> 
> (face-remap-remove-relative mixed-pitch-variable-cookie)
> 
> (face-font 'default) ;; non-nil

Don't use :fontset as a face attribute; use :font instead.  The value
of :font can be a fontset, so you don't need to use the (obsolete and
not really supported) :fontset attribute.  The doc string of
set-face-attribute documents :font, not :fontset, and that is not an
accident.

If you replace all instances of :fontset above with :font, fac-font
will not return nil.

This is not a bug.





  reply	other threads:[~2023-12-26 17:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-26 11:47 bug#68042: 30.0.50; `face-font' returns nil after adding remap relative for fontset Hanwen Guo
2023-12-26 17:49 ` Eli Zaretskii [this message]
2023-12-27  6:43   ` Hanwen Guo
2023-12-27 13:30     ` Eli Zaretskii
2024-06-09 20:56       ` Stefan Kangas

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=83zfxw97my.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=68042@debbugs.gnu.org \
    --cc=g.hanwen@outlook.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.