1 /* Copyright (C) 1999, 2000 artofcode LLC.  All rights reserved.
2 
3   This program is free software; you can redistribute it and/or modify it
4   under the terms of the GNU General Public License as published by the
5   Free Software Foundation; either version 2 of the License, or (at your
6   option) any later version.
7 
8   This program is distributed in the hope that it will be useful, but
9   WITHOUT ANY WARRANTY; without even the implied warranty of
10   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11   General Public License for more details.
12 
13   You should have received a copy of the GNU General Public License along
14   with this program; if not, write to the Free Software Foundation, Inc.,
15   59 Temple Place, Suite 330, Boston, MA, 02111-1307.
16 
17 */
18 
19 /*$Id: gdevxres.c,v 1.3.6.1.2.1 2003/01/17 00:49:02 giles Exp $ */
20 /* X Windows driver resource tables */
21 #include "std.h"	/* must precede any file that includes <sys/types.h> */
22 #include "x_.h"
23 #include "gstypes.h"
24 #include "gsmemory.h"
25 #include "gxdevice.h"
26 #include "gdevx.h"
27 
28 /*
29  * We segregate these tables into their own file because the definition of
30  * the XtResource structure is botched -- it declares the strings as char *
31  * rather than const char * -- and so compiling the statically initialized
32  * tables with gcc -Wcast-qual produces dozens of bogus warnings.
33  *
34  * Astoundingly, not only does the X API specify these structures as not
35  * being const, the Xt implementation actually writes into them.
36  */
37 
38 XtResource gdev_x_resources[] = {
39 
40 /* (String) casts are here to suppress warnings about discarding `const' */
41 #define RINIT(a,b,t,s,o,it,n)\
42   {(String)(a), (String)(b), (String)t, sizeof(s),\
43    XtOffsetOf(gx_device_X, o), (String)it, (n)}
44 #define rpix(a,b,o,n)\
45   RINIT(a,b,XtRPixel,Pixel,o,XtRString,(XtPointer)(n))
46 #define rdim(a,b,o,n)\
47   RINIT(a,b,XtRDimension,Dimension,o,XtRImmediate,(XtPointer)(n))
48 #define rstr(a,b,o,n)\
49   RINIT(a,b,XtRString,String,o,XtRString,(char*)(n))
50 #define rint(a,b,o,n)\
51   RINIT(a,b,XtRInt,int,o,XtRImmediate,(XtPointer)(n))
52 #define rbool(a,b,o,n)\
53   RINIT(a,b,XtRBoolean,Boolean,o,XtRImmediate,(XtPointer)(n))
54 #define rfloat(a,b,o,n)\
55   RINIT(a,b,XtRFloat,float,o,XtRString,(XtPointer)(n))
56 
57     rpix(XtNbackground, XtCBackground, background, "XtDefaultBackground"),
58     rpix(XtNborderColor, XtCBorderColor, borderColor, "XtDefaultForeground"),
59     rdim(XtNborderWidth, XtCBorderWidth, borderWidth, 1),
60     rstr("dingbatFonts", "DingbatFonts", dingbatFonts,
61 	 "ZapfDingbats: -Adobe-ITC Zapf Dingbats-Medium-R-Normal--"),
62     rpix(XtNforeground, XtCForeground, foreground, "XtDefaultForeground"),
63     rstr(XtNgeometry, XtCGeometry, geometry, NULL),
64     rbool("logExternalFonts", "LogExternalFonts", logXFonts, False),
65     rint("maxGrayRamp", "MaxGrayRamp", maxGrayRamp, 128),
66     rint("maxRGBRamp", "MaxRGBRamp", maxRGBRamp, 5),
67     rstr("palette", "Palette", palette, "Color"),
68 
69     /*
70      * I had to compress the whitespace out of the default string to
71      * satisfy certain balky compilers.
72      */
73     rstr("regularFonts", "RegularFonts", regularFonts, "\
74 AvantGarde-Book:-Adobe-ITC Avant Garde Gothic-Book-R-Normal--\n\
75 AvantGarde-BookOblique:-Adobe-ITC Avant Garde Gothic-Book-O-Normal--\n\
76 AvantGarde-Demi:-Adobe-ITC Avant Garde Gothic-Demi-R-Normal--\n\
77 AvantGarde-DemiOblique:-Adobe-ITC Avant Garde Gothic-Demi-O-Normal--\n\
78 Bookman-Demi:-Adobe-ITC Bookman-Demi-R-Normal--\n\
79 Bookman-DemiItalic:-Adobe-ITC Bookman-Demi-I-Normal--\n\
80 Bookman-Light:-Adobe-ITC Bookman-Light-R-Normal--\n\
81 Bookman-LightItalic:-Adobe-ITC Bookman-Light-I-Normal--\n\
82 Courier:-Adobe-Courier-Medium-R-Normal--\n\
83 Courier-Bold:-Adobe-Courier-Bold-R-Normal--\n\
84 Courier-BoldOblique:-Adobe-Courier-Bold-O-Normal--\n\
85 Courier-Oblique:-Adobe-Courier-Medium-O-Normal--\n\
86 Helvetica:-Adobe-Helvetica-Medium-R-Normal--\n\
87 Helvetica-Bold:-Adobe-Helvetica-Bold-R-Normal--\n\
88 Helvetica-BoldOblique:-Adobe-Helvetica-Bold-O-Normal--\n\
89 Helvetica-Narrow:-Adobe-Helvetica-Medium-R-Narrow--\n\
90 Helvetica-Narrow-Bold:-Adobe-Helvetica-Bold-R-Narrow--\n\
91 Helvetica-Narrow-BoldOblique:-Adobe-Helvetica-Bold-O-Narrow--\n\
92 Helvetica-Narrow-Oblique:-Adobe-Helvetica-Medium-O-Narrow--\n\
93 Helvetica-Oblique:-Adobe-Helvetica-Medium-O-Normal--\n\
94 NewCenturySchlbk-Bold:-Adobe-New Century Schoolbook-Bold-R-Normal--\n\
95 NewCenturySchlbk-BoldItalic:-Adobe-New Century Schoolbook-Bold-I-Normal--\n\
96 NewCenturySchlbk-Italic:-Adobe-New Century Schoolbook-Medium-I-Normal--\n\
97 NewCenturySchlbk-Roman:-Adobe-New Century Schoolbook-Medium-R-Normal--\n\
98 Palatino-Bold:-Adobe-Palatino-Bold-R-Normal--\n\
99 Palatino-BoldItalic:-Adobe-Palatino-Bold-I-Normal--\n\
100 Palatino-Italic:-Adobe-Palatino-Medium-I-Normal--\n\
101 Palatino-Roman:-Adobe-Palatino-Medium-R-Normal--\n\
102 Times-Bold:-Adobe-Times-Bold-R-Normal--\n\
103 Times-BoldItalic:-Adobe-Times-Bold-I-Normal--\n\
104 Times-Italic:-Adobe-Times-Medium-I-Normal--\n\
105 Times-Roman:-Adobe-Times-Medium-R-Normal--\n\
106 Utopia-Bold:-Adobe-Utopia-Bold-R-Normal--\n\
107 Utopia-BoldItalic:-Adobe-Utopia-Bold-I-Normal--\n\
108 Utopia-Italic:-Adobe-Utopia-Regular-I-Normal--\n\
109 Utopia-Regular:-Adobe-Utopia-Regular-R-Normal--\n\
110 ZapfChancery-MediumItalic:-Adobe-ITC Zapf Chancery-Medium-I-Normal--"),
111 
112     rstr("symbolFonts", "SymbolFonts", symbolFonts,
113 	 "Symbol: -Adobe-Symbol-Medium-R-Normal--"),
114 
115     rbool("useBackingPixmap", "UseBackingPixmap", useBackingPixmap, True),
116     rbool("useExternalFonts", "UseExternalFonts", useXFonts, True),
117     rbool("useFontExtensions", "UseFontExtensions", useFontExtensions, True),
118     rbool("useScalableFonts", "UseScalableFonts", useScalableFonts, True),
119     rbool("useXPutImage", "UseXPutImage", useXPutImage, True),
120     rbool("useXSetTile", "UseXSetTile", useXSetTile, True),
121     rfloat("xResolution", "Resolution", xResolution, "0.0"),
122     rfloat("yResolution", "Resolution", yResolution, "0.0"),
123 
124 #undef RINIT
125 #undef rpix
126 #undef rdim
127 #undef rstr
128 #undef rint
129 #undef rbool
130 #undef rfloat
131 };
132 
133 const int gdev_x_resource_count = XtNumber(gdev_x_resources);
134 
135 String gdev_x_fallback_resources[] = {
136     (String) "Ghostscript*Background: white",
137     (String) "Ghostscript*Foreground: black",
138     NULL
139 };
140