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: Wed, 04 Dec 2019 18:12:39 +0200

> From: martin rudalics <address@hidden>
> Date: Tue, 3 Dec 2019 19:36:41 +0100
> 
> I just noticed that my implementation of 'window-default-font-height'
> is likely wrong.  The fault is all mine but I think that, in a sense,
> 'default-font-height', 'default-font-width', 'default-line-height' and
> 'face-font' are to blame as well.
> 
> In particular, the 'face-font' doc-string should tell that it returns
> a value for the current buffer if FRAME is nil or omitted and a value
> for FRAME if it is non-nil, disregarding the current buffer in that
> case entirely.  If that's the correct interpretation of that function.

That is not entirely correct.  When called with FRAME nil or omitted,
face-font returns the value for the selected frame.

> The other functions are IMO ill-specified for the case where the
> current buffer does not appear on the selected frame.  Using values
> returned by 'frame-parameter', 'frame-char-height' and
> 'frame-char-width' in that case can be misleading and present simple
> guesses at the best.
> 
> Personally, I would prefer two types of functions.  One for getting
> the default face font of a buffer alone (including remapping) and one
> for the default face font of a frame.  But I don't know enough about
> fonts, their remapping and their relationship to frames to tell what
> really makes sense here.

I don't think I understand what you need, or why.  There's no "face
for a buffer"; only face-remapping is buffer-local.  frame-char-height
take the value from the specified frame, not from a buffer.  It is
meaningless to ask about a font of a buffer without specifying the
frame on which it is, or will be, displayed.

You will see that functions which use the likes of default-font-height
are interested in the selected window on the selected frame.



reply via email to

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