1 /* Copyright (C) 2001-2006 Artifex Software, Inc.
2    All Rights Reserved.
3 
4    This software is provided AS-IS with no warranty, either express or
5    implied.
6 
7    This software is distributed under license and may not be copied, modified
8    or distributed except as expressly authorized under the terms of that
9    license.  Refer to licensing information at http://www.artifex.com/
10    or contact Artifex Software, Inc.,  7 Mt. Lassen Drive - Suite A-134,
11    San Rafael, CA  94903, U.S.A., +1(415)492-9861, for further information.
12 */
13 
14 /* $Id: gdevxres.c 8022 2007-06-05 22:23:38Z giles $ */
15 /* X Windows driver resource tables */
16 #include "std.h"	/* must precede any file that includes <sys/types.h> */
17 #include "x_.h"
18 #include "gstypes.h"
19 #include "gsmemory.h"
20 #include "gxdevice.h"
21 #include "gdevx.h"
22 
23 /*
24  * We segregate these tables into their own file because the definition of
25  * the XtResource structure is botched -- it declares the strings as char *
26  * rather than const char * -- and so compiling the statically initialized
27  * tables with gcc -Wcast-qual produces dozens of bogus warnings.
28  *
29  * Astoundingly, not only does the X API specify these structures as not
30  * being const, the Xt implementation actually writes into them.
31  */
32 
33 XtResource gdev_x_resources[] = {
34 
35 /* (String) casts are here to suppress warnings about discarding `const' */
36 #define RINIT(a,b,t,s,o,it,n)\
37   {(String)(a), (String)(b), (String)t, sizeof(s),\
38    XtOffsetOf(gx_device_X, o), (String)it, (n)}
39 #define rpix(a,b,o,n)\
40   RINIT(a,b,XtRPixel,Pixel,o,XtRString,(XtPointer)(n))
41 #define rdim(a,b,o,n)\
42   RINIT(a,b,XtRDimension,Dimension,o,XtRImmediate,(XtPointer)(n))
43 #define rstr(a,b,o,n)\
44   RINIT(a,b,XtRString,String,o,XtRString,(char*)(n))
45 #define rint(a,b,o,n)\
46   RINIT(a,b,XtRInt,int,o,XtRImmediate,(XtPointer)(n))
47 #define rbool(a,b,o,n)\
48   RINIT(a,b,XtRBoolean,Boolean,o,XtRImmediate,(XtPointer)(n))
49 #define rfloat(a,b,o,n)\
50   RINIT(a,b,XtRFloat,float,o,XtRString,(XtPointer)(n))
51 
52     rpix(XtNbackground, XtCBackground, background, "XtDefaultBackground"),
53     rpix(XtNborderColor, XtCBorderColor, borderColor, "XtDefaultForeground"),
54     rdim(XtNborderWidth, XtCBorderWidth, borderWidth, 1),
55     rstr("dingbatFonts", "DingbatFonts", dingbatFonts,
56 	 "ZapfDingbats: -Adobe-ITC Zapf Dingbats-Medium-R-Normal--"),
57     rpix(XtNforeground, XtCForeground, foreground, "XtDefaultForeground"),
58     rstr(XtNgeometry, XtCGeometry, geometry, NULL),
59     rbool("logExternalFonts", "LogExternalFonts", logXFonts, False),
60     rint("maxGrayRamp", "MaxGrayRamp", maxGrayRamp, 128),
61     rint("maxRGBRamp", "MaxRGBRamp", maxRGBRamp, 5),
62     rstr("palette", "Palette", palette, "Color"),
63 
64     /*
65      * I had to compress the whitespace out of the default string to
66      * satisfy certain balky compilers.
67      */
68     rstr("regularFonts", "RegularFonts", regularFonts, "\
69 AvantGarde-Book:-Adobe-ITC Avant Garde Gothic-Book-R-Normal--\n\
70 AvantGarde-BookOblique:-Adobe-ITC Avant Garde Gothic-Book-O-Normal--\n\
71 AvantGarde-Demi:-Adobe-ITC Avant Garde Gothic-Demi-R-Normal--\n\
72 AvantGarde-DemiOblique:-Adobe-ITC Avant Garde Gothic-Demi-O-Normal--\n\
73 Bookman-Demi:-Adobe-ITC Bookman-Demi-R-Normal--\n\
74 Bookman-DemiItalic:-Adobe-ITC Bookman-Demi-I-Normal--\n\
75 Bookman-Light:-Adobe-ITC Bookman-Light-R-Normal--\n\
76 Bookman-LightItalic:-Adobe-ITC Bookman-Light-I-Normal--\n\
77 Courier:-Adobe-Courier-Medium-R-Normal--\n\
78 Courier-Bold:-Adobe-Courier-Bold-R-Normal--\n\
79 Courier-BoldOblique:-Adobe-Courier-Bold-O-Normal--\n\
80 Courier-Oblique:-Adobe-Courier-Medium-O-Normal--\n\
81 Helvetica:-Adobe-Helvetica-Medium-R-Normal--\n\
82 Helvetica-Bold:-Adobe-Helvetica-Bold-R-Normal--\n\
83 Helvetica-BoldOblique:-Adobe-Helvetica-Bold-O-Normal--\n\
84 Helvetica-Narrow:-Adobe-Helvetica-Medium-R-Narrow--\n\
85 Helvetica-Narrow-Bold:-Adobe-Helvetica-Bold-R-Narrow--\n\
86 Helvetica-Narrow-BoldOblique:-Adobe-Helvetica-Bold-O-Narrow--\n\
87 Helvetica-Narrow-Oblique:-Adobe-Helvetica-Medium-O-Narrow--\n\
88 Helvetica-Oblique:-Adobe-Helvetica-Medium-O-Normal--\n\
89 NewCenturySchlbk-Bold:-Adobe-New Century Schoolbook-Bold-R-Normal--\n\
90 NewCenturySchlbk-BoldItalic:-Adobe-New Century Schoolbook-Bold-I-Normal--\n\
91 NewCenturySchlbk-Italic:-Adobe-New Century Schoolbook-Medium-I-Normal--\n\
92 NewCenturySchlbk-Roman:-Adobe-New Century Schoolbook-Medium-R-Normal--\n\
93 Palatino-Bold:-Adobe-Palatino-Bold-R-Normal--\n\
94 Palatino-BoldItalic:-Adobe-Palatino-Bold-I-Normal--\n\
95 Palatino-Italic:-Adobe-Palatino-Medium-I-Normal--\n\
96 Palatino-Roman:-Adobe-Palatino-Medium-R-Normal--\n\
97 Times-Bold:-Adobe-Times-Bold-R-Normal--\n\
98 Times-BoldItalic:-Adobe-Times-Bold-I-Normal--\n\
99 Times-Italic:-Adobe-Times-Medium-I-Normal--\n\
100 Times-Roman:-Adobe-Times-Medium-R-Normal--\n\
101 Utopia-Bold:-Adobe-Utopia-Bold-R-Normal--\n\
102 Utopia-BoldItalic:-Adobe-Utopia-Bold-I-Normal--\n\
103 Utopia-Italic:-Adobe-Utopia-Regular-I-Normal--\n\
104 Utopia-Regular:-Adobe-Utopia-Regular-R-Normal--\n\
105 ZapfChancery-MediumItalic:-Adobe-ITC Zapf Chancery-Medium-I-Normal--"),
106 
107     rstr("symbolFonts", "SymbolFonts", symbolFonts,
108 	 "Symbol: -Adobe-Symbol-Medium-R-Normal--"),
109 
110     rbool("useBackingPixmap", "UseBackingPixmap", useBackingPixmap, True),
111     rbool("useExternalFonts", "UseExternalFonts", useXFonts, True),
112     rbool("useFontExtensions", "UseFontExtensions", useFontExtensions, True),
113     rbool("useScalableFonts", "UseScalableFonts", useScalableFonts, True),
114     rbool("useXPutImage", "UseXPutImage", useXPutImage, True),
115     rbool("useXSetTile", "UseXSetTile", useXSetTile, True),
116     rfloat("xResolution", "Resolution", xResolution, "0.0"),
117     rfloat("yResolution", "Resolution", yResolution, "0.0"),
118 
119 #undef RINIT
120 #undef rpix
121 #undef rdim
122 #undef rstr
123 #undef rint
124 #undef rbool
125 #undef rfloat
126 };
127 
128 const int gdev_x_resource_count = XtNumber(gdev_x_resources);
129 
130 String gdev_x_fallback_resources[] = {
131     (String) "Ghostscript*Background: white",
132     (String) "Ghostscript*Foreground: black",
133     NULL
134 };
135