annotate lisp/msw-faces.el @ 266:18d185df8c54

Added tag r20-5b31 for changeset 8efd647ea9ca
author cvs
date Mon, 13 Aug 2007 10:25:39 +0200
parents 8efd647ea9ca
children 7df0dd720c89
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
213
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
1 ;;; msw-faces.el --- mswindows-specific face stuff.
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
2
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
3 ;;; Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
4 ;;; Copyright (C) 1995, 1996 Ben Wing.
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
5
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
6 ;; Author: Jamie Zawinski
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
7 ;; Modified by: Chuck Thompson
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
8 ;; Modified by: Ben Wing
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
9 ;; Modified by: Martin Buchholz
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
10 ;; Rewritten for mswindows by: Jonathan Harris
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
11
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
12 ;; This file is part of XEmacs.
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
13
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
14 ;; XEmacs is free software; you can redistribute it and/or modify it
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
15 ;; under the terms of the GNU General Public License as published by
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
16 ;; the Free Software Foundation; either version 2, or (at your option)
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
17 ;; any later version.
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
18
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
19 ;; XEmacs is distributed in the hope that it will be useful, but
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
20 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
22 ;; General Public License for more details.
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
23
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
24 ;; You should have received a copy of the GNU General Public License
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
25 ;; along with XEmacs; see the file COPYING. If not, write to the
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
26 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
27 ;; Boston, MA 02111-1307, USA.
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
28
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
29 ;; This file does the magic to parse mswindows font names, and make sure that the
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
30 ;; default and modeline attributes of new frames are specified enough.
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
31
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
32 ;;; ensure that the default face has some reasonable fallbacks if nothing
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
33 ;;; else is specified.
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
34 (defun mswindows-init-device-faces (device)
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
35 (or (face-font 'default 'global)
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
36 (set-face-font 'default "Courier New:Regular:10")
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
37 'global)
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
38 (or (face-foreground 'default 'global)
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
39 (set-face-foreground 'default "black" 'global 'mswindows))
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
40 (or (face-background 'default 'global)
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
41 (set-face-background 'default "white" 'global 'mswindows))
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
42 (or (face-background 'modeline 'global)
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
43 (set-face-background 'modeline "grey75" 'global 'mswindows))
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
44 )
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
45
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
46
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
47 (defun mswindows-init-frame-faces (frame)
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
48 )
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
49
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
50
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
51 ;;; Fill in missing parts of a font spec. This is primarily intended as a
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
52 ;;; helper function for the functions below.
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
53 ;;; mswindows fonts look like:
215
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
54 ;;; fontname[:[weight][ style][:pointsize[:effects[:charset]]]]
213
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
55 ;;; A minimal mswindows font spec looks like:
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
56 ;;; Courier New
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
57 ;;; A maximal mswindows font spec looks like:
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
58 ;;; Courier New:Bold Italic:10:underline strikeout:ansi
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
59 ;;; Missing parts of the font spec should be filled in with these values:
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
60 ;;; Courier New:Normal:10::ansi
215
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
61 (defun mswindows-font-canicolize-name (font)
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
62 "Given a mswindows font specification, this returns its name in canonical
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
63 form."
221
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents: 215
diff changeset
64 (if (font-instance-p font)
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents: 215
diff changeset
65 (let ((name (font-instance-name font)))
215
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
66 (cond ((string-match
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
67 "^[a-zA-Z ]+:[a-zA-Z ]*:[0-9]+:[a-zA-Z ]*:[a-zA-Z 0-9]*$"
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
68 name) name)
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
69 ((string-match "^[a-zA-Z ]+:[a-zA-Z ]*:[0-9]+:[a-zA-Z ]*$"
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
70 name) (concat name ":ansi"))
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
71 ((string-match "^[a-zA-Z ]+:[a-zA-Z ]*:[0-9]+$" name)
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
72 (concat name "::ansi"))
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
73 ((string-match "^[a-zA-Z ]+:[a-zA-Z ]*$" name)
221
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents: 215
diff changeset
74 (concat name ":10::ansi"))
215
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
75 ((string-match "^[a-zA-Z ]+$" name)
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
76 (concat name ":Normal:10::ansi"))
221
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents: 215
diff changeset
77 (t "Courier New:Normal:10::ansi")))))
213
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
78
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
79 (defun mswindows-make-font-bold (font &optional device)
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
80 "Given a mswindows font specification, this attempts to make a bold font.
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
81 If it fails, it returns nil."
215
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
82 (if (font-instance-p font)
221
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents: 215
diff changeset
83 (let ((name (mswindows-font-canicolize-name font))
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents: 215
diff changeset
84 (oldwidth (font-instance-width font)))
215
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
85 (string-match "^[a-zA-Z ]+:\\([a-zA-Z ]*\\):" name)
221
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents: 215
diff changeset
86 (let ((newfont (make-font-instance
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents: 215
diff changeset
87 (concat (substring name 0 (match-beginning 1))
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents: 215
diff changeset
88 "Bold" (substring name (match-end 1)))
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents: 215
diff changeset
89 device t)))
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents: 215
diff changeset
90 ; Hack! on mswindows, bold fonts (even monospaced) are often wider than the
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents: 215
diff changeset
91 ; equivalent non-bold font. Making the bold font one point smaller usually
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents: 215
diff changeset
92 ; makes it the same width (maybe at the expense of making it one pixel shorter)
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents: 215
diff changeset
93 (if (font-instance-p newfont)
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents: 215
diff changeset
94 (if (> (font-instance-width newfont) oldwidth)
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents: 215
diff changeset
95 (mswindows-find-smaller-font newfont)
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents: 215
diff changeset
96 newfont))))))
213
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
97
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
98 (defun mswindows-make-font-unbold (font &optional device)
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
99 "Given a mswindows font specification, this attempts to make a non-bold font.
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
100 If it fails, it returns nil."
215
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
101 (if (font-instance-p font)
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
102 (let ((name (mswindows-font-canicolize-name font)))
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
103 (string-match "^[a-zA-Z ]+:\\([a-zA-Z ]*\\):" name)
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
104 (make-font-instance (concat
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
105 (substring name 0 (match-beginning 1))
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
106 "Normal" (substring name (match-end 1)))
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
107 device t))))
213
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
108
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
109 (defun mswindows-make-font-italic (font &optional device)
215
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
110 "Given a mswindows font specification, this attempts to make an `italic'
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
111 font. If it fails, it returns nil."
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
112 (if (font-instance-p font)
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
113 (let ((name (mswindows-font-canicolize-name font)))
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
114 (string-match "^[a-zA-Z ]+:\\([a-zA-Z ]*\\):" name)
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
115 (make-font-instance (concat
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
116 (substring name 0 (match-beginning 1))
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
117 "Italic" (substring name (match-end 1)))
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
118 device t))))
213
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
119
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
120 (defun mswindows-make-font-unitalic (font &optional device)
215
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
121 "Given a mswindows font specification, this attempts to make a non-italic
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
122 font. If it fails, it returns nil."
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
123 (if (font-instance-p font)
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
124 (let ((name (mswindows-font-canicolize-name font)))
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
125 (string-match "^[a-zA-Z ]+:\\([a-zA-Z ]*\\):" name)
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
126 (make-font-instance (concat
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
127 (substring name 0 (match-beginning 1))
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
128 "Normal" (substring name (match-end 1)))
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
129 device t))))
213
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
130
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
131 (defun mswindows-make-font-bold-italic (font &optional device)
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
132 "Given a mswindows font specification, this attempts to make a `bold-italic'
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
133 font. If it fails, it returns nil."
215
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
134 (if (font-instance-p font)
221
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents: 215
diff changeset
135 (let ((name (mswindows-font-canicolize-name font))
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents: 215
diff changeset
136 (oldwidth (font-instance-width font)))
215
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
137 (string-match "^[a-zA-Z ]+:\\([a-zA-Z ]*\\):" name)
221
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents: 215
diff changeset
138 (let ((newfont (make-font-instance
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents: 215
diff changeset
139 (concat (substring name 0 (match-beginning 1))
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents: 215
diff changeset
140 "Bold Italic" (substring name (match-end 1)))
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents: 215
diff changeset
141 device t)))
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents: 215
diff changeset
142 ; Hack! on mswindows, bold fonts (even monospaced) are often wider than the
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents: 215
diff changeset
143 ; equivalent non-bold font. Making the bold font one point smaller usually
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents: 215
diff changeset
144 ; makes it the same width (maybe at the expense of making it one pixel shorter)
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents: 215
diff changeset
145 (if (font-instance-p newfont)
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents: 215
diff changeset
146 (if (> (font-instance-width newfont) oldwidth)
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents: 215
diff changeset
147 (mswindows-find-smaller-font newfont)
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents: 215
diff changeset
148 newfont))))))
213
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
149
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
150 (defun mswindows-find-smaller-font (font &optional device)
221
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents: 215
diff changeset
151 "Loads a new version of the given font (or font name) 1 point smaller.
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents: 215
diff changeset
152 Returns the font if it succeeds, nil otherwise."
215
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
153 (if (font-instance-p font)
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
154 (let (old-size (name (mswindows-font-canicolize-name font)))
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
155 (string-match "^[a-zA-Z ]+:[a-zA-Z ]*:\\([0-9]+\\):" name)
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
156 (setq old-size (string-to-int
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
157 (substring name (match-beginning 1) (match-end 1))))
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
158 (if (> old-size 0)
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
159 (make-font-instance (concat
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
160 (substring name 0 (match-beginning 1))
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
161 (int-to-string (- old-size 1))
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
162 (substring name (match-end 1)))
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
163 device t)))))
213
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
164
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
165 (defun mswindows-find-larger-font (font &optional device)
221
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents: 215
diff changeset
166 "Loads a new version of the given font (or font name) 1 point larger.
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents: 215
diff changeset
167 Returns the font if it succeeds, nil otherwise."
215
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
168 (if (font-instance-p font)
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
169 (let (old-size (name (mswindows-font-canicolize-name font)))
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
170 (string-match "^[a-zA-Z ]+:[a-zA-Z ]*:\\([0-9]+\\):" name)
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
171 (setq old-size (string-to-int
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
172 (substring name (match-beginning 1) (match-end 1))))
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
173 (make-font-instance (concat
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
174 (substring name 0 (match-beginning 1))
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
175 (int-to-string (+ old-size 1))
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
176 (substring name (match-end 1)))
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
177 device t))))