GNU bug report logs - #68042
30.0.50; `face-font' returns nil after adding remap relative for fontset

Previous Next

Package: emacs;

Reported by: Hanwen Guo <g.hanwen <at> outlook.com>

Date: Tue, 26 Dec 2023 16:57:02 UTC

Severity: normal

Tags: moreinfo, notabug

Found in version 30.0.50

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Hanwen Guo <g.hanwen <at> outlook.com>
Cc: 68042 <at> debbugs.gnu.org
Subject: Re: bug#68042: 30.0.50;
 `face-font' returns nil after adding remap relative for fontset
Date: Tue, 26 Dec 2023 19:49:09 +0200
tags 68042 notabug
thanks

> From: Hanwen Guo <g.hanwen <at> 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.




This bug report was last modified 1 year and 74 days ago.

Previous Next


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