aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa1998-12-15 04:35:38 +0000
committerKenichi Handa1998-12-15 04:35:38 +0000
commit190ce6342775b55ebb1df7ca0ac63425a39b4bca (patch)
tree772166638c9d4103dc2284a979c8b51f8c5d9047
parent251d4f4bf90c3b4ab234827f4acf4cd147f387be (diff)
downloademacs-190ce6342775b55ebb1df7ca0ac63425a39b4bca.tar.gz
emacs-190ce6342775b55ebb1df7ca0ac63425a39b4bca.zip
(x-decompose-font-name): If PATTERN
doesn't have any wild cards, return a vector made from a name that is found by x-resolve-font-name found. Comments added.
-rw-r--r--lisp/international/fontset.el43
1 files changed, 30 insertions, 13 deletions
diff --git a/lisp/international/fontset.el b/lisp/international/fontset.el
index 697ad1508cb..925ae9f9732 100644
--- a/lisp/international/fontset.el
+++ b/lisp/international/fontset.el
@@ -181,15 +181,20 @@ PATTERN. If no full XLFD name is gotten, return nil."
181 (error))) 181 (error)))
182 (if (and fontname 182 (if (and fontname
183 (string-match xlfd-tight-regexp fontname)) 183 (string-match xlfd-tight-regexp fontname))
184 ;; We get a full XLFD name.
184 (let ((len (length pattern)) 185 (let ((len (length pattern))
185 (i 0) 186 (i 0)
186 l) 187 l)
188 ;; Setup xlfd-fields by the full XLFD name. Each element
189 ;; should be a cons of matched index and matched string.
187 (setq xlfd-fields (make-vector 14 nil)) 190 (setq xlfd-fields (make-vector 14 nil))
188 (while (< i 14) 191 (while (< i 14)
189 (aset xlfd-fields i 192 (aset xlfd-fields i
190 (cons (match-beginning (1+ i)) 193 (cons (match-beginning (1+ i))
191 (match-string (1+ i) fontname))) 194 (match-string (1+ i) fontname)))
192 (setq i (1+ i))) 195 (setq i (1+ i)))
196
197 ;; Replace wild cards in PATTERN by regexp codes.
193 (setq i 0) 198 (setq i 0)
194 (while (< i len) 199 (while (< i len)
195 (let ((ch (aref pattern i))) 200 (let ((ch (aref pattern i)))
@@ -206,19 +211,31 @@ PATTERN. If no full XLFD name is gotten, return nil."
206 len (+ len 5) 211 len (+ len 5)
207 i (+ i 5)) 212 i (+ i 5))
208 (setq i (1+ i)))))) 213 (setq i (1+ i))))))
209 (string-match pattern fontname) 214
210 (setq l (cdr (cdr (match-data)))) 215 ;; Set each element of xlfd-fields to proper strings.
211 (setq i 0) 216 (if (string-match pattern fontname)
212 (while (< i 14) 217 ;; The regular expression PATTERN matchs the full XLFD
213 (if (or (null l) (< (car (aref xlfd-fields i)) (car l))) 218 ;; name. Set elements that correspond to a wild card
214 (progn 219 ;; in PATTERN to "*", set the other elements to the
215 (aset xlfd-fields i (cdr (aref xlfd-fields i))) 220 ;; exact strings in PATTERN.
216 (setq i (1+ i))) 221 (let ((l (cdr (cdr (match-data)))))
217 (if (< (car (aref xlfd-fields i)) (car (cdr l))) 222 (setq i 0)
218 (progn 223 (while (< i 14)
219 (aset xlfd-fields i "*") 224 (if (or (null l) (< (car (aref xlfd-fields i)) (car l)))
220 (setq i (1+ i))) 225 (progn
221 (setq l (cdr (cdr l)))))) 226 (aset xlfd-fields i (cdr (aref xlfd-fields i)))
227 (setq i (1+ i)))
228 (if (< (car (aref xlfd-fields i)) (car (cdr l)))
229 (progn
230 (aset xlfd-fields i "*")
231 (setq i (1+ i)))
232 (setq l (cdr (cdr l)))))))
233 ;; Set each element of xlfd-fields to the exact string
234 ;; in the corresonding fields in full XLFD name.
235 (setq i 0)
236 (while (< i 14)
237 (aset xlfd-fields i (cdr (aref xlfd-fields i)))
238 (setq i (1+ i))))
222 xlfd-fields))))) 239 xlfd-fields)))))
223 240
224;; Replace consecutive wild-cards (`*') in NAME to one. 241;; Replace consecutive wild-cards (`*') in NAME to one.