summaryrefslogtreecommitdiff
path: root/lisp/faces.el
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2015-07-01 19:33:56 +0300
committerEli Zaretskii <eliz@gnu.org>2015-07-01 19:33:56 +0300
commit7d5a7a43f1f6630b269fa7f7dc13e9c80181a709 (patch)
tree3d4a697f78722d306ed69ca212d21fdcd6bf2e75 /lisp/faces.el
parent4c66103fb3ee13c39ba53659f00b2c569307f3e8 (diff)
downloademacs-7d5a7a43f1f6630b269fa7f7dc13e9c80181a709.tar.gz
Be more tolerant to fonts named "Foobar-12"
* src/frame.c (x_set_font): If font_spec_from_name returns nil, don't barf; instead, request a new fontset to be generated. This avoids unnecessarily rejecting fonts named against XLFD rules. See http://lists.gnu.org/archive/html/help-emacs-windows/2015-06/msg00001.html, for the description of the original problem. * lisp/faces.el (set-face-attribute): Don't be fooled too easily by a hyphen in a font's name.
Diffstat (limited to 'lisp/faces.el')
-rw-r--r--lisp/faces.el11
1 files changed, 9 insertions, 2 deletions
diff --git a/lisp/faces.el b/lisp/faces.el
index ac6486ee46c..9857a7bd4de 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -753,7 +753,7 @@ is specified, `:italic' is ignored."
(setq args (purecopy args))
(let ((where (if (null frame) 0 frame))
(spec args)
- family foundry)
+ family foundry orig-family orig-foundry)
;; If we set the new-frame defaults, this face is modified outside Custom.
(if (memq where '(0 t))
(put (or (get face 'face-alias) face) 'face-modified t))
@@ -769,9 +769,16 @@ is specified, `:italic' is ignored."
(when (or family foundry)
(when (and (stringp family)
(string-match "\\([^-]*\\)-\\([^-]*\\)" family))
+ (setq orig-foundry foundry
+ orig-family family)
(unless foundry
(setq foundry (match-string 1 family)))
- (setq family (match-string 2 family)))
+ (setq family (match-string 2 family))
+ ;; Reject bogus "families" that are all-digits -- those are some
+ ;; weird font names, like Foobar-12, that end in a number.
+ (when (string-match "\\`[0-9]*\\'" family)
+ (setq family orig-family)
+ (setq foundry orig-foundry)))
(when (or (stringp family) (eq family 'unspecified))
(internal-set-lisp-face-attribute face :family (purecopy family)
where))