Initial revision
[chise/xemacs-chise.git.1] / lisp / glyphs.el
1 ;;; glyphs.el --- Lisp interface to C glyphs
2
3 ;; Copyright (C) 1994, 1997 Free Software Foundation, Inc.
4 ;; Copyright (C) 1995, 1996, 2000 Ben Wing.
5
6 ;; Author: Chuck Thompson <cthomp@cs.uiuc.edu>, Ben Wing <ben@xemacs.org>
7 ;; Maintainer: XEmacs Development Team
8 ;; Keywords: extensions, internal, dumped
9
10 ;; This file is part of XEmacs.
11
12 ;; XEmacs is free software; you can redistribute it and/or modify it
13 ;; under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; any later version.
16
17 ;; XEmacs is distributed in the hope that it will be useful, but
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20 ;; General Public License for more details.
21
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with XEmacs; see the file COPYING.  If not, write to the
24 ;; Free Software Foundation, 59 Temple Place - Suite 330,
25 ;; Boston, MA 02111-1307, USA.
26
27 ;;; Synched up with: Not in FSF.
28
29 ;;; Authorship:
30
31 ;; Prototype created 1995 by Chuck Thompson.
32 ;; Completely rewritten by Ben Wing, 1995.
33 ;; Various cleanups (esp. doc strings) by Ben Wing, May 2000.
34
35 ;;; Commentary:
36
37 ;; This file is dumped with XEmacs.
38
39 ;;; Code:
40
41 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; image specifiers
42
43 (defun make-image-specifier (spec-list)
44   "Return a new `image' specifier object with the specification list SPEC-LIST.
45 SPEC-LIST can be a list of specifications (each of which is a cons of a
46 locale and a list of instantiators), a single instantiator, or a list
47 of instantiators.  See `make-specifier' for more information about
48 specifiers.
49
50 An image specifier is used for images (pixmaps, widgets and the like).
51 It is used to describe the actual image in a glyph.  It is instanced
52 as an image-instance.  Note that \"image\" as used in XEmacs does not
53 actually refer to what the term \"image\" normally means (a picture,
54 e.g. in .GIF or .JPG format, and called a \"pixmap\" in XEmacs), but
55 includes all types of graphical elements, including pixmaps, widgets
56 \(buttons, sliders, text fields, etc.) and even strings of text.
57
58 Note that, in practice, you rarely, if ever, need to actually create
59 an image specifier! (The function `make-image-specifier' exists mainly
60 for completeness.) Pretty much the only use for image specifiers is to
61 control how glyphs are displayed, and the image specifier associated
62 with a glyph (the `image' property of a glyph) is created
63 automatically when a glyph is created (see `make-glyph') and need not
64 \(and cannot, for that matter) ever be changed.  In fact, the design
65 decision to create a separate image specifier type, rather than make
66 glyphs themselves be specifiers, is debatable -- the other properties
67 of glyphs are rarely used and could conceivably have been incorporated
68 into the glyph's instantiator.  The rarely used glyph types (buffer,
69 pointer, icon) could also have been incorporated into the instantiator.
70
71 Image instantiators come in many formats: `xbm', `xpm', `gif', `jpeg',
72 etc.  This describes the format of the data describing the image.  The
73 resulting image instances also come in many types -- `mono-pixmap',
74 `color-pixmap', `text', `pointer', etc.  This refers to the behavior of
75 the image and the sorts of places it can appear. (For example, a
76 color-pixmap image has fixed colors specified for it, while a
77 mono-pixmap image comes in two unspecified shades \"foreground\" and
78 \"background\" that are determined from the face of the glyph or
79 surrounding text; a text image appears as a string of text and has an
80 unspecified foreground, background, and font; a pointer image behaves
81 like a mono-pixmap image but can only be used as a mouse pointer
82 \[mono-pixmap images cannot be used as mouse pointers]; etc.) It is
83 important to keep the distinction between image instantiator format and
84 image instance type in mind.  Typically, a given image instantiator
85 format can result in many different image instance types (for example,
86 `xpm' can be instanced as `color-pixmap', `mono-pixmap', or `pointer';
87 whereas `cursor-font' can be instanced only as `pointer'), and a
88 particular image instance type can be generated by many different
89 image instantiator formats (e.g.  `color-pixmap' can be generated by `xpm',
90 `gif', `jpeg', etc.).
91
92 See `make-image-instance' for a more detailed discussion of image
93 instance types.
94
95 An image instantiator should be a string or a vector of the form
96
97  [FORMAT :KEYWORD VALUE ...]
98
99 i.e. a format symbol followed by zero or more alternating keyword-value
100 pairs.  FORMAT should be one of
101
102 'nothing
103    Don't display anything; no keywords are valid for this.
104    Can only be instanced as `nothing'.
105 'string
106    Display this image as a text string.  Can only be instanced
107    as `text', although support for instancing as `mono-pixmap'
108    and `color-pixmap' should be added.
109 'formatted-string
110    Display this image as a text string, with replaceable fields;
111    not currently implemented. (It is, instead, equivalent to `string'.)
112 'xbm
113    An X bitmap; only if X or MS Windows support was compiled into this
114    XEmacs.  Can be instanced as `mono-pixmap', `color-pixmap', or `pointer'.
115 'xpm
116    An XPM pixmap; only if XPM support was compiled into this XEmacs.
117    Can be instanced as `color-pixmap', `mono-pixmap', or `pointer'.
118 'xface
119    An X-Face bitmap, used to encode people's faces in e-mail messages;
120    only if X-Face support was compiled into this XEmacs.  Can be
121    instanced as `mono-pixmap', `color-pixmap', or `pointer'.
122 'gif
123    A GIF87 or GIF89 image; only if GIF support was compiled into this
124    XEmacs.  NOTE: only the first frame of animated gifs will be displayed.
125    Can be instanced as `color-pixmap'.
126 'jpeg
127    A JPEG image; only if JPEG support was compiled into this XEmacs.
128    Can be instanced as `color-pixmap'.
129 'png
130    A PNG image; only if PNG support was compiled into this XEmacs.
131    Can be instanced as `color-pixmap'.
132 'tiff
133    A TIFF image; only if TIFF support was compiled into this XEmacs.
134    Can be instanced as `color-pixmap'.
135 'bmp
136    A MS Windows BMP image; only if MS Windows support was compiled into
137    this XEmacs.  Can be instanced as `color-pixmap'.
138 'cursor-font
139    One of the standard cursor-font names, such as \"watch\" or
140    \"right_ptr\" under X.  Under X, this is, more specifically, any
141    of the standard cursor names from appendix B of the Xlib manual
142    [also known as the file <X11/cursorfont.h>] minus the XC_ prefix.
143    On other window systems, the valid names will be specific to the
144    type of window system.  Can only be instanced as `pointer'.
145 'mswindows-resource
146    An MS Windows pointer resource.  Specifies a resource to retrieve
147    directly from the system (an OEM resource) or from a file, particularly
148    an executable file.  If the resource is to be retrieved from a file, use
149    :file and optionally :resource-id.  Otherwise use :resource-id.  Always
150    specify :resource-type to specify the type (cursor, bitmap or icon) of
151    the resource.  Possible values for :resource-id are listed below.  Can
152    be instanced as `pointer' or `color-pixmap'.
153 'font
154    A glyph from a font; i.e. the name of a font, and glyph index into it
155    of the form \"FONT fontname index [[mask-font] mask-index]\".
156    Currently can only be instanced as `pointer', although this should
157    probably be fixed.
158 'subwindow
159    An embedded windowing system window.  Can only be instanced as
160    `subwindow'.
161 'button
162    A button widget; either a push button, radio button or toggle button.
163    Can only be instanced as `widget'.
164 'combo-box
165    A drop list of selectable items in a widget, for editing text.
166    Can only be instanced as `widget'.
167 'edit-field
168    A text editing widget.  Can only be instanced as `widget'.
169 'label
170    A static, text-only, widget; for displaying text.  Can only be instanced
171    as `widget'.
172 'layout
173    A widget for controlling the positioning of children underneath it.
174    Through the use of nested layouts, a widget hierarchy can be created
175    which can have the appearance of any standard dialog box or similar
176    arrangement; all of this is counted as one \"glyph\" and could appear
177    in many of the places that expect a single glyph.  Can only be instanced
178    as `widget'.
179 'native-layout
180    The native version of a layout widget.  #### Document me better!
181    Can only be instanced as `widget'.
182 'progress-gauge
183    A sliding widget, for showing progress.  Can only be instanced as
184    `widget'.
185 'tab-control
186    A tab widget; a series of user selectable tabs.  Can only be instanced
187    as `widget'.
188 'tree-view
189    A folding widget.  Can only be instanced as `widget'.
190 'scrollbar
191    A scrollbar widget.  Can only be instanced as `widget'.
192 'autodetect
193    XEmacs tries to guess what format the data is in.  If X support
194    exists, the data string will be checked to see if it names a filename.
195    If so, and this filename contains XBM or XPM data, the appropriate
196    sort of pixmap or pointer will be created. [This includes picking up
197    any specified hotspot or associated mask file.] Otherwise, if `pointer'
198    is one of the allowable image-instance types and the string names a
199    valid cursor-font name, the image will be created as a pointer.
200    Otherwise, the image will be displayed as text.  If no X support
201    exists, the image will always be displayed as text.  Can be instanced as
202    `mono-pixmap', `color-pixmap', `pointer', or `text'.
203 'inherit
204    Inherit from the background-pixmap property of a face.  Can only be
205    instanced as `mono-pixmap'.
206
207 The valid keywords are:
208
209 :data
210    Inline data.  For most formats above, this should be a string.  For
211    XBM images, this should be a list of three elements: width, height, and
212    a string of bit data.  This keyword is valid for all of the bitmap/pixmap
213    formats, as well as `string', `formatted-string', `font', `cursor-font',
214    and `autodetect'.
215 :file
216    Data is contained in a file.  The value is the name of this file.
217    If both :data and :file are specified, the image is created from
218    what is specified in :data and the string in :file becomes the
219    value of the `image-instance-file-name' function when applied to
220    the resulting image-instance.  This keyword is valid for all of the
221    bitmap/pixmap formats as well as `mswindows-resource'.
222 :foreground
223 :background
224    For `xbm', `xface', `cursor-font', `widget' and `font'.  These keywords
225    allow you to explicitly specify foreground and background colors.
226    The argument should be anything acceptable to `make-color-instance'.
227    This will cause what would be a `mono-pixmap' to instead be colorized
228    as a two-color color-pixmap, and specifies the foreground and/or
229    background colors for a pointer instead of black and white.
230 :mask-data
231    For `xbm' and `xface'.  This specifies a mask to be used with the
232    bitmap.  The format is a list of width, height, and bits, like for
233    :data.
234 :mask-file
235    For `xbm' and `xface'.  This specifies a file containing the mask data.
236    If neither a mask file nor inline mask data is given for an XBM image,
237    and the XBM image comes from a file, XEmacs will look for a mask file
238    with the same name as the image file but with \"Mask\" or \"msk\"
239    appended.  For example, if you specify the XBM file \"left_ptr\"
240    [usually located in \"/usr/include/X11/bitmaps\"], the associated
241    mask file \"left_ptrmsk\" will automatically be picked up.
242 :hotspot-x
243 :hotspot-y
244    For `xbm' and `xface'.  These keywords specify a hotspot if the image
245    is instantiated as a `pointer'.  Note that if the XBM image file
246    specifies a hotspot, it will automatically be picked up if no
247    explicit hotspot is given.
248 :color-symbols
249    Only for `xpm'.  This specifies an alist that maps strings
250    that specify symbolic color names to the actual color to be used
251    for that symbolic color (in the form of a string or a color-specifier
252    object).  If this is not specified, the contents of `xpm-color-symbols'
253    are used to generate the alist.
254 :resource-id
255    Only for `mswindows-resource'.  This must be either an integer (which
256    directly specifies a resource number) or a string.  Valid strings are
257
258    -- For bitmaps:
259
260    \"close\", \"uparrow\", \"dnarrow\", \"rgarrow\", \"lfarrow\",
261    \"reduce\", \"zoom\", \"restore\", \"reduced\", \"zoomd\",
262    \"restored\", \"uparrowd\", \"dnarrowd\", \"rgarrowd\", \"lfarrowd\",
263    \"mnarrow\", \"combo\", \"uparrowi\", \"dnarrowi\", \"rgarrowi\",
264    \"lfarrowi\", \"size\", \"btsize\", \"check\", \"checkboxes\", and
265    \"btncorners\".
266
267    -- For cursors:
268
269    \"normal\", \"ibeam\", \"wait\", \"cross\", \"up\", \"sizenwse\",
270    \"sizenesw\", \"sizewe\", \"sizens\", \"sizeall\", and \"no\".
271
272    -- For icons:
273
274    \"sample\", \"hand\", \"ques\", \"bang\", \"note\", and \"winlogo\".
275 :resource-type
276    Only for `mswindows-resource'.  This must be a symbol, either `cursor',
277    `icon', or `bitmap', specifying the type of resource to be retrieved.
278 :face
279    Only for `inherit'.  This specifies the face to inherit from.
280    For widgets this also specifies the face to use for display. It defaults
281    to gui-element-face.
282
283 Keywords accepted as menu item specs are also accepted by widgets.
284 These are `:selected', `:active', `:suffix', `:keys', `:style',
285 `:filter', `:config', `:included', `:key-sequence', `:accelerator',
286 `:label' and `:callback'.
287
288 If instead of a vector, the instantiator is a string, it will be
289 converted into a vector by looking it up according to the specs in the
290 `console-type-image-conversion-list' (q.v.) for the console type of
291 the domain (usually a window; sometimes a frame or device) over which
292 the image is being instantiated.
293
294 If the instantiator specifies data from a file, the data will be read
295 in at the time that the instantiator is added to the image (which may
296 be well before when the image is actually displayed), and the
297 instantiator will be converted into one of the inline-data forms, with
298 the filename retained using a :file keyword.  This implies that the
299 file must exist when the instantiator is added to the image, but does
300 not need to exist at any other time (e.g. it may safely be a temporary
301 file).
302 "
303   (make-specifier-and-init 'image spec-list))
304
305 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; glyphs
306
307 (defconst built-in-glyph-specifiers
308   '(image contrib-p baseline)
309   "A list of the built-in glyph properties that are specifiers.")
310
311 (defun glyph-property (glyph property &optional locale)
312   "Return GLYPH's value of PROPERTY in LOCALE.
313
314 If LOCALE is omitted, the GLYPH's actual value for PROPERTY will be
315   returned.  For built-in properties, this will be a specifier object
316   of a type appropriate to the property (e.g. a font or color
317   specifier).  For other properties, this could be anything.
318
319 If LOCALE is supplied, then instead of returning the actual value,
320   the specification(s) for the given locale or locale type will
321   be returned.  This will only work if the actual value of
322   PROPERTY is a specifier (this will always be the case for built-in
323   properties, but not or not may apply to user-defined properties).
324   If the actual value of PROPERTY is not a specifier, this value
325   will simply be returned regardless of LOCALE.
326
327 The return value will be a list of instantiators (e.g. strings
328   specifying a font or color name), or a list of specifications, each
329   of which is a cons of a locale and a list of instantiators.
330   Specifically, if LOCALE is a particular locale (a buffer, window,
331   frame, device, or 'global), a list of instantiators for that locale
332   will be returned.  Otherwise, if LOCALE is a locale type (one of
333   the symbols 'buffer, 'window, 'frame, 'device, 'device-class, or
334   'device-type), the specifications for all locales of that type will
335   be returned.  Finally, if LOCALE is 'all, the specifications for all
336   locales of all types will be returned.
337
338 The specifications in a specifier determine what the value of
339   PROPERTY will be in a particular \"domain\" or set of circumstances,
340   which is typically a particular Emacs window along with the buffer
341   it contains and the frame and device it lies within.  The value
342   is derived from the instantiator associated with the most specific
343   locale (in the order buffer, window, frame, device, and 'global)
344   that matches the domain in question.  In other words, given a domain
345   (i.e. an Emacs window, usually), the specifier for PROPERTY will first
346   be searched for a specification whose locale is the buffer contained
347   within that window; then for a specification whose locale is the window
348   itself; then for a specification whose locale is the frame that the
349   window is contained within; etc.  The first instantiator that is
350   valid for the domain (usually this means that the instantiator is
351   recognized by the device [i.e. the X server or TTY device] that the
352   domain is on.  The function `glyph-property-instance' actually does
353   all this, and is used to determine how to display the glyph.
354
355 See `set-glyph-property' for the built-in property-names."
356   (check-argument-type 'glyphp glyph)
357   (let ((value (get glyph property)))
358     (if (and locale
359              (or (memq property built-in-glyph-specifiers)
360                  (specifierp value)))
361         (setq value (specifier-specs value locale)))
362     value))
363
364 (defun convert-glyph-property-into-specifier (glyph property)
365   "Convert PROPERTY on GLYPH into a specifier, if it's not already."
366   (check-argument-type 'glyphp glyph)
367   (let ((specifier (get glyph property)))
368     ;; if a user-property does not have a specifier but a
369     ;; locale was specified, put a specifier there.
370     ;; If there was already a value there, convert it to a
371     ;; specifier with the value as its 'global instantiator.
372     (if (not (specifierp specifier))
373         (let ((new-specifier (make-specifier 'generic)))
374           (if (or (not (null specifier))
375                   ;; make sure the nil returned from `get' wasn't
376                   ;; actually the value of the property
377                   (null (get glyph property t)))
378               (add-spec-to-specifier new-specifier specifier))
379           (setq specifier new-specifier)
380           (put glyph property specifier)))))
381
382 (defun glyph-property-instance (glyph property
383                                       &optional domain default no-fallback)
384   "Return the instance of GLYPH's PROPERTY in the specified DOMAIN.
385
386 Under most circumstances, DOMAIN will be a particular window,
387   and the returned instance describes how the specified property
388   actually is displayed for that window and the particular buffer
389   in it.  Note that this may not be the same as how the property
390   appears when the buffer is displayed in a different window or
391   frame, or how the property appears in the same window if you
392   switch to another buffer in that window; and in those cases,
393   the returned instance would be different.
394
395 DOMAIN defaults to the selected window if omitted.
396
397 DOMAIN can be a frame or device, instead of a window.  The value
398   returned for a such a domain is used in special circumstances
399   when a more specific domain does not apply; for example, a frame
400   value might be used for coloring a toolbar, which is conceptually
401   attached to a frame rather than a particular window.  The value
402   is also useful in determining what the value would be for a
403   particular window within the frame or device, if it is not
404   overridden by a more specific specification.
405
406 If PROPERTY does not name a built-in property, its value will
407   simply be returned unless it is a specifier object, in which case
408   it will be instanced using `specifier-instance'.
409
410 Optional arguments DEFAULT and NO-FALLBACK are the same as in
411   `specifier-instance'."
412   (check-argument-type 'glyphp glyph)
413   (let ((value (get glyph property)))
414     (if (specifierp value)
415         (setq value (specifier-instance value domain default no-fallback)))
416     value))
417
418 (defun set-glyph-property (glyph property value &optional locale tag-set
419                                  how-to-add)
420   "Change a property of a GLYPH.
421
422 NOTE: If you want to remove a property from a glyph, use
423   `remove-glyph-property' rather than attempting to set a value of nil
424    for the property.
425
426 For built-in properties, the actual value of the property is a
427   specifier and you cannot change this; but you can change the
428   specifications within the specifier, and that is what this function
429   will do.  For user-defined properties, you can use this function
430   to either change the actual value of the property or, if this value
431   is a specifier, change the specifications within it.
432
433 If PROPERTY is a built-in property, the specifications to be added to
434   this property can be supplied in many different ways:
435
436   -- If VALUE is a simple instantiator (e.g. a string naming a font or
437      color) or a list of instantiators, then the instantiator(s) will
438      be added as a specification of the property for the given LOCALE
439      (which defaults to 'global if omitted).
440   -- If VALUE is a list of specifications (each of which is a cons of
441      a locale and a list of instantiators), then LOCALE must be nil
442      (it does not make sense to explicitly specify a locale in this
443      case), and specifications will be added as given.
444   -- If VALUE is a specifier (as would be returned by `glyph-property'
445      if no LOCALE argument is given), then some or all of the
446      specifications in the specifier will be added to the property.
447      In this case, the function is really equivalent to
448      `copy-specifier' and LOCALE has the same semantics (if it is
449      a particular locale, the specification for the locale will be
450      copied; if a locale type, specifications for all locales of
451      that type will be copied; if nil or 'all, then all
452      specifications will be copied).
453
454 HOW-TO-ADD should be either nil or one of the symbols 'prepend,
455   'append, 'remove-tag-set-prepend, 'remove-tag-set-append, 'remove-locale,
456   'remove-locale-type, or 'remove-all.  See `copy-specifier' and
457   `add-spec-to-specifier' for a description of what each of
458   these means.  Most of the time, you do not need to worry about
459   this argument; the default behavior usually is fine.
460
461 In general, it is OK to pass an instance object (e.g. as returned
462   by `glyph-property-instance') as an instantiator in place of
463   an actual instantiator.  In such a case, the instantiator used
464   to create that instance object will be used (for example, if
465   you set a font-instance object as the value of the 'font
466   property, then the font name used to create that object will
467   be used instead).  If some cases, however, doing this
468   conversion does not make sense, and this will be noted in
469   the documentation for particular types of instance objects.
470
471 If PROPERTY is not a built-in property, then this function will
472   simply set its value if LOCALE is nil.  However, if LOCALE is
473   given, then this function will attempt to add VALUE as the
474   instantiator for the given LOCALE, using `add-spec-to-specifier'.
475   If the value of the property is not a specifier, it will
476   automatically be converted into a 'generic specifier.
477
478
479 The following symbols have predefined meanings:
480
481  image          The image used to display the glyph.
482
483  baseline       Percent above baseline that glyph is to be
484                 displayed.
485
486  contrib-p      Whether the glyph contributes to the
487                 height of the line it's on.
488
489  face           Face of this glyph (*not* a specifier)."
490   (check-argument-type 'glyphp glyph)
491   (if (memq property built-in-glyph-specifiers)
492       (set-specifier (get glyph property) value locale tag-set how-to-add)
493
494     ;; This section adds user defined properties.
495     (if (not locale)
496         (put glyph property value)
497       (convert-glyph-property-into-specifier glyph property)
498       (add-spec-to-specifier (get glyph property) value locale tag-set
499                              how-to-add)))
500   value)
501
502 (defun remove-glyph-property (glyph property &optional locale tag-set exact-p)
503   "Remove a property from a glyph.
504 For built-in properties, this is analogous to `remove-specifier'.
505 See `remove-specifier' for the meaning of the LOCALE, TAG-SET, and EXACT-P
506   arguments."
507   (or locale (setq locale 'all))
508   (if (memq property built-in-glyph-specifiers)
509       (remove-specifier (glyph-property glyph property) locale tag-set exact-p)
510     (if (eq locale 'all)
511         (remprop glyph property)
512       (convert-glyph-property-into-specifier glyph property)
513       (remove-specifier (glyph-property glyph property) locale tag-set
514                         exact-p))))
515
516 (defun glyph-face (glyph)
517   "Return the face of GLYPH."
518   (glyph-property glyph 'face))
519
520 (defun set-glyph-face (glyph face)
521   "Change the face of GLYPH to FACE."
522 ;  (interactive (glyph-interactive "face"))
523   (set-glyph-property glyph 'face face))
524
525 (defun glyph-image (glyph &optional locale)
526   "Return the image of GLYPH in LOCALE, or nil if it is unspecified.
527
528 LOCALE may be a locale (the instantiators for that particular locale
529   will be returned), a locale type (the specifications for all locales
530   of that type will be returned), 'all (all specifications will be
531   returned), or nil (the actual specifier object will be returned).
532
533 See `glyph-property' for more information."
534   (glyph-property glyph 'image locale))
535
536 (defun glyph-image-instance (glyph &optional domain default no-fallback)
537   "Return the instance of GLYPH's image in DOMAIN.
538
539 Normally DOMAIN will be a window or nil (meaning the selected window),
540   and an instance object describing how the image appears in that
541   particular window and buffer will be returned.
542
543 See `glyph-property-instance' for more information."
544   (glyph-property-instance glyph 'image domain default no-fallback))
545
546 (defun set-glyph-image (glyph spec &optional locale tag-set how-to-add)
547   "Change the image of GLYPH in LOCALE.
548
549 SPEC should be an instantiator (a string or vector; see
550   `make-image-specifier' for a description of possible values here),
551   a list of (possibly tagged) instantiators, an alist of specifications
552   (each mapping a locale to an instantiator list), or an image specifier
553   object.
554
555 If SPEC is an alist, LOCALE must be omitted.  If SPEC is a
556   specifier object, LOCALE can be a locale, a locale type, 'all,
557   or nil; see `copy-specifier' for its semantics.  Otherwise LOCALE
558   specifies the locale under which the specified instantiator(s)
559   will be added, and defaults to 'global.
560
561 See `set-glyph-property' for more information."
562   ; (interactive (glyph-interactive "image"))
563   (set-glyph-property glyph 'image spec locale tag-set how-to-add))
564
565 (defun glyph-contrib-p (glyph &optional locale)
566   "Return whether GLYPH contributes to its line height.
567
568 LOCALE may be a locale (the instantiators for that particular locale
569   will be returned), a locale type (the specifications for all locales
570   of that type will be returned), 'all (all specifications will be
571   returned), or nil (the actual specifier object will be returned).
572
573 See `glyph-property' for more information."
574   (glyph-property glyph 'contrib-p locale))
575
576 (defun glyph-contrib-p-instance (glyph &optional domain default no-fallback)
577   "Return the instance of GLYPH's 'contrib-p property in DOMAIN.
578
579 Normally DOMAIN will be a window or nil (meaning the selected window),
580   and an instance object describing what the 'contrib-p property is in
581   that particular window and buffer will be returned.
582
583 See `glyph-property-instance' for more information."
584   (glyph-property-instance glyph 'contrib-p domain default no-fallback))
585
586 (defun set-glyph-contrib-p (glyph spec &optional locale tag-set how-to-add)
587   "Change the contrib-p property of GLYPH in LOCALE.
588
589 SPEC should be an instantiator (t or nil), a list of (possibly
590   tagged) instantiators, an alist of specifications (each mapping a
591   locale to an instantiator list), or a boolean specifier object.
592
593 If SPEC is an alist, LOCALE must be omitted.  If SPEC is a
594   specifier object, LOCALE can be a locale, a locale type, 'all,
595   or nil; see `copy-specifier' for its semantics.  Otherwise LOCALE
596   specifies the locale under which the specified instantiator(s)
597   will be added, and defaults to 'global.
598
599 See `set-glyph-property' for more information."
600   ; (interactive (glyph-interactive "contrib-p"))
601   (set-glyph-property glyph 'contrib-p spec locale tag-set how-to-add))
602
603 (defun glyph-baseline (glyph &optional locale)
604   "Return the baseline of GLYPH in LOCALE, or nil if it is unspecified.
605
606 LOCALE may be a locale (the instantiators for that particular locale
607   will be returned), a locale type (the specifications for all locales
608   of that type will be returned), 'all (all specifications will be
609   returned), or nil (the actual specifier object will be returned).
610
611 See `glyph-property' for more information."
612   (glyph-property glyph 'baseline locale))
613
614 (defun glyph-baseline-instance (glyph &optional domain default no-fallback)
615   "Return the instance of GLYPH's baseline in DOMAIN.
616
617 Normally DOMAIN will be a window or nil (meaning the selected window),
618   and an integer or nil (specifying the baseline in that particular
619   window and buffer) will be returned.
620
621 See `glyph-property-instance' for more information."
622   (glyph-property-instance glyph 'baseline domain default no-fallback))
623
624 (defun set-glyph-baseline (glyph spec &optional locale tag-set how-to-add)
625   "Change the baseline of GLYPH to SPEC in LOCALE.
626
627 SPEC should be an instantiator (an integer [a percentage above the
628   baseline of the line the glyph is on] or nil), a list of (possibly
629   tagged) instantiators, an alist of specifications (each mapping a
630   locale to an instantiator list), or a generic specifier object.
631
632 If SPEC is an alist, LOCALE must be omitted.  If SPEC is a
633   specifier object, LOCALE can be a locale, a locale type, 'all,
634   or nil; see `copy-specifier' for its semantics.  Otherwise LOCALE
635   specifies the locale under which the specified instantiator(s)
636   will be added, and defaults to 'global.
637
638 See `set-glyph-property' for more information."
639   ; (interactive (glyph-interactive "baseline"))
640   (set-glyph-property glyph 'baseline spec locale tag-set how-to-add))
641
642 (defun make-glyph (&optional spec-list type)
643   "Create a new glyph of type TYPE.
644
645 A glyph in XEmacs does NOT refer to a single unit of textual display (the
646 XEmacs term for this is \"rune\"), but rather is an object encapsulating
647 a graphical element, such as an image or widget (an element such as a
648 button or text field; \"widget\" is the term for this under X Windows,
649 and it's called a \"control\" under MS Windows).  This graphical element
650 could appear in a buffer, a margin, a gutter, or a toolbar, or as a mouse
651 pointer or an icon, for example.
652
653 Creating a glyph using `make-glyph' does not specify *where* the glyph
654 will be used, but it does specify *what* the glyph will look like.  In
655 particular, SPEC-LIST is used to specify this, and it's used to
656 initialize the glyph's `image' property, which is an image
657 specifier. (Note that \"image\" as used in the context of a glyph's
658 `image' property or in the terms \"image specifier\", \"image
659 instantiator\", or \"image instance\" does not refer to what people
660 normally think of as an image (which in XEmacs is called a
661 \"pixmap\"), but to any graphical element -- a pixmap, a widget, or
662 even a block of text, when used in the places that call for a glyph.)
663 The format of the SPEC-LIST is typically an image instantiator (a
664 string or a vector; see `make-image-specifier' for a detailed description
665 of the valid image instantiators), but can also be a list of such
666 instantiators (each one in turn is tried until an image is
667 successfully produced), a cons of a locale (frame, buffer, etc.)  and
668 an instantiator, a list of such conses, or any other form accepted by
669 `canonicalize-spec-list'.
670
671 If you're not familiar with specifiers, you should be in order to
672 understand how glyphs work.  The clearest introduction to specifiers
673 is in the Lispref manual, available under Info. (Choose
674 Help->Info->Info Contents on the menubar or type \\[info].) You can
675 also see `make-specifier' for a capsule summary.  What's important to
676 keep in mind is that a specifier lets you set a different value for
677 any particular buffer, window, frame, device, or console.  This allows
678 for a great deal of flexibility; in particular, only one global glyph
679 needs to exist for a particular purpose (e.g. the icon used to represent
680 an iconified frame, the mouse pointer used over particular areas of a
681 frame, etc.), and in these cases you do not create your own glyph, but
682 rather modify the existing one.
683
684 As well as using SPEC-LIST to initialize the glyph, you can set
685 specifications using `set-glyph-image'.  Note that, due to a possibly
686 questionable historical design decision, a glyph itself is not
687 actually a specifier, but rather is an object containing an image
688 specifier (as well as other, seldom-used properties).  Therefore, you
689 cannot set or access specifications for the glyph's image by directly
690 using `set-specifier', `specifier-instance' or the like on the glyph;
691 instead use them on `(glyph-image GLYPH)' or use the convenience
692 functions `set-glyph-image', `glyph-image-instance', and
693 `glyph-image'.
694
695 Once you have created a glyph, you specify where it will be used as follows:
696
697 -- To insert a glyph into a buffer, create an extent in the buffer and then
698    use `set-extent-begin-glyph' or `set-extent-end-glyph' to set a glyph
699    to be displayed at the corresponding edge of the extent. (It is common
700    to create zero-width extents for this purpose.)
701
702 -- To insert a glyph into the left or right margin of a buffer, first
703    make sure the margin is visible by setting a value for the specifiers
704    `left-margin-width' or `right-margin-width'. (Not strictly necessary
705    when using margin glyphs with layout policy `whitespace'.) Then follow
706    the same procedure above for inserting a glyph in a buffer, and then
707    set a non-default layout policy for the glyph using
708    `set-extent-begin-glyph-layout' or `set-extent-end-glyph-layout'.
709    Alternatively, use the high-level annotations API (see
710    `make-annotation'). (In point of fact, you can also use the annotations
711    API for glyphs in a buffer, by setting a layout policy of `text'.)
712
713 -- To insert a glyph into the modeline, just put the glyph directly as
714    one of the modeline elements. (Unfortunately you can't currently
715    put a begin glyph or end glyph on one of the modeline extents --
716    they're ignored.)
717
718 -- To insert a glyph into a toolbar, specify it as part of a toolbar
719    instantiator (typically set on the specifier `default-toolbar').
720    See `default-toolbar' for more information. (Note that it is standard
721    practice to use a symbol in place of the glyph list in the toolbar
722    instantiator; the symbol is evalled to get the glyph list.  This
723    facilitates both creating the toolbar instantiator and modifying
724    individual glyphs in a toolbar later on.  For example, you can
725    change the way that the Mail toolbar button looks by modifying the
726    value of the variable `toolbar-mail-icon' (in general, `toolbar-*-icon')
727    and then calling `(set-specifier-dirty-flag default-toolbar)'.
728    (#### Unfortunately this doesn't quite work the way it should; the
729    change will appear in new frames, but not existing ones.
730
731 -- To insert a glyph into a gutter, create or modify a gutter instantiator
732    (typically set on the specifier `default-gutter').  Gutter instantiators
733    consist of strings or lists of strings, so to insert a glyph, create an
734    extent over the string, and use `set-extent-begin-glyph' or
735    `set-extent-end-glyph' to set a glyph to be displayed at the corresponding
736    edge of the extent, just like for glyphs in a buffer.
737
738 -- To use a glyph as the icon for a frame, you do not actually create a new
739    glyph; rather, you change the specifications for the existing glyph
740    `frame-icon-glyph'. (Remember that, because of the specifier nature of
741    glyphs, you can set different values for any particular buffer or frame.)
742
743 -- To use a glyph as the mouse pointer, in general you do not create a
744    new glyph, but rather you change the specifications of various existing
745    glyphs, such as `text-pointer-glyph' for the pointer used over text,
746    `modeline-pointer-glyph' for the pointer used over the modeline, etc.
747    Do an apropos over `*-pointer-glyph' to find all of them. (Note also
748    that you can temporarily set the mouse pointer to some specific shape
749    by using `set-frame-pointer', which takes an image instace, as obtained
750    from calling `glyph-image-instance' on a glyph of type `pointer' --
751    either one of the above-mentioned variables or one you created yourself.
752    (See below for what it means to create a glyph of type `pointer'.)
753    This pointer will last only until the next mouse motion event is
754    processed or certain other things happen, such as creating or deleting
755    a window. (In fact, the above-mentioned pointer glyph variables are
756    implemented as part of the default handler for mouse motion events.
757    If you want to customize this behavior, take a look at `mode-motion-hook',
758    or `mouse-motion-handler' if you really want to get low-level.)
759
760 -- To use a glyph to control the shape of miscellaneous redisplay effects
761    such as the truncation and continuation markers, set the appropriate
762    existing glyph variables, as for icons and pointers above.  See
763    `continuation-glyph', `control-arrow-glyph', `hscroll-glyph',
764    `invisible-text-glyph', `octal-escape-glyph', and `truncation-glyph'.
765    See also `overlay-arrow-string', an odd redisplay leftover which can
766    be set to a glyph you created, and will cause the glyph to be displayed
767    on top of the text position specified in the marker stored in
768    `overlay-arrow-position'.
769
770 -- To use a glyph in a display table (i.e. to control the appearance of
771    any individual character), create the appropriate character glyphs
772    and then set a specification for the specifier `current-display-table',
773    which controls the appearance of characters.  You can also set an
774    overriding display table for use with text displayed in a particular
775    face; see `set-face-display-table' and `make-display-table'.
776    #### Note: Display tables do not currently support general Mule
777    characters.  They will be overhauled at some point to support this
778    and to provide other features required under Mule.
779
780 -- To use a glyph as the background pixmap of a face: Note that the
781    background pixmap of a face is actually an image specifier -- probably
782    the only place in XEmacs where an image specifier occurs outside of
783    a glyph.  Similarly to how the glyph's image specifier works, you
784    don't create your own image specifier, but rather add specifications
785    to the existing one (using `set-face-background-pixmap').  Note that
786    the image instance that is generated in order to actually display the
787    background pixmap is of type `mono-pixmap', meaning that it's a two-color
788    image and the foreground and background of the image get filled in with
789    the corresponding colors from the face.
790
791 It is extremely rare that you will ever have to specify a value for TYPE,
792 which should be one of `buffer' (used for glyphs in an extent, the modeline,
793 the toolbar, or elsewhere in a buffer), `pointer' (used for the mouse-pointer),
794 or `icon' (used for a frame's icon), and defaults to `buffer'.  The only cases
795 where it needs to be specified is when creating icon or pointer glyphs, and
796 in both cases the necessary glyphs have already been created at startup and
797 are accessed through the appropriate variables, e.g. `text-pointer-glyph'
798 (or in general, `*-pointer-glyph') and `frame-icon-glyph'."
799   (let ((glyph (make-glyph-internal type)))
800     (and spec-list (set-glyph-image glyph spec-list))
801     glyph))
802
803 (defun buffer-glyph-p (object)
804   "Return t if OBJECT is a glyph of type `buffer'."
805   (and (glyphp object) (eq 'buffer (glyph-type object))))
806
807 (defun pointer-glyph-p (object)
808   "Return t if OBJECT is a glyph of type `pointer'."
809   (and (glyphp object) (eq 'pointer (glyph-type object))))
810
811 (defun icon-glyph-p (object)
812   "Return t if OBJECT is a glyph of type `icon'."
813   (and (glyphp object) (eq 'icon (glyph-type object))))
814
815 (defun make-pointer-glyph (&optional spec-list)
816   "Return a new `pointer-glyph' object with the specification list SPEC-LIST.
817 This is equivalent to calling `make-glyph', specifying a type of `pointer'.
818 See `make-glyph' for more information.
819
820 It is extremely unlikely that you will ever need to create a pointer glyph.
821 Instead, you probably want to be calling `set-glyph-image' on an existing
822 glyph, e.g. `text-pointer-glyph'."
823   (make-glyph spec-list 'pointer))
824
825 (defun make-icon-glyph (&optional spec-list)
826   "Return a new `icon-glyph' object with the specification list SPEC-LIST.
827 This is equivalent to calling `make-glyph', specifying a type of `icon'.
828 See `make-glyph' for more information.
829
830 It is extremely unlikely that you will ever need to create a icon glyph.
831 Instead, you probably want to be calling `set-glyph-image' on
832 `frame-icon-glyph'."
833   (make-glyph spec-list 'icon))
834
835 (defun nothing-image-instance-p (object)
836   "Return t if OBJECT is an image instance of type `nothing'."
837   (and (image-instance-p object) (eq 'nothing (image-instance-type object))))
838
839 (defun text-image-instance-p (object)
840   "Return t if OBJECT is an image instance of type `text'."
841   (and (image-instance-p object) (eq 'text (image-instance-type object))))
842
843 (defun mono-pixmap-image-instance-p (object)
844   "Return t if OBJECT is an image instance of type `mono-pixmap'."
845   (and (image-instance-p object) (eq 'mono-pixmap
846                                      (image-instance-type object))))
847
848 (defun color-pixmap-image-instance-p (object)
849   "Return t if OBJECT is an image instance of type `color-pixmap'."
850   (and (image-instance-p object) (eq 'color-pixmap
851                                      (image-instance-type object))))
852
853 (defun pointer-image-instance-p (object)
854   "Return t if OBJECT is an image instance of type `pointer'."
855   (and (image-instance-p object) (eq 'pointer (image-instance-type object))))
856
857 (defun widget-image-instance-p (object)
858   "Return t if OBJECT is an image instance of type `widget'."
859   (and (image-instance-p object) (eq 'widget (image-instance-type object))))
860
861 (defun subwindow-image-instance-p (object)
862   "Return t if OBJECT is an image instance of type `subwindow'."
863   (and (image-instance-p object) (eq 'subwindow (image-instance-type object))))
864
865 ;;;;;;;;;; the built-in glyphs
866
867 (defvar text-pointer-glyph (make-pointer-glyph)
868   "*The shape of the mouse-pointer when over text.
869 This is a glyph; use `set-glyph-image' to change it.")
870 (set-glyph-face text-pointer-glyph 'pointer)
871
872 (defvar nontext-pointer-glyph (make-pointer-glyph)
873   "*The shape of the mouse-pointer when over a buffer, but not over text.
874 This is a glyph; use `set-glyph-image' to change it.
875 If unspecified in a particular domain, `text-pointer-glyph' is used.")
876 (set-glyph-face nontext-pointer-glyph 'pointer)
877
878 (defvar modeline-pointer-glyph (make-pointer-glyph)
879   "*The shape of the mouse-pointer when over the modeline.
880 This is a glyph; use `set-glyph-image' to change it.
881 If unspecified in a particular domain, `nontext-pointer-glyph' is used.")
882 (set-glyph-face modeline-pointer-glyph 'pointer)
883
884 (defvar selection-pointer-glyph (make-pointer-glyph)
885   "*The shape of the mouse-pointer when over a selectable text region.
886 This is a glyph; use `set-glyph-image' to change it.
887 If unspecified in a particular domain, `text-pointer-glyph' is used.")
888 (set-glyph-face selection-pointer-glyph 'pointer)
889
890 (defvar busy-pointer-glyph (make-pointer-glyph)
891   "*The shape of the mouse-pointer when XEmacs is busy.
892 This is a glyph; use `set-glyph-image' to change it.
893 If unspecified in a particular domain, the pointer is not changed
894 when XEmacs is busy.")
895 (set-glyph-face busy-pointer-glyph 'pointer)
896
897 (defvar toolbar-pointer-glyph (make-pointer-glyph)
898   "*The shape of the mouse-pointer when over a toolbar.
899 This is a glyph; use `set-glyph-image' to change it.
900 If unspecified in a particular domain, `nontext-pointer-glyph' is used.")
901 (set-glyph-face toolbar-pointer-glyph 'pointer)
902
903 (defvar divider-pointer-glyph (make-pointer-glyph)
904   "*The shape of the mouse-pointer when over a window divider.
905 This is a glyph; use `set-glyph-image' to change it.
906 If unspecified in a particular domain, `nontext-pointer-glyph' is used.")
907 (set-glyph-face divider-pointer-glyph 'pointer)
908
909 ;; The following three are in C.
910 (if (featurep 'menubar)
911     (set-glyph-face menubar-pointer-glyph 'pointer))
912 (if (featurep 'scrollbar)
913     (set-glyph-face scrollbar-pointer-glyph 'pointer))
914 (set-glyph-face gc-pointer-glyph 'pointer)
915
916 ;; Now add the magic access/set behavior.
917
918 (defun dontusethis-set-value-glyph-handler (sym args fun harg handler)
919   (error "Use `set-glyph-image' to set `%s'" sym))
920 (defun dontusethis-make-unbound-glyph-handler (sym args fun harg handler)
921   (error "Can't `makunbound' `%s'" sym))
922 (defun dontusethis-make-local-glyph-handler (sym args fun harg handler)
923   (error "Use `set-glyph-image' to make local values for `%s'" sym))
924
925 (defun define-constant-glyph (sym)
926   (dontusethis-set-symbol-value-handler
927    sym 'set-value
928    'dontusethis-set-value-glyph-handler)
929   (dontusethis-set-symbol-value-handler
930    sym 'make-unbound
931    'dontusethis-make-unbound-glyph-handler)
932   (dontusethis-set-symbol-value-handler
933    sym 'make-local
934    'dontusethis-make-local-glyph-handler)
935   ;; Make frame properties magically work with glyph variables.
936   (put sym 'const-glyph-variable t))
937
938 (define-constant-glyph 'text-pointer-glyph)
939 (define-constant-glyph 'nontext-pointer-glyph)
940 (define-constant-glyph 'modeline-pointer-glyph)
941 (define-constant-glyph 'selection-pointer-glyph)
942 (define-constant-glyph 'busy-pointer-glyph)
943 (define-constant-glyph 'gc-pointer-glyph)
944 (define-constant-glyph 'divider-pointer-glyph)
945 (define-constant-glyph 'toolbar-pointer-glyph)
946 (define-constant-glyph 'menubar-pointer-glyph)
947 (define-constant-glyph 'scrollbar-pointer-glyph)
948
949 (define-constant-glyph 'octal-escape-glyph)
950 (define-constant-glyph 'control-arrow-glyph)
951 (define-constant-glyph 'invisible-text-glyph)
952 (define-constant-glyph 'hscroll-glyph)
953 (define-constant-glyph 'truncation-glyph)
954 (define-constant-glyph 'continuation-glyph)
955
956 (define-constant-glyph 'frame-icon-glyph)
957
958 ;; backwards compatibility garbage
959
960 (defun dontusethis-old-pointer-shape-handler (sym args fun harg handler)
961   (let ((value (car args)))
962     (if (null value)
963         (remove-specifier harg 'global)
964       (set-glyph-image (symbol-value harg) value))))
965
966 ;; It might or might not be garbage, but it's rude.  Make these
967 ;; 'compatible instead of 'obsolete.  -slb
968 (defun define-obsolete-pointer-glyph (old new)
969   (define-compatible-variable-alias old new)
970   (dontusethis-set-symbol-value-handler
971    old 'set-value 'dontusethis-old-pointer-shape-handler new))
972
973 ;;; (defvar x-pointer-shape nil)
974 (define-obsolete-pointer-glyph 'x-pointer-shape 'text-pointer-glyph)
975
976 ;;; (defvar x-nontext-pointer-shape nil)
977 (define-obsolete-pointer-glyph 'x-nontext-pointer-shape 'nontext-pointer-glyph)
978
979 ;;; (defvar x-mode-pointer-shape nil)
980 (define-obsolete-pointer-glyph 'x-mode-pointer-shape 'modeline-pointer-glyph)
981
982 ;;; (defvar x-selection-pointer-shape nil)
983 (define-obsolete-pointer-glyph 'x-selection-pointer-shape
984   'selection-pointer-glyph)
985
986 ;;; (defvar x-busy-pointer-shape nil)
987 (define-obsolete-pointer-glyph 'x-busy-pointer-shape 'busy-pointer-glyph)
988
989 ;;; (defvar x-gc-pointer-shape nil)
990 (define-obsolete-pointer-glyph 'x-gc-pointer-shape 'gc-pointer-glyph)
991
992 ;;; (defvar x-toolbar-pointer-shape nil)
993 (define-obsolete-pointer-glyph 'x-toolbar-pointer-shape 'toolbar-pointer-glyph)
994
995 ;; for subwindows
996 (defalias 'subwindow-xid 'image-instance-subwindow-id)
997 (defalias 'subwindow-width 'image-instance-width)
998 (defalias 'subwindow-height 'image-instance-height)
999 ;;;;;;;;;; initialization
1000
1001 (defun init-glyphs ()
1002   ;; initialize default image types
1003   (if (featurep 'x)
1004     (set-console-type-image-conversion-list 'x
1005      `(,@(if (featurep 'xpm) '(("\\.xpm\\'" [xpm :file nil] 2)))
1006          ("\\.xbm\\'" [xbm :file nil] 2)
1007        ,@(if (featurep 'xpm) '(("\\`/\\* XPM \\*/" [xpm :data nil] 2)))
1008        ,@(if (featurep 'xface) '(("\\`X-Face:" [xface :data nil] 2)))
1009        ,@(if (featurep 'gif) '(("\\.gif\\'" [gif :file nil] 2)
1010                                ("\\`GIF8[79]" [gif :data nil] 2)))
1011        ,@(if (featurep 'jpeg) '(("\\.jpe?g\\'" [jpeg :file nil] 2)))
1012        ;; all of the JFIF-format JPEG's that I've seen begin with
1013        ;; the following.  I have no idea if this is standard.
1014        ,@(if (featurep 'jpeg) '(("\\`\377\330\377\340\000\020JFIF"
1015                                  [jpeg :data nil] 2)))
1016        ,@(if (featurep 'png) '(("\\.png\\'" [png :file nil] 2)))
1017        ,@(if (featurep 'png) '(("\\`\211PNG" [png :data nil] 2)))
1018        ("" [autodetect :data nil] 2))))
1019   ;; #### this should really be formatted-string, not string but we
1020   ;; don't have it implemented yet
1021   ;;
1022   ;; #define could also mean a bitmap as well as a version 1 XPM.  Who
1023   ;; cares.  We don't want the file contents getting converted to a
1024   ;; string in either case which is why the entry is there.
1025   (if (featurep 'tty)
1026       (progn
1027         (set-console-type-image-conversion-list
1028          'tty
1029          '(("^#define" [string :data "[xpm]"])
1030            ("\\`X-Face:" [string :data "[xface]"])
1031            ("\\`/\\* XPM \\*/" [string :data "[xpm]"])
1032            ("\\`GIF87" [string :data "[gif]"])
1033            ("\\`\377\330\340\000\020JFIF" [string :data "[jpeg]"])
1034            ("" [string :data nil] 2)
1035            ;; this last one is here for pointers and icons and such --
1036            ;; strings are not allowed so they will be ignored.
1037            ("" [nothing])))
1038
1039         ;; finish initializing truncation glyph -- created internally
1040         ;; because it has a built-in bitmap
1041         (set-glyph-image truncation-glyph "$" 'global 'tty)
1042
1043         ;; finish initializing continuation glyph -- created internally
1044         ;; because it has a built-in bitmap
1045         (set-glyph-image continuation-glyph "\\" 'global 'tty)
1046
1047         ;; finish initializing hscroll glyph -- created internally
1048         ;; because it has a built-in bitmap
1049         (set-glyph-image hscroll-glyph "$" 'global 'tty)))
1050
1051   (set-glyph-image octal-escape-glyph "\\")
1052   (set-glyph-image control-arrow-glyph "^")
1053   (set-glyph-image invisible-text-glyph " ...")
1054   ;; (set-glyph-image hscroll-glyph "$")
1055
1056   (let ((face (make-face 'border-glyph
1057                          "Truncation and continuation glyphs face")))
1058     (set-glyph-face continuation-glyph face)
1059     (set-glyph-face truncation-glyph face)
1060     (set-glyph-face hscroll-glyph face))
1061
1062   ;; finish initializing xemacs logo -- created internally because it
1063   ;; has a built-in bitmap
1064   (if (featurep 'xpm)
1065       (set-glyph-image xemacs-logo
1066                        (concat "../etc/"
1067                                (if emacs-beta-version
1068                                    "xemacs-beta.xpm"
1069                                  "xemacs.xpm"))
1070                        'global 'x))
1071   (cond ((featurep 'xpm)
1072          (set-glyph-image frame-icon-glyph
1073                           (concat "../etc/" "xemacs-icon.xpm")
1074                           'global 'x))
1075         ((featurep 'x)
1076          (set-glyph-image frame-icon-glyph
1077                           (concat "../etc/" "xemacs-icon2.xbm")
1078                           'global 'x)))
1079
1080   (if (featurep 'tty)
1081       (set-glyph-image xemacs-logo
1082                        "XEmacs <insert spiffy graphic logo here>"
1083                        'global 'tty))
1084 )
1085
1086 (init-glyphs)
1087
1088 ;;; glyphs.el ends here.