2 * PostScript driver definitions
4 * Copyright 1998 Huw D M Davies
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef __WINE_PSDRV_H
22 #define __WINE_PSDRV_H
31 #include "wine/list.h"
40 const GLYPHNAME *name;
44 float llx, lly, urx, ury;
47 typedef struct _tagAFMLIGS {
50 struct _tagAFMLIGS *next;
54 int C; /* character */
57 const GLYPHNAME *N; /* name */
59 const AFMLIGS *L; /* Ligatures */
63 INT C; /* AFM encoding (or -1) */
64 LONG UV; /* Unicode value */
65 FLOAT WX; /* Advance width */
66 const GLYPHNAME *N; /* Glyph name */
70 USHORT usUnitsPerEm; /* head:unitsPerEm */
71 SHORT sAscender; /* hhea:Ascender */
72 SHORT sDescender; /* hhea:Descender */
73 SHORT sLineGap; /* hhea:LineGap */
74 SHORT sAvgCharWidth; /* OS/2:xAvgCharWidth */
75 SHORT sTypoAscender; /* OS/2:sTypoAscender */
76 SHORT sTypoDescender; /* OS/2:sTypoDescender */
77 SHORT sTypoLineGap; /* OS/2:sTypeLineGap */
78 USHORT usWinAscent; /* OS/2:usWinAscent */
79 USHORT usWinDescent; /* OS/2:usWinDescent */
82 typedef struct _tagAFM {
86 LPCSTR EncodingScheme;
87 LONG Weight; /* FW_NORMAL etc. */
90 float UnderlinePosition;
91 float UnderlineThickness;
95 WINMETRICS WinMetrics;
97 const AFMMETRICS *Metrics;
100 /* Note no 'next' in AFM. Use AFMLISTENTRY as a container. This allow more than
101 one list to exist without having to reallocate the entire AFM structure. We
102 keep a global list of all afms (PSDRV_AFMFontList) plus a list of available
103 fonts for each DC (dc->physDev->Fonts) */
105 typedef struct _tagAFMLISTENTRY {
107 struct _tagAFMLISTENTRY *next;
110 typedef struct _tagFONTFAMILY {
111 char *FamilyName; /* family name */
112 AFMLISTENTRY *afmlist; /* list of afms for this family */
113 struct _tagFONTFAMILY *next; /* next family */
116 extern FONTFAMILY *PSDRV_AFMFontList DECLSPEC_HIDDEN;
117 extern const AFM *const PSDRV_BuiltinAFMs[] DECLSPEC_HIDDEN; /* last element is NULL */
119 typedef struct _tagFONTNAME {
121 struct _tagFONTNAME *next;
125 float llx, lly, urx, ury;
134 typedef struct _tagPAGESIZE {
138 char *InvocationString;
139 IMAGEABLEAREA *ImageableArea;
140 PAPERDIMENSION *PaperDimension;
141 WORD WinPage; /*eg DMPAPER_A4. Doesn't really belong here */
145 /* For BANDINFO Escape */
146 typedef struct _BANDINFOSTRUCT
151 } BANDINFOSTRUCT, *PBANDINFOSTRUCT;
153 typedef struct _tagOPTIONENTRY {
154 char *Name; /* eg "True" */
155 char *FullName; /* eg "Installed" */
156 char *InvocationString; /* Often NULL */
157 struct _tagOPTIONENTRY *next;
160 typedef struct _tagOPTION { /* Treat bool as a special case of pickone */
161 char *OptionName; /* eg "*Option1" */
162 char *FullName; /* eg "Envelope Feeder" */
163 char *DefaultOption; /* eg "False" */
164 OPTIONENTRY *Options;
165 struct _tagOPTION *next;
168 typedef struct _tagCONSTRAINT {
173 struct _tagCONSTRAINT *next;
176 typedef struct _tagINPUTSLOT {
178 const char *FullName;
179 char *InvocationString;
180 WORD WinBin; /* eg DMBIN_LOWER */
181 struct _tagINPUTSLOT *next;
184 typedef enum _RASTERIZEROPTION
185 {RO_None, RO_Accept68K, RO_Type42, RO_TrueImage} RASTERIZEROPTION;
187 typedef struct _tagDUPLEX {
190 char *InvocationString;
191 WORD WinDuplex; /* eg DMDUP_SIMPLEX */
192 struct _tagDUPLEX *next;
195 /* Many Mac OS X based ppd files don't include a *ColorDevice line, so
196 we use a tristate here rather than a boolean. Code that
197 cares is expected to treat these as if they were colour. */
207 COLORDEVICE ColorDevice;
208 int DefaultResolution;
209 signed int LandscapeOrientation;
211 char *JCLToPSInterpreter;
214 FONTNAME *InstalledFonts; /* ptr to a list of FontNames */
215 struct list PageSizes;
216 PAGESIZE *DefaultPageSize;
217 OPTION *InstalledOptions;
218 CONSTRAINT *Constraints;
219 INPUTSLOT *InputSlots;
220 RASTERIZEROPTION TTRasterizer;
222 DUPLEX *DefaultDuplex;
227 struct _tagdocprivate {
230 struct _tagdrvprivate {
231 UINT numInstalledOptions; /* Options at end of struct */
236 numInstalledOptions of OPTIONs
242 typedef struct _tagPI {
245 PSDRV_DEVMODEA *Devmode;
247 PPRINTER_ENUM_VALUESA FontSubTable;
248 DWORD FontSubTableSize;
261 /* def's for PSCOLOR.type */
262 #define PSCOLOR_GRAY 0
263 #define PSCOLOR_RGB 1
279 typedef struct tagTYPE42 TYPE42;
281 typedef struct tagTYPE1 TYPE1;
287 typedef struct _tagDOWNLOAD {
288 enum downloadtype type;
294 struct _tagDOWNLOAD *next;
307 enum fontloc fontloc;
315 BOOL set; /* Have we done a setfont yet */
317 /* These are needed by PSDRV_ExtTextOut */
319 int underlineThickness;
320 int underlinePosition;
321 int strikeoutThickness;
322 int strikeoutPosition;
342 DWORD id; /* Job id */
343 HANDLE hprinter; /* Printer handle */
344 LPSTR output; /* Output file/port */
345 LPSTR DocName; /* Document Name */
346 BOOL banding; /* Have we received a NEXTBAND */
347 BOOL OutOfPage; /* Page header not sent yet */
349 BOOL quiet; /* Don't actually output anything */
350 BOOL in_passthrough; /* In PASSTHROUGH mode */
351 BOOL had_passthrough_rect; /* See the comment in PSDRV_Rectangle */
356 void *reserved[3]; /* reserved for gdi */
358 PSFONT font; /* Current PS font */
359 DOWNLOAD *downloaded_fonts;
363 PSCOLOR inkColor; /* Last colour set */
365 PSDRV_DEVMODEA *Devmode;
367 SIZE PageSize; /* Physical page size in device units */
368 RECT ImageableArea; /* Imageable area in device units */
369 /* NB both PageSize and ImageableArea
370 are not rotated in landscape mode,
371 so PageSize.cx is generally
373 int horzRes; /* device caps */
385 PSDRV_DEVMODEA *dlgdm;
390 * Every glyph name in the Adobe Glyph List and the 35 core PostScript fonts
393 extern const INT PSDRV_AGLGlyphNamesSize;
394 extern GLYPHNAME PSDRV_AGLGlyphNames[] DECLSPEC_HIDDEN;
398 * The AGL encoding vector
401 extern const INT PSDRV_AGLbyNameSize; /* sorted by name - */
402 extern const UNICODEGLYPH PSDRV_AGLbyName[] DECLSPEC_HIDDEN; /* duplicates omitted */
404 extern const INT PSDRV_AGLbyUVSize; /* sorted by UV - */
405 extern const UNICODEGLYPH PSDRV_AGLbyUV[] DECLSPEC_HIDDEN; /* duplicates included */
407 extern HINSTANCE PSDRV_hInstance DECLSPEC_HIDDEN;
408 extern HANDLE PSDRV_Heap DECLSPEC_HIDDEN;
409 extern char *PSDRV_ANSIVector[256] DECLSPEC_HIDDEN;
411 extern void PSDRV_MergeDevmodes(PSDRV_DEVMODEA *dm1, PSDRV_DEVMODEA *dm2,
412 PRINTERINFO *pi) DECLSPEC_HIDDEN;
413 extern BOOL PSDRV_GetFontMetrics(void) DECLSPEC_HIDDEN;
414 extern PPD *PSDRV_ParsePPD(char *fname) DECLSPEC_HIDDEN;
415 extern PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name) DECLSPEC_HIDDEN;
416 extern const AFM *PSDRV_FindAFMinList(FONTFAMILY *head, LPCSTR name) DECLSPEC_HIDDEN;
417 extern BOOL PSDRV_AddAFMtoList(FONTFAMILY **head, const AFM *afm,
418 BOOL *p_added) DECLSPEC_HIDDEN;
419 extern void PSDRV_FreeAFMList( FONTFAMILY *head ) DECLSPEC_HIDDEN;
421 extern INT PSDRV_XWStoDS( PSDRV_PDEVICE *physDev, INT width ) DECLSPEC_HIDDEN;
423 extern BOOL PSDRV_Brush(PSDRV_PDEVICE *physDev, BOOL EO) DECLSPEC_HIDDEN;
424 extern BOOL PSDRV_SetFont( PSDRV_PDEVICE *physDev ) DECLSPEC_HIDDEN;
425 extern BOOL PSDRV_SetPen( PSDRV_PDEVICE *physDev ) DECLSPEC_HIDDEN;
427 extern void PSDRV_SetClip(PSDRV_PDEVICE* phyDev) DECLSPEC_HIDDEN;
428 extern void PSDRV_ResetClip(PSDRV_PDEVICE* phyDev) DECLSPEC_HIDDEN;
430 extern BOOL PSDRV_CopyColor(PSCOLOR *col1, PSCOLOR *col2) DECLSPEC_HIDDEN;
431 extern void PSDRV_CreateColor( PSDRV_PDEVICE *physDev, PSCOLOR *pscolor,
432 COLORREF wincolor ) DECLSPEC_HIDDEN;
433 extern char PSDRV_UnicodeToANSI(int u) DECLSPEC_HIDDEN;
435 extern INT PSDRV_WriteHeader( PSDRV_PDEVICE *physDev, LPCSTR title ) DECLSPEC_HIDDEN;
436 extern INT PSDRV_WriteFooter( PSDRV_PDEVICE *physDev ) DECLSPEC_HIDDEN;
437 extern INT PSDRV_WriteNewPage( PSDRV_PDEVICE *physDev ) DECLSPEC_HIDDEN;
438 extern INT PSDRV_WriteEndPage( PSDRV_PDEVICE *physDev ) DECLSPEC_HIDDEN;
439 extern BOOL PSDRV_WriteMoveTo(PSDRV_PDEVICE *physDev, INT x, INT y) DECLSPEC_HIDDEN;
440 extern BOOL PSDRV_WriteLineTo(PSDRV_PDEVICE *physDev, INT x, INT y) DECLSPEC_HIDDEN;
441 extern BOOL PSDRV_WriteStroke(PSDRV_PDEVICE *physDev) DECLSPEC_HIDDEN;
442 extern BOOL PSDRV_WriteRectangle(PSDRV_PDEVICE *physDev, INT x, INT y, INT width,
443 INT height) DECLSPEC_HIDDEN;
444 extern BOOL PSDRV_WriteRRectangle(PSDRV_PDEVICE *physDev, INT x, INT y, INT width,
445 INT height) DECLSPEC_HIDDEN;
446 extern BOOL PSDRV_WriteSetFont(PSDRV_PDEVICE *physDev, const char *name, matrix size,
447 INT escapement) DECLSPEC_HIDDEN;
448 extern BOOL PSDRV_WriteGlyphShow(PSDRV_PDEVICE *physDev, LPCSTR g_name) DECLSPEC_HIDDEN;
449 extern BOOL PSDRV_WriteSetPen(PSDRV_PDEVICE *physDev) DECLSPEC_HIDDEN;
450 extern BOOL PSDRV_WriteArc(PSDRV_PDEVICE *physDev, INT x, INT y, INT w, INT h,
451 double ang1, double ang2) DECLSPEC_HIDDEN;
452 extern BOOL PSDRV_WriteSetColor(PSDRV_PDEVICE *physDev, PSCOLOR *color) DECLSPEC_HIDDEN;
453 extern BOOL PSDRV_WriteSetBrush(PSDRV_PDEVICE *physDev) DECLSPEC_HIDDEN;
454 extern BOOL PSDRV_WriteFill(PSDRV_PDEVICE *physDev) DECLSPEC_HIDDEN;
455 extern BOOL PSDRV_WriteEOFill(PSDRV_PDEVICE *physDev) DECLSPEC_HIDDEN;
456 extern BOOL PSDRV_WriteGSave(PSDRV_PDEVICE *physDev) DECLSPEC_HIDDEN;
457 extern BOOL PSDRV_WriteGRestore(PSDRV_PDEVICE *physDev) DECLSPEC_HIDDEN;
458 extern BOOL PSDRV_WriteNewPath(PSDRV_PDEVICE *physDev) DECLSPEC_HIDDEN;
459 extern BOOL PSDRV_WriteClosePath(PSDRV_PDEVICE *physDev) DECLSPEC_HIDDEN;
460 extern BOOL PSDRV_WriteClip(PSDRV_PDEVICE *physDev) DECLSPEC_HIDDEN;
461 extern BOOL PSDRV_WriteRectClip(PSDRV_PDEVICE *physDev, INT x, INT y, INT w, INT h) DECLSPEC_HIDDEN;
462 extern BOOL PSDRV_WriteRectClip2(PSDRV_PDEVICE *physDev, CHAR *pszArrayName) DECLSPEC_HIDDEN;
463 extern BOOL PSDRV_WriteEOClip(PSDRV_PDEVICE *physDev) DECLSPEC_HIDDEN;
464 extern BOOL PSDRV_WriteHatch(PSDRV_PDEVICE *physDev) DECLSPEC_HIDDEN;
465 extern BOOL PSDRV_WriteRotate(PSDRV_PDEVICE *physDev, float ang) DECLSPEC_HIDDEN;
466 extern BOOL PSDRV_WriteIndexColorSpaceBegin(PSDRV_PDEVICE *physDev, int size) DECLSPEC_HIDDEN;
467 extern BOOL PSDRV_WriteIndexColorSpaceEnd(PSDRV_PDEVICE *physDev) DECLSPEC_HIDDEN;
468 extern BOOL PSDRV_WriteRGB(PSDRV_PDEVICE *physDev, COLORREF *map, int number) DECLSPEC_HIDDEN;
469 extern BOOL PSDRV_WriteImage(PSDRV_PDEVICE *physDev, WORD depth, INT xDst, INT yDst,
470 INT widthDst, INT heightDst, INT widthSrc,
471 INT heightSrc, BOOL mask) DECLSPEC_HIDDEN;
472 extern BOOL PSDRV_WriteBytes(PSDRV_PDEVICE *physDev, const BYTE *bytes, DWORD number) DECLSPEC_HIDDEN;
473 extern BOOL PSDRV_WriteData(PSDRV_PDEVICE *physDev, const BYTE *byte, DWORD number) DECLSPEC_HIDDEN;
474 extern DWORD PSDRV_WriteSpool(PSDRV_PDEVICE *physDev, LPCSTR lpData, DWORD cch) DECLSPEC_HIDDEN;
475 extern BOOL PSDRV_WritePatternDict(PSDRV_PDEVICE *physDev, BITMAP *bm, BYTE *bits) DECLSPEC_HIDDEN;
476 extern BOOL PSDRV_WriteDIBPatternDict(PSDRV_PDEVICE *physDev, BITMAPINFO *bmi, UINT usage) DECLSPEC_HIDDEN;
477 extern BOOL PSDRV_WriteArrayPut(PSDRV_PDEVICE *physDev, CHAR *pszArrayName, INT nIndex, LONG lCoord) DECLSPEC_HIDDEN;
478 extern BOOL PSDRV_WriteArrayDef(PSDRV_PDEVICE *physDev, CHAR *pszArrayName, INT nSize) DECLSPEC_HIDDEN;
480 extern INT CDECL PSDRV_StartPage( PSDRV_PDEVICE *physDev ) DECLSPEC_HIDDEN;
482 INT PSDRV_GlyphListInit(void) DECLSPEC_HIDDEN;
483 const GLYPHNAME *PSDRV_GlyphName(LPCSTR szName) DECLSPEC_HIDDEN;
484 VOID PSDRV_IndexGlyphList(void) DECLSPEC_HIDDEN;
485 BOOL PSDRV_GetTrueTypeMetrics(void) DECLSPEC_HIDDEN;
486 BOOL PSDRV_GetType1Metrics(void) DECLSPEC_HIDDEN;
487 const AFMMETRICS *PSDRV_UVMetrics(LONG UV, const AFM *afm) DECLSPEC_HIDDEN;
488 SHORT PSDRV_CalcAvgCharWidth(const AFM *afm) DECLSPEC_HIDDEN;
490 extern BOOL PSDRV_SelectBuiltinFont(PSDRV_PDEVICE *physDev, HFONT hfont,
491 LOGFONTW *plf, LPSTR FaceName) DECLSPEC_HIDDEN;
492 extern BOOL PSDRV_WriteSetBuiltinFont(PSDRV_PDEVICE *physDev) DECLSPEC_HIDDEN;
493 extern BOOL PSDRV_WriteBuiltinGlyphShow(PSDRV_PDEVICE *physDev, LPCWSTR str, INT count) DECLSPEC_HIDDEN;
495 extern BOOL PSDRV_SelectDownloadFont(PSDRV_PDEVICE *physDev) DECLSPEC_HIDDEN;
496 extern BOOL PSDRV_WriteSetDownloadFont(PSDRV_PDEVICE *physDev) DECLSPEC_HIDDEN;
497 extern BOOL PSDRV_WriteDownloadGlyphShow(PSDRV_PDEVICE *physDev, WORD *glpyhs,
498 UINT count) DECLSPEC_HIDDEN;
499 extern BOOL PSDRV_EmptyDownloadList(PSDRV_PDEVICE *physDev, BOOL write_undef) DECLSPEC_HIDDEN;
501 extern DWORD write_spool( PSDRV_PDEVICE *physDev, const void *data, DWORD num ) DECLSPEC_HIDDEN;
503 #define MAX_G_NAME 31 /* max length of PS glyph name */
504 extern void get_glyph_name(HDC hdc, WORD index, char *name) DECLSPEC_HIDDEN;
506 extern TYPE1 *T1_download_header(PSDRV_PDEVICE *physDev, char *ps_name,
507 RECT *bbox, UINT emsize) DECLSPEC_HIDDEN;
508 extern BOOL T1_download_glyph(PSDRV_PDEVICE *physDev, DOWNLOAD *pdl,
509 DWORD index, char *glyph_name) DECLSPEC_HIDDEN;
510 extern void T1_free(TYPE1 *t1) DECLSPEC_HIDDEN;
512 extern TYPE42 *T42_download_header(PSDRV_PDEVICE *physDev, char *ps_name,
513 RECT *bbox, UINT emsize) DECLSPEC_HIDDEN;
514 extern BOOL T42_download_glyph(PSDRV_PDEVICE *physDev, DOWNLOAD *pdl,
515 DWORD index, char *glyph_name) DECLSPEC_HIDDEN;
516 extern void T42_free(TYPE42 *t42) DECLSPEC_HIDDEN;
518 extern DWORD RLE_encode(BYTE *in_buf, DWORD len, BYTE *out_buf) DECLSPEC_HIDDEN;
519 extern DWORD ASCII85_encode(BYTE *in_buf, DWORD len, BYTE *out_buf) DECLSPEC_HIDDEN;
521 #define push_lc_numeric(x) do { \
522 const char *tmplocale = setlocale(LC_NUMERIC,NULL); \
523 setlocale(LC_NUMERIC,x);
525 #define pop_lc_numeric() \
526 setlocale(LC_NUMERIC,tmplocale); \