annotate src/objects-xlike-inc.c @ 2586:196ee3cd1ac5

[xemacs-hg @ 2005-02-15 01:19:48 by ben] first check-in of ben-fixup branch
author ben
date Tue, 15 Feb 2005 01:21:24 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2586
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
1 /* Include file for common code, X and GTK colors and fonts.
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
2 Copyright (C) 1993, 1994 Free Software Foundation, Inc.
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
3 Copyright (C) 1995 Board of Trustees, University of Illinois.
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
4 Copyright (C) 1995 Tinker Systems.
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
5 Copyright (C) 1995, 1996, 2000, 2001, 2002, 2003, 2004, 2005 Ben Wing.
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
6 Copyright (C) 1995 Sun Microsystems, Inc.
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
7
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
8 This file is part of XEmacs.
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
9
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
10 XEmacs is free software; you can redistribute it and/or modify it
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
11 under the terms of the GNU General Public License as published by the
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
12 Free Software Foundation; either version 2, or (at your option) any
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
13 later version.
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
14
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
15 XEmacs is distributed in the hope that it will be useful, but WITHOUT
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
17 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
18 for more details.
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
19
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
20 You should have received a copy of the GNU General Public License
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
21 along with XEmacs; see the file COPYING. If not, write to
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
22 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
23 Boston, MA 02111-1307, USA. */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
24
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
25 /* Synched up with: Not in FSF. */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
26
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
27 /* Authors: Jamie Zawinski, Chuck Thompson, Ben Wing */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
28
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
29 /* Extracted from objects-x.c, objects-gtk.c 2-13-05.
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
30 NOTE: There is an advantage to having the code coalesced this way
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
31 even when there is a fair amount of difference between the two versions,
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
32 provided that they are still parallel -- having them side by side ensures
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
33 that logic changes in one are propagated to the other, preventing bit-rot
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
34 --ben
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
35 */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
36
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
37 #ifndef THIS_IS_GTK
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
38 #define ZZCOLOR_TYPE XColor
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
39 #define ZZCOLOR_INSTANCE(name) COLOR_INSTANCE_X_##name
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
40 #define ZZ(z) x_##z
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
41 #define ZZEND(z) z##_x
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
42 #define ZZCONSOLE_HAS_METHOD(name) CONSOLE_HAS_METHOD (x, name)
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
43 #define UNUSED_IF_GTK(arg) arg
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
44 #else
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
45 #define ZZCOLOR_TYPE GdkColor
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
46 #define ZZCOLOR_INSTANCE(name) COLOR_INSTANCE_GTK_##name
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
47 #define ZZ(z) gtk_##z
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
48 #define ZZEND(z) z##_gtk
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
49 #define ZZCONSOLE_HAS_METHOD(name) CONSOLE_HAS_METHOD (gtk, name)
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
50 #define UNUSED_IF_GTK(arg) UNUSED (arg)
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
51 #endif
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
52
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
53
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
54 /************************************************************************/
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
55 /* color instances */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
56 /************************************************************************/
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
57
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
58 static int
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
59 ZZ (parse_nearest_color) (struct device *d, ZZCOLOR_TYPE *color,
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
60 Lisp_Object name, Error_Behavior errb)
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
61 {
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
62 #ifndef THIS_IS_GTK
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
63 Display *dpy = DEVICE_X_DISPLAY (d);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
64 Colormap cmap = DEVICE_X_COLORMAP (d);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
65 Visual *visual = DEVICE_X_VISUAL (d);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
66 #else /* THIS_IS_GTK */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
67 GdkColormap *cmap = DEVICE_GTK_COLORMAP (d);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
68 GdkVisual *visual = DEVICE_GTK_VISUAL (d);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
69 #endif /* THIS_IS_GTK */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
70 int result;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
71
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
72 xzero (*color);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
73
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
74 #ifndef THIS_IS_GTK
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
75 result =
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
76 XParseColor (dpy, cmap,
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
77 NEW_LISP_STRING_TO_EXTERNAL (name, Qx_color_name_encoding),
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
78 color);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
79 #else /* THIS_IS_GTK */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
80 result = gdk_color_parse (LISP_STRING_TO_GTK_TEXT (name), color);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
81 #endif /* THIS_IS_GTK */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
82 if (!result)
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
83 {
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
84 maybe_signal_error (Qgui_error, "Unrecognized color",
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
85 name, Qcolor, errb);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
86 return 0;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
87 }
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
88 #ifndef THIS_IS_GTK
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
89 result = ZZ (allocate_nearest_color) (dpy, cmap, visual, color);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
90 #else /* THIS_IS_GTK */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
91 result = ZZ (allocate_nearest_color) (cmap, visual, color);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
92 #endif /* THIS_IS_GTK */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
93 if (!result)
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
94 {
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
95 maybe_signal_error (Qgui_error, "Couldn't allocate color",
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
96 name, Qcolor, errb);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
97 return 0;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
98 }
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
99
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
100 return result;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
101 }
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
102
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
103 static int
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
104 ZZ (initialize_color_instance) (Lisp_Color_Instance *c, Lisp_Object name,
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
105 Lisp_Object device, Error_Behavior errb)
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
106 {
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
107 ZZCOLOR_TYPE color;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
108 int result;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
109
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
110 result = ZZ (parse_nearest_color) (XDEVICE (device), &color, name, errb);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
111
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
112 if (!result)
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
113 return 0;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
114
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
115 /* Don't allocate the data until we're sure that we will succeed,
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
116 or the finalize method may get fucked. */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
117 c->data = xnew (struct ZZ (color_instance_data));
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
118 if (result == 3)
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
119 ZZCOLOR_INSTANCE (DEALLOC) (c) = 0;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
120 else
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
121 ZZCOLOR_INSTANCE (DEALLOC) (c) = 1;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
122 #ifndef THIS_IS_GTK
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
123 ZZCOLOR_INSTANCE (COLOR) (c) = color;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
124 #else /* THIS_IS_GTK */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
125 ZZCOLOR_INSTANCE (COLOR) (c) = gdk_color_copy (&color);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
126 #endif /* THIS_IS_GTK */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
127 return 1;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
128 }
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
129
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
130 static void
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
131 ZZ (print_color_instance) (Lisp_Color_Instance *c,
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
132 Lisp_Object printcharfun,
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
133 int UNUSED (escapeflag))
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
134 {
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
135 #ifndef THIS_IS_GTK
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
136 XColor color = COLOR_INSTANCE_X_COLOR (c);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
137 write_fmt_string (printcharfun, " %ld=(%X,%X,%X)",
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
138 color.pixel, color.red, color.green, color.blue);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
139 #else /* THIS_IS_GTK */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
140 GdkColor *color = COLOR_INSTANCE_GTK_COLOR (c);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
141 write_fmt_string (printcharfun, " %ld=(%X,%X,%X)",
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
142 color->pixel, color->red, color->green, color->blue);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
143 #endif /* THIS_IS_GTK */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
144 }
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
145
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
146 static void
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
147 ZZ (finalize_color_instance) (Lisp_Color_Instance *c)
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
148 {
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
149 if (c->data)
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
150 {
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
151 if (DEVICE_LIVE_P (XDEVICE (c->device)))
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
152 {
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
153 if (ZZCOLOR_INSTANCE (DEALLOC) (c))
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
154 {
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
155 #ifndef THIS_IS_GTK
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
156 XFreeColors (DEVICE_X_DISPLAY (XDEVICE (c->device)),
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
157 DEVICE_X_COLORMAP (XDEVICE (c->device)),
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
158 &COLOR_INSTANCE_X_COLOR (c).pixel, 1, 0);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
159 #else /* THIS_IS_GTK */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
160 gdk_colormap_free_colors (DEVICE_GTK_COLORMAP
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
161 (XDEVICE (c->device)),
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
162 COLOR_INSTANCE_GTK_COLOR (c), 1);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
163 #endif /* THIS_IS_GTK */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
164 }
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
165 #ifdef THIS_IS_GTK
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
166 gdk_color_free (COLOR_INSTANCE_GTK_COLOR (c));
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
167 #endif /* THIS_IS_GTK */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
168 }
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
169 xfree (c->data, void *);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
170 c->data = 0;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
171 }
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
172 }
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
173
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
174 /* Color instances are equal if they resolve to the same color on the
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
175 screen (have the same RGB values). I imagine that
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
176 "same RGB values" == "same cell in the colormap." Arguably we should
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
177 be comparing their names or pixel values instead. */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
178
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
179 static int
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
180 ZZ (color_instance_equal) (Lisp_Color_Instance *c1,
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
181 Lisp_Color_Instance *c2,
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
182 int UNUSED (depth))
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
183 {
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
184 #ifndef THIS_IS_GTK
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
185 XColor color1 = COLOR_INSTANCE_X_COLOR (c1);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
186 XColor color2 = COLOR_INSTANCE_X_COLOR (c2);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
187 return ((color1.red == color2.red) &&
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
188 (color1.green == color2.green) &&
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
189 (color1.blue == color2.blue));
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
190 #else /* THIS_IS_GTK */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
191 return (gdk_color_equal (COLOR_INSTANCE_GTK_COLOR (c1),
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
192 COLOR_INSTANCE_GTK_COLOR (c2)));
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
193 #endif /* THIS_IS_GTK */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
194 }
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
195
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
196 static Hashcode
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
197 ZZ (color_instance_hash) (Lisp_Color_Instance *c, int UNUSED (depth))
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
198 {
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
199 #ifndef THIS_IS_GTK
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
200 XColor color = COLOR_INSTANCE_X_COLOR (c);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
201 return HASH3 (color.red, color.green, color.blue);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
202 #else /* THIS_IS_GTK */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
203 return (gdk_color_hash (COLOR_INSTANCE_GTK_COLOR (c), NULL));
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
204 #endif /* THIS_IS_GTK */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
205 }
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
206
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
207 static Lisp_Object
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
208 ZZ (color_instance_rgb_components) (Lisp_Color_Instance *c)
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
209 {
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
210 #ifndef THIS_IS_GTK
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
211 XColor color = COLOR_INSTANCE_X_COLOR (c);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
212 return (list3 (make_int (color.red),
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
213 make_int (color.green),
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
214 make_int (color.blue)));
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
215 #else /* THIS_IS_GTK */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
216 GdkColor *color = COLOR_INSTANCE_GTK_COLOR (c);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
217 return (list3 (make_int (color->red),
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
218 make_int (color->green),
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
219 make_int (color->blue)));
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
220 #endif /* THIS_IS_GTK */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
221 }
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
222
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
223 static int
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
224 ZZ (valid_color_name_p) (struct device *UNUSED_IF_GTK (d), Lisp_Object color)
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
225 {
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
226 #ifndef THIS_IS_GTK
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
227 XColor c;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
228 Display *dpy = DEVICE_X_DISPLAY (d);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
229 Colormap cmap = DEVICE_X_COLORMAP (d);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
230 const Extbyte *extname;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
231
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
232 LISP_STRING_TO_EXTERNAL (color, extname, Qx_color_name_encoding);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
233
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
234 return XParseColor (dpy, cmap, extname, &c);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
235 #else /* THIS_IS_GTK */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
236 GdkColor c;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
237 const Extbyte *extname;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
238
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
239 LISP_STRING_TO_EXTERNAL (color, extname, Vgtk_text_encoding);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
240
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
241 if (gdk_color_parse (extname, &c) != TRUE)
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
242 return 0;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
243 return 1;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
244 #endif /* THIS_IS_GTK */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
245 }
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
246
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
247 static Lisp_Object
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
248 ZZ (color_list) (void)
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
249 {
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
250 #ifdef THIS_IS_GTK
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
251 /* #### BILL!!!
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
252 Is this correct? */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
253 #endif /* THIS_IS_GTK */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
254 return call0 (intern ("x-color-list-internal"));
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
255 }
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
256
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
257
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
258 /************************************************************************/
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
259 /* font instances */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
260 /************************************************************************/
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
261
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
262 static int
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
263 ZZ (initialize_font_instance) (Lisp_Font_Instance *f,
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
264 Lisp_Object UNUSED (name),
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
265 Lisp_Object UNUSED_IF_GTK (device),
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
266 Error_Behavior errb)
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
267 {
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
268 XFontStruct *xf;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
269 const Extbyte *extname;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
270
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
271 #ifndef THIS_IS_GTK
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
272 Display *dpy = DEVICE_X_DISPLAY (XDEVICE (device));
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
273
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
274 LISP_STRING_TO_EXTERNAL (f->name, extname, Qx_font_name_encoding);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
275 xf = XLoadQueryFont (dpy, extname);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
276
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
277 if (!xf)
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
278 {
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
279 maybe_signal_error (Qgui_error, "Couldn't load font", f->name,
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
280 Qfont, errb);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
281 return 0;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
282 }
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
283
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
284 if (!xf->max_bounds.width)
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
285 {
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
286 /* yes, this has been known to happen. */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
287 XFreeFont (dpy, xf);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
288 maybe_signal_error (Qgui_error, "X font is too small", f->name, Qfont,
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
289 errb);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
290
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
291 return 0;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
292 }
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
293
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
294 #else /* THIS_IS_GTK */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
295 GdkFont *gf;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
296
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
297 LISP_STRING_TO_EXTERNAL (f->name, extname, Vgtk_text_encoding);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
298 gf = gdk_font_load (extname);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
299
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
300 if (!gf)
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
301 {
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
302 maybe_signal_error (Qgui_error, "Couldn't load font", f->name,
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
303 Qfont, errb);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
304 return 0;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
305 }
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
306
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
307 xf = (XFontStruct *) GDK_FONT_XFONT (gf);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
308
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
309 #endif /* THIS_IS_GTK */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
310
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
311 /* Don't allocate the data until we're sure that we will succeed,
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
312 or the finalize method may get fucked. */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
313
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
314 #ifndef THIS_IS_GTK
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
315 f->data = xnew (struct x_font_instance_data);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
316 FONT_INSTANCE_X_FONT (f) = xf;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
317 f->ascent = xf->ascent;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
318 f->descent = xf->descent;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
319 f->height = xf->ascent + xf->descent;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
320 #else /* THIS_IS_GTK */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
321 f->data = xnew (struct gtk_font_instance_data);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
322 FONT_INSTANCE_GTK_FONT (f) = gf;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
323 f->ascent = gf->ascent;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
324 f->descent = gf->descent;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
325 f->height = gf->ascent + gf->descent;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
326 #endif /* THIS_IS_GTK */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
327
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
328 /* Now let's figure out the width of the font */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
329
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
330 {
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
331 /* following change suggested by Ted Phelps <phelps@dstc.edu.au> */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
332 int def_char = 'n'; /*xf->default_char;*/
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
333 int byte1, byte2;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
334
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
335 once_more:
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
336 byte1 = def_char >> 8;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
337 byte2 = def_char & 0xFF;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
338
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
339 if (xf->per_char)
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
340 {
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
341 /* Old versions of the R5 font server have garbage (>63k) as
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
342 def_char. 'n' might not be a valid character. */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
343 if (byte1 < (int) xf->min_byte1 ||
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
344 byte1 > (int) xf->max_byte1 ||
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
345 byte2 < (int) xf->min_char_or_byte2 ||
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
346 byte2 > (int) xf->max_char_or_byte2)
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
347 f->width = 0;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
348 else
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
349 f->width = xf->per_char[(byte1 - xf->min_byte1) *
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
350 (xf->max_char_or_byte2 -
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
351 xf->min_char_or_byte2 + 1) +
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
352 (byte2 - xf->min_char_or_byte2)].width;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
353 }
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
354 else
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
355 f->width = xf->max_bounds.width;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
356
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
357 /* Some fonts have a default char whose width is 0. This is no good.
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
358 If that's the case, first try 'n' as the default char, and if n has
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
359 0 width too (unlikely) then just use the max width. */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
360 if (f->width == 0)
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
361 {
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
362 if (def_char == (int) xf->default_char)
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
363 f->width = xf->max_bounds.width;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
364 else
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
365 {
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
366 def_char = xf->default_char;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
367 goto once_more;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
368 }
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
369 }
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
370 }
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
371 /* If all characters don't exist then there could potentially be
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
372 0-width characters lurking out there. Not setting this flag
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
373 trips an optimization that would make them appear to have width
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
374 to redisplay. This is bad. So we set it if not all characters
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
375 have the same width or if not all characters are defined.
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
376 */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
377 /* #### This sucks. There is a measurable performance increase
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
378 when using proportional width fonts if this flag is not set.
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
379 Unfortunately so many of the fucking X fonts are not fully
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
380 defined that we could almost just get rid of this damn flag and
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
381 make it an assertion. */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
382 f->proportional_p = (xf->min_bounds.width != xf->max_bounds.width ||
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
383 (
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
384 #ifndef THIS_IS_GTK
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
385 x_handle_non_fully_specified_fonts &&
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
386 #else /* THIS_IS_GTK */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
387 /* x_handle_non_fully_specified_fonts */ 0 &&
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
388 #endif /* THIS_IS_GTK */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
389 !xf->all_chars_exist));
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
390
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
391 #if 0 /* THIS_IS_GTK */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
392 f->width = gdk_char_width (gf, 'n');
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
393 f->proportional_p = (gdk_char_width (gf, '|') != gdk_char_width (gf, 'W'));
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
394 #endif
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
395 return 1;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
396 }
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
397
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
398 static void
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
399 ZZ (print_font_instance) (Lisp_Font_Instance *f,
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
400 Lisp_Object printcharfun,
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
401 int UNUSED (escapeflag))
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
402 {
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
403 write_fmt_string (printcharfun, " 0x%lx",
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
404 #ifndef THIS_IS_GTK
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
405 (unsigned long) FONT_INSTANCE_X_FONT (f)->fid);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
406 #else /* THIS_IS_GTK */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
407 (unsigned long) gdk_font_id (FONT_INSTANCE_GTK_FONT (f)));
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
408 #endif /* THIS_IS_GTK */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
409 }
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
410
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
411 static void
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
412 ZZ (finalize_font_instance) (Lisp_Font_Instance *f)
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
413 {
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
414 if (f->data)
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
415 {
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
416 if (DEVICE_LIVE_P (XDEVICE (f->device)))
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
417 {
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
418 #ifndef THIS_IS_GTK
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
419 XFreeFont (DEVICE_X_DISPLAY (XDEVICE (f->device)),
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
420 FONT_INSTANCE_X_FONT (f));
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
421 #else /* THIS_IS_GTK */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
422 gdk_font_unref (FONT_INSTANCE_GTK_FONT (f));
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
423 #endif /* THIS_IS_GTK */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
424 }
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
425 xfree (f->data, void *);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
426 f->data = 0;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
427 }
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
428 }
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
429
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
430 /* Unbounded, for sufficiently small values of infinity... */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
431 #define MAX_FONT_COUNT 5000
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
432
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
433 #ifndef THIS_IS_GTK
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
434 static Lisp_Object x_font_truename (Display *dpy, Extbyte *name,
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
435 XFontStruct *font);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
436 #else
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
437 Lisp_Object __get_gtk_font_truename (GdkFont *gdk_font, int expandp);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
438 #endif
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
439
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
440 static Lisp_Object
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
441 ZZ (font_instance_truename) (Lisp_Font_Instance *f, Error_Behavior errb)
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
442 {
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
443 if (NILP (FONT_INSTANCE_TRUENAME (f)))
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
444 {
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
445 #ifndef THIS_IS_GTK
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
446 FONT_INSTANCE_TRUENAME (f) =
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
447 x_font_truename (DEVICE_X_DISPLAY (XDEVICE (f->device)),
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
448 NEW_LISP_STRING_TO_EXTERNAL
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
449 (f->name, Qx_font_name_encoding),
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
450 FONT_INSTANCE_X_FONT (f));
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
451 #else
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
452 FONT_INSTANCE_TRUENAME (f) =
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
453 __get_gtk_font_truename (FONT_INSTANCE_GTK_FONT (f), 1);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
454 #endif /* THIS_IS_GTK */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
455
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
456 if (NILP (FONT_INSTANCE_TRUENAME (f)))
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
457 {
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
458 Lisp_Object font_instance = wrap_font_instance (f);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
459
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
460
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
461 maybe_signal_error (Qgui_error, "Couldn't determine font truename",
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
462 font_instance, Qfont, errb);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
463 /* Ok, just this once, return the font name as the truename.
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
464 (This is only used by Fequal() right now.) */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
465 return f->name;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
466 }
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
467 }
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
468 return FONT_INSTANCE_TRUENAME (f);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
469 }
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
470
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
471 #ifdef MULE
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
472
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
473 static int
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
474 ZZ (font_spec_matches_charset) (struct device *UNUSED (d), Lisp_Object charset,
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
475 const Ibyte *nonreloc, Lisp_Object reloc,
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
476 Bytecount offset, Bytecount length,
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
477 int stage)
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
478 {
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
479 if (stage)
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
480 return 0;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
481
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
482 if (UNBOUNDP (charset))
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
483 return 1;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
484 /* Hack! Short font names don't have the registry in them,
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
485 so we just assume the user knows what they're doing in the
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
486 case of ASCII. For other charsets, you gotta give the
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
487 long form; sorry buster.
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
488 */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
489 if (EQ (charset, Vcharset_ascii))
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
490 {
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
491 const Ibyte *the_nonreloc = nonreloc;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
492 int i;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
493 Bytecount the_length = length;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
494
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
495 if (!the_nonreloc)
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
496 the_nonreloc = XSTRING_DATA (reloc);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
497 fixup_internal_substring (nonreloc, reloc, offset, &the_length);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
498 the_nonreloc += offset;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
499 if (!memchr (the_nonreloc, '*', the_length))
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
500 {
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
501 for (i = 0;; i++)
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
502 {
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
503 const Ibyte *new_nonreloc = (const Ibyte *)
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
504 memchr (the_nonreloc, '-', the_length);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
505 if (!new_nonreloc)
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
506 break;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
507 new_nonreloc++;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
508 the_length -= new_nonreloc - the_nonreloc;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
509 the_nonreloc = new_nonreloc;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
510 }
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
511
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
512 /* If it has less than 5 dashes, it's a short font.
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
513 Of course, long fonts always have 14 dashes or so, but short
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
514 fonts never have more than 1 or 2 dashes, so this is some
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
515 sort of reasonable heuristic. */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
516 if (i < 5)
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
517 return 1;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
518 }
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
519 }
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
520
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
521 return (fast_string_match (XCHARSET_REGISTRY (charset),
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
522 nonreloc, reloc, offset, length, 1,
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
523 ERROR_ME, 0) >= 0);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
524 }
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
525
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
526 /* find a font spec that matches font spec FONT and also matches
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
527 (the registry of) CHARSET. */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
528 static Lisp_Object
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
529 ZZ (find_charset_font) (Lisp_Object device, Lisp_Object font,
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
530 Lisp_Object charset, int stage)
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
531 {
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
532 #ifdef THIS_IS_GTK
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
533 /* #### copied from x_find_charset_font */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
534 /* #### BILL!!! Try to make this go away eventually */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
535 #endif /* THIS_IS_GTK */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
536 Extbyte **names;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
537 int count = 0;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
538 Lisp_Object result = Qnil;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
539 const Extbyte *patternext;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
540 int i;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
541
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
542 if (stage)
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
543 return Qnil;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
544
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
545 LISP_STRING_TO_EXTERNAL (font, patternext, Qx_font_name_encoding);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
546
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
547 names = XListFonts (
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
548 #ifndef THIS_IS_GTK
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
549 DEVICE_X_DISPLAY (XDEVICE (device)),
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
550 #else
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
551 GDK_DISPLAY (),
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
552 #endif
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
553 patternext, MAX_FONT_COUNT, &count);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
554 /* #### This code seems awfully bogus -- mrb */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
555 for (i = 0; i < count; i ++)
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
556 {
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
557 const Ibyte *intname;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
558 Bytecount intlen;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
559
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
560 EXTERNAL_TO_SIZED_C_STRING (names[i], intname, intlen,
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
561 Qx_font_name_encoding);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
562 if (ZZ (font_spec_matches_charset) (XDEVICE (device), charset,
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
563 intname, Qnil, 0, -1, stage))
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
564 {
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
565 result = make_string (intname, intlen);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
566 break;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
567 }
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
568 }
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
569
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
570 if (names)
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
571 XFreeFontNames (names);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
572
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
573 /* Check for a short font name. */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
574 if (NILP (result)
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
575 && ZZ (font_spec_matches_charset) (XDEVICE (device), charset, 0,
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
576 font, 0, -1, stage))
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
577 return font;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
578
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
579 return result;
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
580 }
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
581
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
582 #endif /* MULE */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
583
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
584
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
585 /************************************************************************/
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
586 /* initialization */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
587 /************************************************************************/
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
588
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
589 void
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
590 ZZEND (console_type_create_objects) (void)
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
591 {
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
592 /* object methods */
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
593
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
594 ZZCONSOLE_HAS_METHOD (initialize_color_instance);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
595 ZZCONSOLE_HAS_METHOD (print_color_instance);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
596 ZZCONSOLE_HAS_METHOD (finalize_color_instance);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
597 ZZCONSOLE_HAS_METHOD (color_instance_equal);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
598 ZZCONSOLE_HAS_METHOD (color_instance_hash);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
599 ZZCONSOLE_HAS_METHOD (color_instance_rgb_components);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
600 ZZCONSOLE_HAS_METHOD (valid_color_name_p);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
601 ZZCONSOLE_HAS_METHOD (color_list);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
602
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
603 ZZCONSOLE_HAS_METHOD (initialize_font_instance);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
604 ZZCONSOLE_HAS_METHOD (print_font_instance);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
605 ZZCONSOLE_HAS_METHOD (finalize_font_instance);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
606 ZZCONSOLE_HAS_METHOD (font_instance_truename);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
607 ZZCONSOLE_HAS_METHOD (font_instance_properties);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
608 ZZCONSOLE_HAS_METHOD (font_list);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
609 #ifdef MULE
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
610 ZZCONSOLE_HAS_METHOD (find_charset_font);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
611 ZZCONSOLE_HAS_METHOD (font_spec_matches_charset);
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
612 #endif
196ee3cd1ac5 [xemacs-hg @ 2005-02-15 01:19:48 by ben]
ben
parents:
diff changeset
613 }