Mercurial > hg > xemacs-beta
diff lisp/msw-faces.el @ 318:afd57c14dfc8 r21-0b57
Import from CVS: tag r21-0b57
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:45:36 +0200 |
parents | 70ad99077275 |
children | 19dcec799385 |
line wrap: on
line diff
--- a/lisp/msw-faces.el Mon Aug 13 10:44:47 2007 +0200 +++ b/lisp/msw-faces.el Mon Aug 13 10:45:36 2007 +0200 @@ -26,15 +26,14 @@ ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. -;; This file does the magic to parse mswindows font names, and make sure that the -;; default and modeline attributes of new frames are specified enough. +;; This file does the magic to parse mswindows font names, and make sure that +;; the default and modeline attributes of new frames are specified enough. -;;; ensure that the default face has some reasonable fallbacks if nothing -;;; else is specified. +;;; Force creation of the default face font so that if it fails we get an +;;; error now instead of a crash at frame creation. (defun mswindows-init-device-faces (device) - (set-face-font 'default - '((mswindows default) . "Courier New:Regular:10") 'global) - ) + (unless (face-font-instance 'default device) + (error "Can't find a suitable default font"))) (defun mswindows-init-frame-faces (frame) @@ -48,12 +47,12 @@ ;;; A minimal mswindows font spec looks like: ;;; Courier New ;;; A maximal mswindows font spec looks like: -;;; Courier New:Bold Italic:10:underline strikeout:western +;;; Courier New:Bold Italic:10:underline strikeout:Western ;;; Missing parts of the font spec should be filled in with these values: -;;; Courier New:Normal:10::western +;;; Courier New:Regular:10::Western (defun mswindows-font-canonicalize-name (font) - "Given a mswindows font or font specification, this returns its -specification in canonical form." + "Given a mswindows font or font name, this returns its name in +canonical form." (if (or (font-instance-p font) (stringp font)) (let ((name (if (font-instance-p font) @@ -63,14 +62,14 @@ "^[a-zA-Z ]+:[a-zA-Z ]*:[0-9]+:[a-zA-Z ]*:[a-zA-Z 0-9]*$" name) name) ((string-match "^[a-zA-Z ]+:[a-zA-Z ]*:[0-9]+:[a-zA-Z ]*$" - name) (concat name ":western")) + name) (concat name ":Western")) ((string-match "^[a-zA-Z ]+:[a-zA-Z ]*:[0-9]+$" name) - (concat name "::western")) + (concat name "::Western")) ((string-match "^[a-zA-Z ]+:[a-zA-Z ]*$" name) - (concat name ":10::western")) + (concat name ":10::Western")) ((string-match "^[a-zA-Z ]+$" name) - (concat name ":Normal:10::western")) - (t "Courier New:Normal:10::western"))))) + (concat name ":Regular:10::Western")) + (t "Courier New:Regular:10::Western"))))) (defun mswindows-make-font-bold (font &optional device) "Given a mswindows font specification, this attempts to make a bold font. @@ -88,7 +87,7 @@ ; makes it the same width (maybe at the expense of making it one pixel shorter) (if (font-instance-p newfont) (if (> (font-instance-width newfont) oldwidth) - (mswindows-find-smaller-font newfont) + (mswindows-find-smaller-font newfont device) newfont)))))) (defun mswindows-make-font-unbold (font &optional device) @@ -99,7 +98,7 @@ (string-match "^[a-zA-Z ]+:\\([a-zA-Z ]*\\):" name) (make-font-instance (concat (substring name 0 (match-beginning 1)) - "Normal" (substring name (match-end 1))) + "Regular" (substring name (match-end 1))) device t)))) (defun mswindows-make-font-italic (font &optional device) @@ -121,7 +120,7 @@ (string-match "^[a-zA-Z ]+:\\([a-zA-Z ]*\\):" name) (make-font-instance (concat (substring name 0 (match-beginning 1)) - "Normal" (substring name (match-end 1))) + "Regular" (substring name (match-end 1))) device t)))) (defun mswindows-make-font-bold-italic (font &optional device) @@ -140,7 +139,7 @@ ; makes it the same width (maybe at the expense of making it one pixel shorter) (if (font-instance-p newfont) (if (> (font-instance-width newfont) oldwidth) - (mswindows-find-smaller-font newfont) + (mswindows-find-smaller-font newfont device) newfont)))))) (defun mswindows-find-smaller-font (font &optional device)