1 /*******************************************************************
3 ** *********************************************************
7 ** * Contents: defines and includes for the Pcl driver
8 ** * for a printing X server.
12 ** *********************************************************
14 ********************************************************************/
16 (c) Copyright 1996 Hewlett-Packard Company
17 (c) Copyright 1996 International Business Machines Corp.
18 (c) Copyright 1996 Sun Microsystems, Inc.
19 (c) Copyright 1996 Novell, Inc.
20 (c) Copyright 1996 Digital Equipment Corp.
21 (c) Copyright 1996 Fujitsu Limited
22 (c) Copyright 1996 Hitachi, Ltd.
24 Permission is hereby granted, free of charge, to any person obtaining a copy
25 of this software and associated documentation files (the "Software"), to deal
26 in the Software without restriction, including without limitation the rights
27 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
28 copies of the Software, and to permit persons to whom the Software is
29 furnished to do so, subject to the following conditions:
31 The above copyright notice and this permission notice shall be included in
32 all copies or substantial portions of the Software.
34 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
35 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
36 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
37 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
38 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
39 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
41 Except as contained in this notice, the names of the copyright holders shall
42 not be used in advertising or otherwise to promote the sale, use or other
43 dealings in this Software without prior written authorization from said
47 #ifdef HAVE_DIX_CONFIG_H
48 #include <dix-config.h>
55 #include "scrnintstr.h"
59 #include "PclSFonts.h"
61 #include <X11/extensions/Print.h>
62 #include <X11/extensions/Printstr.h>
64 #include "regionstr.h"
65 #include <X11/fonts/fontstruct.h>
66 #include "dixfontstr.h"
70 * Some sleazes to force the XrmDB stuff into the server
73 typedef char *XPointer
;
79 #include <X11/Xfuncproto.h>
80 #include <X11/Xresource.h>
81 #include "attributes.h"
84 * externally visible variables from PclInit.c
86 extern int PclScreenPrivateIndex
, PclWindowPrivateIndex
;
87 extern int PclContextPrivateIndex
;
88 extern int PclPixmapPrivateIndex
;
89 extern int PclGCPrivateIndex
;
92 * externally visible variables from PclAttVal.c
94 extern XpValidatePoolsRec PclValidatePoolsRec
;
97 * This structure defines a mapping from an X colormap ID to a list of
98 * print contexts which use the colormap.
100 typedef struct _pclcontextlist
{
101 XpContextPtr context
;
102 struct _pclcontextlist
*next
;
103 } PclContextList
, *PclContextListPtr
;
105 typedef struct _pclcmaptocontexts
{
107 PclContextListPtr contexts
;
108 struct _pclcmaptocontexts
*next
;
112 PclCmapToContexts
*colormaps
;
113 CloseScreenProcPtr CloseScreen
;
114 } PclScreenPrivRec
, *PclScreenPrivPtr
;
117 * This structure defines a mapping from an X colormap ID to a PCL
120 typedef struct _palettemap
{
124 struct _palettemap
*next
;
125 } PclPaletteMap
, *PclPaletteMapPtr
;
135 ClientPtr getDocClient
;
137 PclSoftFontInfoPtr pSoftFontInfo
;
138 PclPaletteMapPtr palettes
;
141 PclPaletteMap staticGrayPalette
;
142 PclPaletteMap trueColorPalette
;
143 PclPaletteMap specialTrueColorPalette
;
149 unsigned int fcount_max
;
151 #endif /* XP_PCL_LJ3 */
152 } PclContextPrivRec
, *PclContextPrivPtr
;
156 XpContextPtr context
;
157 } PclWindowPrivRec
, *PclWindowPrivPtr
;
160 unsigned long stippleFg
, stippleBg
;
161 } PclGCPrivRec
, *PclGCPrivPtr
;
164 XpContextPtr context
;
169 } PclPixmapPrivRec
, *PclPixmapPrivPtr
;
174 #define SEND_PCL(f,c) fwrite( c, sizeof( char ), strlen( c ), f )
175 #define SEND_PCL_COUNT(f,c,n) fwrite( c, sizeof( char ), n, f )
178 #define SAVE_PCL(f,p,c) SEND_PCL(f,c)
179 #define SAVE_PCL_COUNT(f,p,c,n) SEND_PCL_COUNT(f,c,n)
180 #define MACRO_START(f,p) SEND_PCL(f, "\033&f1Y\033&f0X")
181 #define MACRO_END(f) SEND_PCL(f, "\033&f1X")
183 #define SAVE_PCL(f,p,c) PclSpoolFigs(p, c, strlen(c))
184 #define SAVE_PCL_COUNT(f,p,c,n) PclSpoolFigs(p, c, n)
185 #define MACRO_START(f,p) p->fcount = 0
186 #define MACRO_END(f) /* do nothing */
187 #endif /* XP_PCL_LJ3 */
189 #define MIN(a,b) (((a)<(b))?(a):(b))
191 #define MAX(a,b) (((a)>(b))?(a):(b))
195 * Functions in PclArc.c
197 extern void PclPolyArc(
198 DrawablePtr pDrawable
,
202 extern void PclPolyFillArc(
203 DrawablePtr pDrawable
,
209 * Functions in PclArea.c
211 extern void PclPutImage(
212 DrawablePtr pDrawable
,
222 extern RegionPtr
PclCopyArea(
232 RegionPtr
PclCopyPlane(
242 unsigned long plane
);
246 * Functions in PclAttr.c
248 extern char *PclGetAttributes(
251 extern char *PclGetOneAttribute(
255 extern int PclAugmentAttributes(
259 extern int PclSetAttributes(
265 * Functions in PclColor.c
267 extern Bool
PclCreateDefColormap(ScreenPtr pScreen
);
268 extern Bool
PclCreateColormap(ColormapPtr pColor
);
269 extern void PclDestroyColormap(ColormapPtr pColor
);
270 extern void PclInstallColormap(ColormapPtr pColor
);
271 extern void PclUninstallColormap(ColormapPtr pColor
);
272 extern int PclListInstalledColormaps(ScreenPtr pScreen
,
274 extern void PclStoreColors(ColormapPtr pColor
,
277 extern void PclResolveColor(unsigned short *pRed
,
278 unsigned short *pGreen
,
279 unsigned short *pBlue
,
281 extern int PclUpdateColormap(DrawablePtr pDrawable
,
285 extern void PclLookUp(ColormapPtr cmap
,
286 PclContextPrivPtr cPriv
,
290 extern PclPaletteMapPtr
PclFindPaletteMap(PclContextPrivPtr cPriv
,
293 extern unsigned char *PclReadMap(char *, int *);
297 * Functions in PclCursor.c
299 extern void PclConstrainCursor(
302 extern void PclCursorLimits(
307 extern Bool
PclDisplayCursor(
310 extern Bool
PclRealizeCursor(
313 extern Bool
PclUnrealizeCursor(
316 extern void PclRecolorCursor(
320 extern Bool
PclSetCursorPosition(
327 * Functions in PclSFonts.c
330 PclDownloadSoftFont8(
332 PclSoftFontInfoPtr pSoftFontInfo
,
335 unsigned char *code
);
336 extern void PclDownloadSoftFont16(
338 PclSoftFontInfoPtr pSoftFontInfo
,
339 PclFontHead16Ptr pfh
,
343 extern PclSoftFontInfoPtr
PclCreateSoftFontInfo(void);
344 extern void PclDestroySoftFontInfo(
345 PclSoftFontInfoPtr pSoftFontInfo
);
348 * Functions in PclGC.c
350 extern Bool
PclCreateGC(GCPtr pGC
);
351 extern void PclDestroyGC(GCPtr pGC
);
352 extern int PclUpdateDrawableGC(
354 DrawablePtr pDrawable
,
356 extern void PclValidateGC(
358 unsigned long changes
,
359 DrawablePtr pDrawable
);
360 extern void PclSetDrawablePrivateStuff(
361 DrawablePtr pDrawable
,
363 extern int PclGetDrawablePrivateStuff(
364 DrawablePtr pDrawable
,
366 unsigned long *valid
,
368 extern void PclSetDrawablePrivateGC(
369 DrawablePtr pDrawable
,
371 extern void PclComputeCompositeClip(
373 DrawablePtr pDrawable
);
376 * Functions in PclInit.c
378 extern Bool
PclCloseScreen(
381 extern Bool
InitializeColorPclDriver(
386 extern Bool
InitializeMonoPclDriver(
391 extern Bool
InitializeLj3PclDriver(
396 extern XpContextPtr
PclGetContextFromWindow( WindowPtr win
);
399 * Functions in PclLine.c
401 extern void PclPolyLine(
402 DrawablePtr pDrawable
,
407 extern void PclPolySegment(
408 DrawablePtr pDrawable
,
411 xSegment
*pSegments
);
414 * Functions in PclMisc.c
416 extern void PclQueryBestSize(
421 extern char *GetPropString(WindowPtr pWin
, char *propName
);
422 extern int SystemCmd(char *cmdStr
);
423 extern int PclGetMediumDimensions(
427 extern int PclGetReproducibleArea(
430 extern void PclSendData(
432 PclContextPrivPtr pConPriv
,
438 * Functions in PclPixel.c
440 extern void PclPolyPoint(
441 DrawablePtr pDrawable
,
446 extern void PclPushPixels(
449 DrawablePtr pDrawable
,
456 * Functions in PclPixmap.c
458 extern PixmapPtr
PclCreatePixmap(
463 extern Bool
PclDestroyPixmap(PixmapPtr pPixmap
);
466 * Functions in PclPolygon.c
468 extern void PclPolyRectangle(
469 DrawablePtr pDrawable
,
473 extern void PclFillPolygon(
474 DrawablePtr pDrawable
,
479 DDXPointPtr pPoints
);
480 extern void PclPolyFillRect(
481 DrawablePtr pDrawable
,
487 * Functions in PclSpans.c
489 extern void PclFillSpans(
490 DrawablePtr pDrawable
,
496 extern void PclSetSpans(
497 DrawablePtr pDrawable
,
506 * Functions in PclText.c
508 extern int PclPolyText8(
509 DrawablePtr pDrawable
,
515 extern int PclPolyText16(
516 DrawablePtr pDrawable
,
521 unsigned short *string
);
522 extern void PclImageText8(
523 DrawablePtr pDrawable
,
529 extern void PclImageText16(
530 DrawablePtr pDrawable
,
535 unsigned short *string
);
536 extern void PclImageGlyphBlt(
537 DrawablePtr pDrawable
,
541 unsigned int nGlyphs
,
542 CharInfoPtr
*pCharInfo
,
544 extern void PclPolyGlyphBlt(
545 DrawablePtr pDrawable
,
549 unsigned int nGlyphs
,
550 CharInfoPtr
*pCharInfo
,
554 * Functions in PclWindow.c
556 extern Bool
PclCreateWindow(register WindowPtr pWin
);
557 extern Bool
PclDestroyWindow(WindowPtr pWin
);
558 extern Bool
PclMapWindow(WindowPtr pWindow
);
559 extern Bool
PclPositionWindow(
560 register WindowPtr pWin
,
563 extern Bool
PclUnmapWindow(WindowPtr pWindow
);
564 extern void PclCopyWindow(
566 DDXPointRec ptOldOrg
,
568 extern Bool
PclChangeWindowAttributes(
569 register WindowPtr pWin
,
570 register unsigned long mask
);
571 extern void PclPaintWindow(
577 * Functions in PclFonts.c
579 extern Bool
PclRealizeFont(
582 extern Bool
PclUnrealizeFont(
587 * Functions in PclPrint.c
589 extern int PclStartJob(
593 extern int PclEndJob(
596 extern int PclStartPage(
599 extern int PclEndPage(
602 extern int PclStartDoc(XpContextPtr pCon
,
603 XPDocumentType type
);
604 extern int PclEndDoc(
607 extern int PclDocumentData(
617 extern int PclGetDocumentData(