emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What is a default font?


From: Eli Zaretskii
Subject: Re: What is a default font?
Date: Sat, 07 Dec 2019 12:24:57 +0200

> Cc: address@hidden, address@hidden
> From: martin rudalics <address@hidden>
> Date: Sat, 7 Dec 2019 10:39:00 +0100
> 
>  >>      (not (string-equal (frame-parameter frame 'font) default-font)))
>  >>         (aref (font-info default-font frame) 3))
>  >
>  > Not sure I get the logic here: you use default-font if the frame's
>  > font is NOT the default-font?
> 
> I simply reused the specification from 'default-font-height' here with
> FRAME specifying some frame, not necessarily the selected one.
> 
>          ;; Avoid calling font-info if the frame's default font was
>          ;; not changed since the frame was created.  That's because
>          ;; font-info is expensive for some fonts, see bug #14838.
>          (not (string= (frame-parameter nil 'font) default-font)))
>        (aref (font-info default-font) 3))

Please also "reuse" the comment there.  Assuming the function you are
working on is likely to be used frequently and from places that need
to work fast, that is, since this is just an optimization.

>  > The commentary at the beginning of xfaces.c says:
>  >
>  >     There is also a global face alist `Vface_new_frame_defaults'.  Face
>  >     definitions from this list are used to initialize faces of newly
>  >     created frames.
>  >
>  > If this is unclear, please ask more specific questions.
> 
> This variable has 258 x 21 elements all of them unspecified starting
> like this here:

Right, that's what happens by default.

> So the specific question I ask is whether it makes sense to maintain
> such a large variable that apparently never provides anything useful.

It does provide some useful things:

 . It provides the list of faces to be created for each new frame.
 . If any Lisp calls internal-set-lisp-face-attribute with the 4th argument
   t, the corresponding attribute will be set in this list, thus
   providing a non-unspecified value for new frames.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]