changeset 17014:828cf55629fc

Require fontset. Create fontsets from default-fontset-spec, X resources, and "-fn" command line argument.
author Karl Heuer <kwzh@gnu.org>
date Thu, 20 Feb 1997 05:51:26 +0000
parents d6ce795e84da
children fe0b3661b584
files lisp/term/x-win.el
diffstat 1 files changed, 35 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/term/x-win.el	Thu Feb 20 05:50:19 1997 +0000
+++ b/lisp/term/x-win.el	Thu Feb 20 05:51:26 1997 +0000
@@ -75,6 +75,7 @@
 (require 'faces)
 (require 'select)
 (require 'menu-bar)
+(require 'fontset)
 
 (defvar x-invocation-args)
 
@@ -640,6 +641,40 @@
 (setq x-cut-buffer-max (min (- (/ (x-server-max-request-size) 2) 100)
 			    x-cut-buffer-max))
 
+;; Create a default fontset.
+(create-fontset-from-fontset-spec default-fontset-spec)
+
+;; Create fontset specified in X resources.
+(create-fontset-from-x-resource)
+
+;; Try to create a fontset from font specification which comes from
+;; initial-frame-alist, default-frame-alist, or X resource if the font
+;; name conforms to XLFD and the registry part is `fontset'.  A font
+;; specification in command line argument (-fn XXXX) should be in
+;; default-frame-alist already.  However, any font specification in
+;; site-start library, user's init file (.emacs), and default.el are
+;; not yet handled here.
+
+(let ((font (or (cdr (assq 'font initial-frame-alist))
+		(cdr (assq 'font default-frame-alist))
+		(x-get-resource "font" "Font")
+		(x-get-resource "fontset" "Fontset")))
+      xlfd-fields fontlist)
+  (if (and font
+	   (not (query-fontset font))
+	   (setq xlfd-fields (x-decompose-font-name font)))
+      (progn
+	(if (not (string= "fontset"
+			  (aref xlfd-fields xlfd-regexp-registry-subnum)))
+	    (progn
+	      ;; Create a fontset of the name FONT.
+	      (setq fontlist (list (cons 'ascii font)))
+	      (aset xlfd-fields xlfd-regexp-foundry-subnum nil)
+	      (aset xlfd-fields xlfd-regexp-family-subnum nil)
+	      (aset xlfd-fields xlfd-regexp-adstyle-subnum nil)
+	      (aset xlfd-fields xlfd-regexp-avgwidth-subnum nil)))
+	(new-fontset font (x-complement-fontset-spec xlfd-fields fontlist)))))
+
 ;; Sun expects the menu bar cut and paste commands to use the clipboard.
 ;; This has ,? to match both on Sunos and on Solaris.
 (if (string-match "Sun Microsystems,? Inc\\."