From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= Newsgroups: gmane.emacs.devel Subject: Re: What is a default font? Date: Wed, 04 Dec 2019 20:38:26 +0100 Message-ID: <87h82f6fv1.fsf@gmail.com> References: <4c86b07f-175d-f6cf-171a-b58474ab717a@gmx.at> <83tv6ghxxk.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="99136"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Eli Zaretskii , emacs-devel@gnu.org To: martin rudalics Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Dec 04 20:39:29 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1icaUi-000PeM-M0 for ged-emacs-devel@m.gmane.org; Wed, 04 Dec 2019 20:39:28 +0100 Original-Received: from localhost ([::1]:46380 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icaUg-00079E-SL for ged-emacs-devel@m.gmane.org; Wed, 04 Dec 2019 14:39:26 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57572) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icaTt-000794-S9 for emacs-devel@gnu.org; Wed, 04 Dec 2019 14:38:39 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1icaTs-0007tY-Jj for emacs-devel@gnu.org; Wed, 04 Dec 2019 14:38:37 -0500 Original-Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:34896) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1icaTm-0007F1-5A; Wed, 04 Dec 2019 14:38:32 -0500 Original-Received: by mail-wr1-x432.google.com with SMTP id g17so658240wro.2; Wed, 04 Dec 2019 11:38:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version; bh=iYHvRxjSRKSr/WtKLJumYCwL5j2EfmrHqZ+wckQfbZI=; b=DknzI9Uk/q4md8v0zX1GejmIPcwmp/dSnTR6iq1ILng/GY5l1foLmwsENxottnh7j5 WNyhKiS7yywQT+4MP74p3G7Pn9ElFrFo3mymUYioEl3yllIP+hH8HZxcQZgom2OiAFg5 Qu53PlMwb6+eMiwgLHwSIx4DE++KqS4hGw/SR/xzNOhGJDNXbRtEDDskcbtcovoseDXb FcDJOOjmH+si2cLoZBoAhbGacvWpQp7tskY3Y2eAPsl5TUFCwKe9LGNFPT0wp07nMLAg Q8xqUZ2zkoy+kOZTnJSHsMqA8TQVoOXaJQlP2PiKG8A+zoHth3K0YnIY1Dod+YiuFfY6 dgvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references :user-agent:date:message-id:mime-version; bh=iYHvRxjSRKSr/WtKLJumYCwL5j2EfmrHqZ+wckQfbZI=; b=lq0iOHHPDLjATxAMcbx+FL4wo4xPwM3tRJd59m7iKLXeyCQ/697tSYIL+x1thJVFtT w4CGEv0O+MHvXVvxA0t7JMsg7YZ+31bTJb3qWvJnBJFvfnbVZOsW5iL/gecxdYf9kPLR Eu4RlzJlwgTpvyCG2ncuzgy8zrSEC6YNWLz9ugHPEy8IGz/iyRGVeH2gfZaRNhCmnN7P 0xgmmkXOCZv/0wmEt/mSE/Y7NidPWh+DI62W5+d86xRpKlC7wdCjVZZ22+HYR/CjnP9T 3Glx9jX7QCUOn7gRNVy4i1NA0x8dFyJ4eD0b8Wo+CT1Bq9Hygh7Zwe5J9wkXKb6x0BQM z5MA== X-Gm-Message-State: APjAAAUIR+eCHOVn2RpkIjFTnmzE8J3oRiAqGUyfFcjZnSo5RF6SvxGe SsjBxwl8mbQB8x5BGjNLdjY= X-Google-Smtp-Source: APXvYqxwSzSH3eWOCnyYDh7+SU1+I8qHuaoqilDfQU1nfSr7xTlv9M+Xon7jWFsRsrEHT3qMs6++rQ== X-Received: by 2002:adf:e290:: with SMTP id v16mr6036731wri.16.1575488307633; Wed, 04 Dec 2019 11:38:27 -0800 (PST) Original-Received: from localhost ([185.112.167.114]) by smtp.gmail.com with ESMTPSA id h17sm9806362wrs.18.2019.12.04.11.38.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Dec 2019 11:38:26 -0800 (PST) In-Reply-To: (martin rudalics's message of "Wed, 4 Dec 2019 19:04:10 +0100") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::432 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:243124 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Wed, 4 Dec 2019 19:04:10 +0100 martin rudalics wrote: >> You will see that functions which use the likes of default-font-height >> are interested in the selected window on the selected frame. > > But in that case the first line of the doc-string of > 'default-font-height' > > Return the height in pixels of the current buffer's default face font. > > is totally misleading because, as you noted above, asking for such a > value is meaningless when the current buffer is not displayed in the > selected window. Please try to fix these doc-strings so they tell > what the functions actually do and not how they are used. Indeed, FWIW I've been bitten by this recently, too, and have been meaning to submit the patch attached, although now seeing this discussion, more clarification (and from a more knowledgeable person) might be needed. I simply corrected what seemed to be obvious errors, but maybe it can at least serve as another evidence of the confusion. --=20 =C5=A0t=C4=9Bp=C3=A1n --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Correct-default-font-height-width-default-line-heigh.patch >From 4edb174e38b3fb61ea95f11a938e648fd789a2e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20N=C4=9Bmec?= Date: Thu, 29 Aug 2019 20:06:47 +0200 Subject: [PATCH] Correct default-font-{height,width}, default-line-height doc strings * doc/lispref/display.texi (Low-Level Font): Correct doc strings of default-font-height and default-font-width. They return information for the selected frame, not the current buffer. * lisp/simple.el (default-font-height, default-font-width, default-line-height): Correct doc strings. --- doc/lispref/display.texi | 4 ++-- lisp/simple.el | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 1f7cc93c9c..6704c714e2 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -3934,12 +3934,12 @@ Low-Level Font @defun default-font-width This function returns the average width in pixels of the font used by -the current buffer's default face. +the selected frame's default face. @end defun @defun default-font-height This function returns the height in pixels of the font used by the -current buffer's default face. +selected frame's default face. @end defun @defun window-font-width &optional window face diff --git a/lisp/simple.el b/lisp/simple.el index 47ce0364d1..28a416fa2c 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -6183,7 +6183,7 @@ line-move-visual (declare-function font-info "font.c" (name &optional frame)) (defun default-font-height () - "Return the height in pixels of the current buffer's default face font. + "Return the height in pixels of the selected frame's default face font. If the default font is remapped (see `face-remapping-alist'), the function returns the height of the remapped face." @@ -6198,7 +6198,7 @@ default-font-height (t (frame-char-height))))) (defun default-font-width () - "Return the width in pixels of the current buffer's default face font. + "Return the width in pixels of the selected frame's default face font. If the default font is remapped (see `face-remapping-alist'), the function returns the width of the remapped face." @@ -6217,9 +6217,9 @@ default-font-width (t (frame-char-width))))) (defun default-line-height () - "Return the pixel height of current buffer's default-face text line. + "Return the pixel height of the selected frame's default-face text line. -The value includes `line-spacing', if any, defined for the buffer +The value includes `line-spacing', if any, defined for the current buffer or the frame." (let ((dfh (default-font-height)) (lsp (if (display-graphic-p) -- 2.24.0 --=-=-=--