comparison lisp/term/w32-win.el @ 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 e137a3cff6f7
children f67cc15ab138
comparison
equal deleted inserted replaced
24211:9ecc7b851682 24212:36652d90b38f
624 (menu-bar-enable-clipboard) 624 (menu-bar-enable-clipboard)
625 625
626 ;; W32 systems have different fonts than commonly found on X, so 626 ;; W32 systems have different fonts than commonly found on X, so
627 ;; we define our own standard fontset here. 627 ;; we define our own standard fontset here.
628 (defvar w32-standard-fontset-spec 628 (defvar w32-standard-fontset-spec
629 "-*-Courier New*-normal-r-*-*-13-*-*-*-c-*-fontset-standard" 629 "-*-Courier New-normal-r-*-*-13-*-*-*-c-*-fontset-standard"
630 "String of fontset spec of the standard fontset. This defines a 630 "String of fontset spec of the standard fontset. This defines a
631 fontset consisting of the Courier New variations for European 631 fontset consisting of the Courier New variations for European
632 languages which are distributed with Windows as \"Multilanguage Support\". 632 languages which are distributed with Windows as \"Multilanguage Support\".
633 633
634 See the documentation of `create-fontset-from-fontset-spec for the format.") 634 See the documentation of `create-fontset-from-fontset-spec for the format.")
705 (aref xlfd-temp xlfd-regexp-slant-subnum))))) 705 (aref xlfd-temp xlfd-regexp-slant-subnum)))))
706 (setq fontset (x-compose-font-name xlfd-fields)) 706 (setq fontset (x-compose-font-name xlfd-fields))
707 (create-fontset-from-fontset-spec 707 (create-fontset-from-fontset-spec
708 (concat fontset ", ascii:" font) styles) 708 (concat fontset ", ascii:" font) styles)
709 ))))) 709 )))))
710 ;; This cannot be run yet, as creating fontsets requires a 710 (w32-create-initial-fontsets)))
711 ;; Window to be initialised so the fonts can be listed.
712 ;; Add it to a hook so it gets run later.
713 (add-hook 'before-init-hook 'w32-create-initial-fontsets)
714 ))
715 711
716 ;; Apply a geometry resource to the initial frame. Put it at the end 712 ;; Apply a geometry resource to the initial frame. Put it at the end
717 ;; of the alist, so that anything specified on the command line takes 713 ;; of the alist, so that anything specified on the command line takes
718 ;; precedence. 714 ;; precedence.
719 (let* ((res-geometry (x-get-resource "geometry" "Geometry")) 715 (let* ((res-geometry (x-get-resource "geometry" "Geometry"))
881 fixed width fonts that most people will have like Terminal and 877 fixed width fonts that most people will have like Terminal and
882 Courier. These fonts are used in the font menu if the variable 878 Courier. These fonts are used in the font menu if the variable
883 `w32-use-w32-font-dialog' is nil.") 879 `w32-use-w32-font-dialog' is nil.")
884 880
885 (defun mouse-set-font (&rest fonts) 881 (defun mouse-set-font (&rest fonts)
882 "Select a font. If `w32-use-w32-font-dialog' is non-nil (the default),
883 use the Windows font dialog. Otherwise use a pop-up menu (like Emacs
884 on other platforms) initialized with the fonts in
885 `w32-fixed-font-alist'. Emacs will attempt to create a fontset from
886 the font chosen, covering all the charsets that can be fully represented
887 with the font."
886 (interactive 888 (interactive
887 (if w32-use-w32-font-dialog 889 (if w32-use-w32-font-dialog
888 (list (w32-select-font)) 890 (list (w32-select-font))
889 (x-popup-menu 891 (x-popup-menu
890 last-nonmenu-event 892 last-nonmenu-event
891 ;; Append list of fontsets currently defined. 893 ;; Append list of fontsets currently defined.
892 (if (fboundp 'new-fontset) 894 (if (fboundp 'new-fontset)
893 (append w32-fixed-font-alist (list (generate-fontset-menu))))))) 895 (append w32-fixed-font-alist (list (generate-fontset-menu)))))))
894 (if fonts 896 (if fonts
895 (let (font) 897 (let (font fontset)
896 (while fonts 898 (while fonts
897 (condition-case nil 899 (condition-case nil
898 (progn 900 (progn
899 (set-default-font (car fonts)) 901 (setq font (car fonts))
900 (setq font (car fonts)) 902 (if (fontset-name-p font)
901 (setq fonts nil)) 903 (setq fontset font)
902 (error 904 (condition-case nil
903 (setq fonts (cdr fonts))))) 905 (setq fontset (create-fontset-from-ascii-font font))
906 (error nil)))
907 (if fontset
908 (set-default-font fontset)
909 (set-default-font font))
910 (setq fonts nil))
911 (error (setq fonts (cdr fonts)))))
904 (if (null font) 912 (if (null font)
905 (error "Font not found"))))) 913 (error "Font not found")))))
906 914
907 ;;; w32-win.el ends here 915 ;;; w32-win.el ends here