]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix handling of proportional fonts on MS-Windows
authorEli Zaretskii <eliz@gnu.org>
Thu, 28 Apr 2022 07:50:50 +0000 (10:50 +0300)
committerEli Zaretskii <eliz@gnu.org>
Thu, 28 Apr 2022 07:50:50 +0000 (10:50 +0300)
* 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
src/xfaces.c

index e37b0d988abe135f98d0a75edcd64b1e82c00ec6..686d5f494c9e8908c0e8ddda1fbc12010d3dceea 100644 (file)
@@ -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
index d7f1f4d96e555e8a51c86739721205de2ba81dbd..c41782f4f38f11b325a48ae8d013e444520c507d 100644 (file)
@@ -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);