comparison lisp/faces.el @ 3659:98af8a976fc3

[xemacs-hg @ 2006-11-05 22:31:31 by aidan] Support specifying fonts for particular character sets in Mule; support translation to ISO 10646-1 for Mule character sets without an otherwise matching font; move to a vector of X11-charset-X11-registry instead of a regex for the charset-registry property.
author aidan
date Sun, 05 Nov 2006 22:31:46 +0000
parents 316fddbf58e2
children 049dc907c17a
comparison
equal deleted inserted replaced
3658:0db1aaedbbef 3659:98af8a976fc3
248 See also `specifier-matching-instance' for a fuller description of the 248 See also `specifier-matching-instance' for a fuller description of the
249 matching process." 249 matching process."
250 250
251 (setq face (get-face face)) 251 (setq face (get-face face))
252 (let ((value (get face property))) 252 (let ((value (get face property)))
253 (if (specifierp value) 253 (when (specifierp value)
254 (setq value (if (or (charsetp matchspec) 254 (setq value (specifier-matching-instance value matchspec domain
255 (and (symbolp matchspec) 255 default no-fallback)))
256 (find-charset matchspec)))
257 (or
258 (specifier-matching-instance
259 value (cons matchspec nil) domain default
260 no-fallback)
261 (specifier-matching-instance
262 value (cons matchspec t) domain default
263 no-fallback))
264 (specifier-matching-instance value matchspec domain
265 default no-fallback))))
266 value)) 256 value))
267 257
268 (defun set-face-property (face property value &optional locale tag-set 258 (defun set-face-property (face property value &optional locale tag-set
269 how-to-add) 259 how-to-add)
270 "Change a property of FACE. 260 "Change a property of FACE.
471 461
472 Normally DOMAIN will be a window or nil (meaning the selected window), 462 Normally DOMAIN will be a window or nil (meaning the selected window),
473 and an instance object describing how the font appears in that 463 and an instance object describing how the font appears in that
474 particular window and buffer will be returned. 464 particular window and buffer will be returned.
475 465
466 CHARSET is a Mule charset (meaning return the font used for that charset) or
467 nil (meaning return the font used for ASCII.)
468
476 See `face-property-instance' for more information." 469 See `face-property-instance' for more information."
477 (if charset 470 (if (null charset)
478 (face-property-matching-instance face 'font charset domain) 471 (face-property-instance face 'font domain)
479 (face-property-instance face 'font domain))) 472 (let (matchspec)
473 ;; get-charset signals an error if its argument doesn't have an
474 ;; associated charset.
475 (setq charset (get-charset charset)
476 matchspec (cons charset nil))
477 (or (null (setcdr matchspec 'initial))
478 (face-property-matching-instance
479 face 'font matchspec domain)
480 (null (setcdr matchspec 'final))
481 (face-property-matching-instance
482 face 'font matchspec domain)))))
480 483
481 (defun set-face-font (face font &optional locale tag-set how-to-add) 484 (defun set-face-font (face font &optional locale tag-set how-to-add)
482 "Change the font of FACE to FONT in LOCALE. 485 "Change the font of FACE to FONT in LOCALE.
483 486
484 FACE may be either a face object or a symbol representing a face. 487 FACE may be either a face object or a symbol representing a face.
485 488
486 FONT should be an instantiator (see `make-font-specifier'), a list of 489 FONT should be an instantiator (see `make-font-specifier'; a common
487 instantiators, an alist of specifications (each mapping a 490 instantiator is a platform-dependent string naming the font), a list
488 locale to an instantiator list), or a font specifier object. 491 of instantiators, an alist of specifications (each mapping a locale
489 492 to an instantiator list), or a font specifier object.
490 If FONT is an alist, LOCALE must be omitted. If FONT is a 493
491 specifier object, LOCALE can be a locale, a locale type, `all', 494 If FONT is an alist, LOCALE must be omitted. If FONT is a specifier
492 or nil; see `copy-specifier' for its semantics. Otherwise LOCALE 495 object, LOCALE can be a locale, a locale type, `all', or nil; see
493 specifies the locale under which the specified instantiator(s) 496 `copy-specifier' for its semantics. Common LOCALEs are buffer
494 will be added, and defaults to `global'. 497 objects, window objects, device objects and `global'. Otherwise
498 LOCALE specifies the locale under which the specified
499 instantiator(s) will be added, and defaults to `global'.
495 500
496 See `set-face-property' for more information." 501 See `set-face-property' for more information."
497 (interactive (face-interactive "font")) 502 (interactive (face-interactive "font"))
498 (set-face-property face 'font font locale tag-set how-to-add)) 503 (set-face-property face 'font font locale tag-set how-to-add))
499 504