changeset 24212:36652d90b38f

(w32-standard-fontset-spec): Remove wildcard from FAMILY field. (w32-create-initial-fontsets): Do not use before-init-hook. (mouse-set-font): Document. Automatically create and use fontsets.
author Geoff Voelker <voelker@cs.washington.edu>
date Thu, 28 Jan 1999 04:46:42 +0000
parents 9ecc7b851682
children 3c29f6165eca
files lisp/term/w32-win.el
diffstat 1 files changed, 20 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/term/w32-win.el	Thu Jan 28 04:01:44 1999 +0000
+++ b/lisp/term/w32-win.el	Thu Jan 28 04:46:42 1999 +0000
@@ -626,7 +626,7 @@
 ;; W32 systems have different fonts than commonly found on X, so
 ;; we define our own standard fontset here.
 (defvar w32-standard-fontset-spec
- "-*-Courier New*-normal-r-*-*-13-*-*-*-c-*-fontset-standard"
+ "-*-Courier New-normal-r-*-*-13-*-*-*-c-*-fontset-standard"
  "String of fontset spec of the standard fontset. This defines a
 fontset consisting of the Courier New variations for European
 languages which are distributed with Windows as \"Multilanguage Support\".
@@ -707,11 +707,7 @@
                   (create-fontset-from-fontset-spec
                    (concat fontset ", ascii:" font) styles)
                   )))))
-      ;; This cannot be run yet, as creating fontsets requires a
-      ;; Window to be initialised so the fonts can be listed.
-      ;; Add it to a hook so it gets run later.
-      (add-hook 'before-init-hook 'w32-create-initial-fontsets)
-      ))
+      (w32-create-initial-fontsets)))
 
 ;; Apply a geometry resource to the initial frame.  Put it at the end
 ;; of the alist, so that anything specified on the command line takes
@@ -883,6 +879,12 @@
 `w32-use-w32-font-dialog' is nil.")
 
 (defun mouse-set-font (&rest fonts)
+  "Select a font. If `w32-use-w32-font-dialog' is non-nil (the default),
+use the Windows font dialog. Otherwise use a pop-up menu (like Emacs
+on other platforms) initialized with the fonts in
+`w32-fixed-font-alist'. Emacs will attempt to create a fontset from
+the font chosen, covering all the charsets that can be fully represented
+with the font."
   (interactive
    (if w32-use-w32-font-dialog
        (list (w32-select-font))
@@ -892,15 +894,21 @@
       (if (fboundp 'new-fontset)
       (append w32-fixed-font-alist (list (generate-fontset-menu)))))))
   (if fonts
-      (let (font)
+      (let (font fontset)
 	(while fonts
 	  (condition-case nil
 	      (progn
-		(set-default-font (car fonts))
-		(setq font (car fonts))
-		(setq fonts nil))
-	    (error
-	     (setq fonts (cdr fonts)))))
+                (setq font (car fonts))
+                (if (fontset-name-p font)
+                    (setq fontset font)
+                  (condition-case nil
+                      (setq fontset (create-fontset-from-ascii-font font))
+                    (error nil)))
+                (if fontset
+                    (set-default-font fontset)
+                  (set-default-font font))
+                (setq fonts nil))
+	    (error (setq fonts (cdr fonts)))))
 	(if (null font)
 	    (error "Font not found")))))