unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Eli Zaretskii <eliz@gnu.org>
Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org
Subject: Re: What is a default font?
Date: Fri, 6 Dec 2019 09:35:46 +0100	[thread overview]
Message-ID: <d4070166-2e1f-ba1f-0a16-fe8c9c148e8f@gmx.at> (raw)
In-Reply-To: <83tv6eh9fv.fsf@gnu.org>

I intend to rewrite 'window-default-font-height' as

(defun window-default-font-height (&optional window buffer)
   "Return height in pixels of BUFFER's default face font in WINDOW.
WINDOW must be a valid window and defaults to the selected one.
If BUFFER is a live buffer, it stands for itself.  Any other
value means to use WINDOW's buffer.  If neither WINDOW nor BUFFER
are live, signal an error.

The return value accounts for any remapping of the default face
font (see `face-remapping-alist') in BUFFER.  If no such
remapping has been specified for BUFFER, return the height of the
default face font for WINDOW's frame.

Note that if WINDOW specifes a live window and BUFFER specifies a
buffer different from the one currently shown in WINDOW, the
return value is calculated by pretending that BUFFER is displayed
in WINDOW."
   (let* ((window (window-normalize-window window))
          (frame (window-frame window))
          (buffer
           (cond
            ((buffer-live-p buffer) buffer)
            ((window-live-p window) (window-buffer window))
            (t (error "No live window and buffer specified"))))
          (default-font
            (if (window-live-p window)
                (with-selected-window window
                  (with-current-buffer buffer
                    (face-font 'default frame)))
              (with-selected-frame frame
                (with-current-buffer buffer
                  (face-font 'default frame))))))
     (cond
      ((not default-font)
       (frame-char-height frame))
      ((and (display-multi-font-p (frame-parameter frame 'display))
	   (not (string-equal (frame-parameter frame 'font) default-font)))
       (aref (font-info default-font frame) 3))
      (t
       (frame-char-height frame)))))

If you think that my interpretation is correct, the doc-string of
'face-font' could maybe tell something similar.

And I'd still like to know what 'face-new-frame-defaults' is really
used for.

martin



  reply	other threads:[~2019-12-06  8:35 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-03 18:36 What is a default font? martin rudalics
2019-12-04 16:12 ` Eli Zaretskii
2019-12-04 18:04   ` martin rudalics
2019-12-04 19:38     ` Štěpán Němec
2019-12-05  7:50       ` martin rudalics
2019-12-05 15:03       ` Eli Zaretskii
2019-12-04 21:21     ` Stefan Monnier
2019-12-05 17:54       ` martin rudalics
2019-12-05 18:04         ` Eli Zaretskii
2019-12-05 18:24           ` martin rudalics
2019-12-05 18:51             ` Eli Zaretskii
2019-12-05 18:59               ` martin rudalics
2019-12-05 19:13                 ` Eli Zaretskii
2019-12-06  8:35                   ` martin rudalics [this message]
2019-12-06 15:14                     ` Eli Zaretskii
2019-12-07  9:39                       ` martin rudalics
2019-12-07 10:24                         ` Eli Zaretskii
2019-12-06 15:45                   ` Eli Zaretskii
2019-12-07  9:39                     ` martin rudalics
2019-12-07 10:29                       ` Eli Zaretskii
2019-12-08  9:03                         ` martin rudalics
2019-12-08 15:39                           ` Eli Zaretskii

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d4070166-2e1f-ba1f-0a16-fe8c9c148e8f@gmx.at \
    --to=rudalics@gmx.at \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).