comparison lisp/international/fontset.el @ 17177:9e550b522bc0

(x-charset-registries): Change entry for Ethiopic. Typo in comments fixed. (fontset-plain-name): Set correct size information. (x-reduce-font-name): New function. (x-compose-font-name): New optional argument REDUCE. (x-complement-fontset-spec): Call x-compose-font-name with t for the above argument.
author Kenichi Handa <handa@m17n.org>
date Tue, 18 Mar 1997 23:16:27 +0000
parents 70194012fb3a
children 9c0c6ae6dcad
comparison
equal deleted inserted replaced
17176:12e0db4fd511 17177:9e550b522bc0
66 (vietnamese-viscii-upper . "VISCII1.1") 66 (vietnamese-viscii-upper . "VISCII1.1")
67 (arabic-digit . "MuleArabic-0") 67 (arabic-digit . "MuleArabic-0")
68 (arabic-1-column . "MuleArabic-1") 68 (arabic-1-column . "MuleArabic-1")
69 (arabic-2-column . "MuleArabic-2") 69 (arabic-2-column . "MuleArabic-2")
70 (ipa . "MuleIPA") 70 (ipa . "MuleIPA")
71 (ethiopic . "Ethio") 71 (ethiopic . "Ethiopic-Unicode")
72 (ascii-right-to-left . "ISO8859-1") 72 (ascii-right-to-left . "ISO8859-1")
73 (indian-is13194 . "IS13194-Devanagari") 73 (indian-is13194 . "IS13194-Devanagari")
74 (indian-2-column . "MuleIndian-2") 74 (indian-2-column . "MuleIndian-2")
75 (indian-1-column . "MuleIndian-1") 75 (indian-1-column . "MuleIndian-1")
76 (lao . "lao.mule-1"))) 76 (lao . "lao.mule-1")))
193 (aset xlfd-fields i nil) 193 (aset xlfd-fields i nil)
194 (setq i (1+ i))) 194 (setq i (1+ i)))
195 (setq l (cdr (cdr l)))))) 195 (setq l (cdr (cdr l))))))
196 xlfd-fields))))) 196 xlfd-fields)))))
197 197
198 (defsubst x-compose-font-name (xlfd-fields) 198 ;; Replace consecutive wild-cards (`*') in NAME to one.
199 ;; Ex. (x-reduce-font-name "-*-*-*-iso8859-1") => "-*-iso8859-1"
200 (defsubst x-reduce-font-name (name)
201 (while (string-match "-\\*-\\(\\*-\\)+" name)
202 (setq name (replace-match "-*-" t t name)))
203 name)
204
205 (defun x-compose-font-name (xlfd-fields &optional reduce)
199 "Compose X's fontname from FIELDS. 206 "Compose X's fontname from FIELDS.
200 FIELDS is a vector of XLFD fields. 207 FIELDS is a vector of XLFD fields.
201 If a field is nil, wild-card character `*' is embedded." 208 If a field is nil, wild-card letter `*' is embedded.
202 (concat "-" (mapconcat (lambda (x) (or x "*")) xlfd-fields "-"))) 209 Optional argument REDUCE non-nil means consecutive wild-cards are
210 reduced to be one."
211 (let ((name
212 (concat "-" (mapconcat (lambda (x) (or x "*")) xlfd-fields "-"))))
213 (if reduce
214 (x-reduce-font-name name)
215 name)))
203 216
204 (defun x-complement-fontset-spec (xlfd-fields fontlist) 217 (defun x-complement-fontset-spec (xlfd-fields fontlist)
205 "Complement FONTLIST for all charsets based on XLFD-FIELDS and return it. 218 "Complement FONTLIST for all charsets based on XLFD-FIELDS and return it.
206 XLFD-FIELDS is a vector of XLFD (X Logical Font Description) fields. 219 XLFD-FIELDS is a vector of XLFD (X Logical Font Description) fields.
207 FONTLIST is an alist of cons of charset and fontname. 220 FONTLIST is an alist of cons of charset and fontname.
224 (substring registry (match-end 0)))) 237 (substring registry (match-end 0))))
225 (aset xlfd-fields xlfd-regexp-registry-subnum 238 (aset xlfd-fields xlfd-regexp-registry-subnum
226 (concat registry "*")) 239 (concat registry "*"))
227 (aset xlfd-fields xlfd-regexp-encoding-subnum "*")) 240 (aset xlfd-fields xlfd-regexp-encoding-subnum "*"))
228 (setq fontlist 241 (setq fontlist
229 (cons (cons charset (x-compose-font-name xlfd-fields)) 242 (cons (cons charset (x-compose-font-name xlfd-fields t))
230 fontlist))))) 243 fontlist)))))
231 (setq charsets (cdr charsets)))) 244 (setq charsets (cdr charsets))))
232 fontlist) 245 fontlist)
233 246
234 ;; Return a list to be appended to `x-fixed-font-alist' when 247 ;; Return a list to be appended to `x-fixed-font-alist' when
253 (let ((weight (aref xlfd-fields xlfd-regexp-weight-subnum)) 266 (let ((weight (aref xlfd-fields xlfd-regexp-weight-subnum))
254 (slant (aref xlfd-fields xlfd-regexp-slant-subnum)) 267 (slant (aref xlfd-fields xlfd-regexp-slant-subnum))
255 (swidth (aref xlfd-fields xlfd-regexp-swidth-subnum)) 268 (swidth (aref xlfd-fields xlfd-regexp-swidth-subnum))
256 (size (aref xlfd-fields xlfd-regexp-pixelsize-subnum)) 269 (size (aref xlfd-fields xlfd-regexp-pixelsize-subnum))
257 name) 270 name)
258 (if (integerp size) 271 (if (> (string-to-int size) 0)
259 (setq name (format "%d " size)) 272 (setq name (format "%s " size))
260 (setq name "")) 273 (setq name ""))
261 (if (string-match "bold\\|demibold" weight) 274 (if (string-match "bold\\|demibold" weight)
262 (setq name (concat name weight " "))) 275 (setq name (concat name weight " ")))
263 (cond ((string= slant "i") 276 (cond ((string= slant "i")
264 (setq name (concat name "italic "))) 277 (setq name (concat name "italic ")))