All right. Following Ben and Kyle's suggestions, here's a new
patch. Instead of implementing a new face property, I've just implemented an
X11 version of the dim property (BTW, this property doesn't seem to work on my
ttys ?).
I'll leave the windows port to someone who knows this platform.
Lisp changelog:
==============
1998-07-17 Didier Verna <verna(a)inf.enst.fr>
* faces.el (set-face-property):
(set-face-dim-p):
(face-dim-p): updated the doc strings now that the dim property isn't
tty-specific.
(face-equal): the dim property is now a common one.
* cus-face.el (custom-face-attributes): New face attribute: `dim'
Renamed the `stipple' attribute to `background-pixmap'.
(custom-face-background-pixmap): make custom-face-stipple an
obsolete alias for this.
C changelog:
===========
1998-07-17 Didier Verna <verna(a)inf.enst.fr>
* redisplay-x.c (x_get_gc): returns a GC with a FillStipple fill
style as foreground GC for faces that have the `dim' property.
(x_output_string): when the `dim' face property is set,
ensure the gray pixmap has been created, and get a proper
foreground GC to draw the text.
--- lisp/faces.el.orig Mon Jul 20 10:49:53 1998
+++ lisp/faces.el Mon Jul 20 11:51:41 1998
@@ -318,7 +318,6 @@
For valid instantiators, see `face-boolean-specifier-p'.
dim Dim all text covered by this face.
- Only used by faces on TTY devices.
For valid instantiators, see `face-boolean-specifier-p'.
blinking Blink all text covered by this face.
@@ -690,12 +689,12 @@
(set-face-property face 'highlight highlight-p locale tag-set how-to-add))
(defun face-dim-p (face &optional domain default no-fallback)
- "Return t if FACE is dimmed in DOMAIN (TTY domains only).
+ "Return t if FACE is dimmed in DOMAIN.
See `face-property-instance' for the semantics of the DOMAIN argument."
(face-property-instance face 'dim domain default no-fallback))
(defun set-face-dim-p (face dim-p &optional locale tag-set how-to-add)
- "Change whether FACE is dimmed in LOCALE (TTY locales only).
+ "Change whether FACE is dimmed in LOCALE.
DIM-P is normally a face-boolean instantiator; see
`face-boolean-specifier-p'.
See `set-face-property' for the semantics of the LOCALE, TAG-SET, and
@@ -750,9 +749,10 @@
(if (not (valid-specifier-domain-p domain))
(error "Invalid specifier domain"))
(let ((device (dfw-device domain))
- (common-props '(foreground background font display-table underline))
+ (common-props '(foreground background font display-table underline
+ dim))
(win-props '(background-pixmap strikethru))
- (tty-props '(highlight dim blinking reverse)))
+ (tty-props '(highlight blinking reverse)))
;; First check the properties which are used in common between the
;; x and tty devices. Then, check those properties specific to
--- lisp/cus-face.el.orig Mon Jul 20 12:06:24 1998
+++ lisp/cus-face.el Mon Jul 20 12:27:30 1998
@@ -67,13 +67,17 @@
:help-echo "\
Text size (e.g. 9pt or 2mm).")
custom-set-face-font-size custom-face-font-size)
- (:stipple (editable-field :format "Stipple: %v"
- :help-echo "Name of background bitmap file.")
- set-face-stipple custom-face-stipple)
(:family (editable-field :format "Font Family: %v"
:help-echo "\
Name of font family to use (e.g. times).")
custom-set-face-font-family custom-face-font-family)
+ (:background-pixmap (editable-field :format "Background pixmap: %v"
+ :help-echo "\
+Name of background pixmap file.")
+ set-face-background-pixmap custom-face-background-pixmap)
+ (:dim (toggle :format "%[Dim%]: %v\n"
+ :help-echo "Control whether the text should be dimmed.")
+ set-face-dim-p face-dim-p)
(:bold (toggle :format "%[Bold%]: %v\n"
:help-echo "Control whether a bold font should be used.")
custom-set-face-bold custom-face-bold)
@@ -85,7 +89,6 @@
:help-echo "\
Control whether the text should be underlined.")
set-face-underline-p face-underline-p)
- ;; #### Should make it work on X
(:strikethru (toggle :format "%[Strikethru%]: %v\n"
:help-echo "\
Control whether the text should be strikethru.")
@@ -178,8 +181,8 @@
(fontobj (font-create-object font)))
(font-italic-p fontobj)))
-(defun custom-face-stipple (face &rest args)
- "Return the name of the stipple file used for FACE."
+(defun custom-face-background-pixmap (face &rest args)
+ "Return the name of the background pixmap file used for FACE."
(let ((image (apply 'specifier-instance
(face-background-pixmap face) args)))
(and image
--- src/redisplay-x.c.orig Mon Jul 20 10:49:53 1998
+++ src/redisplay-x.c Mon Jul 20 12:14:21 1998
@@ -693,8 +693,18 @@
mask |= GCBackground;
}
- if (IMAGE_INSTANCEP (bg_pmap)
- && IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (bg_pmap)))
+ /* This special case comes from a request to draw text with a face which has
+ the dim property. We'll use a stippled foreground GC. */
+ if (EQ (bg_pmap, Qdim))
+ {
+ assert (DEVICE_X_GRAY_PIXMAP (d) != None);
+
+ gcv.fill_style = FillStippled;
+ gcv.stipple = DEVICE_X_GRAY_PIXMAP (d);
+ mask |= (GCFillStyle | GCStipple);
+ }
+ else if (IMAGE_INSTANCEP (bg_pmap)
+ && IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (bg_pmap)))
{
if (XIMAGE_INSTANCE_PIXMAP_DEPTH (bg_pmap) == 0)
{
@@ -915,6 +925,18 @@
if (cursor && cursor_cachel && focus && NILP
(bar_cursor_value))
gc = x_get_gc (d, font, cursor_cachel->foreground,
cursor_cachel->background, Qnil, Qnil);
+ else if (cachel->dim)
+ {
+ /* Ensure the gray bitmap exists */
+ if (DEVICE_X_GRAY_PIXMAP (d) == None)
+ DEVICE_X_GRAY_PIXMAP (d) =
+ XCreateBitmapFromData (dpy, x_win, (char *)gray_bits,
+ gray_width, gray_height);
+
+ /* Request a GC with the gray stipple pixmap to draw dimmed text */
+ gc = x_get_gc (d, font, cachel->foreground, cachel->background,
+ Qdim, Qnil);
+ }
else
gc = x_get_gc (d, font, cachel->foreground, cachel->background,
Qnil, Qnil);