emacs-diffs
[Top][All Lists]
Advanced

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

master 76d4e19f89: Fix handling of proportional fonts on MS-Windows


From: Eli Zaretskii
Subject: master 76d4e19f89: Fix handling of proportional fonts on MS-Windows
Date: Thu, 28 Apr 2022 03:52:08 -0400 (EDT)

branch: master
commit 76d4e19f8984128d9253673fa91ce5423e9293f1
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Fix handling of proportional fonts on MS-Windows
    
    * src/xfaces.c (Fx_family_fonts): Consider fonts whose :spacing
    value is numeric, but still indicates that they are proportional,
    to be proportional.
    
    * lisp/textmodes/artist.el (artist-mode): Fix test for monospaced
    fonts.
---
 lisp/textmodes/artist.el | 7 +++++--
 src/xfaces.c             | 9 ++++++++-
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/lisp/textmodes/artist.el b/lisp/textmodes/artist.el
index e37b0d988a..686d5f494c 100644
--- a/lisp/textmodes/artist.el
+++ b/lisp/textmodes/artist.el
@@ -1371,8 +1371,11 @@ Keymap summary
        (t
         ;; Turn mode on
         (artist-mode-init)
-         (let ((font (face-attribute 'default :font)))
-           (when (and (fontp font) (not (font-get font :spacing)))
+         (let* ((font (face-attribute 'default :font))
+                (spacing-prop (if (fontp font)
+                                  (font-get font :spacing)
+                                t)))
+           (when (or (null spacing-prop) (eq spacing-prop 0))
              (message "The default font isn't monospaced, so the drawings in 
this buffer may look odd"))))))
 
 ;; Init and exit
diff --git a/src/xfaces.c b/src/xfaces.c
index d7f1f4d96e..c41782f4f3 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -1573,7 +1573,14 @@ the face font sort order.  */)
                             make_fixnum (point),
                             FONT_WEIGHT_SYMBOLIC (font),
                             FONT_SLANT_SYMBOLIC (font),
-                            NILP (spacing) || EQ (spacing, Qp) ? Qnil : Qt,
+                            (NILP (spacing)
+                             || EQ (spacing, Qp)
+                             /* If the font was specified in a way
+                                different from XLFD (e.g., on MS-Windows),
+                                we will have a number there, not 'p'.  */
+                             || EQ (spacing,
+                                    make_fixnum (FONT_SPACING_PROPORTIONAL)))
+                            ? Qnil : Qt,
                             Ffont_xlfd_name (font, Qnil),
                             AREF (font, FONT_REGISTRY_INDEX));
       result = Fcons (v, result);



reply via email to

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