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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef __WINE_PSDRV_H
22 #define __WINE_PSDRV_H
26 #include "wine/wingdi16.h"
36 const GLYPHNAME *name;
40 float llx, lly, urx, ury;
43 typedef struct _tagAFMLIGS {
46 struct _tagAFMLIGS *next;
50 int C; /* character */
53 const GLYPHNAME *N; /* name */
55 const AFMLIGS *L; /* Ligatures */
59 INT C; /* AFM encoding (or -1) */
60 LONG UV; /* Unicode value */
61 FLOAT WX; /* Advance width */
62 const GLYPHNAME *N; /* Glyph name */
66 USHORT usUnitsPerEm; /* head:unitsPerEm */
67 SHORT sAscender; /* hhea:Ascender */
68 SHORT sDescender; /* hhea:Descender */
69 SHORT sLineGap; /* hhea:LineGap */
70 SHORT sAvgCharWidth; /* OS/2:xAvgCharWidth */
71 SHORT sTypoAscender; /* OS/2:sTypoAscender */
72 SHORT sTypoDescender; /* OS/2:sTypoDescender */
73 SHORT sTypoLineGap; /* OS/2:sTypeLineGap */
74 USHORT usWinAscent; /* OS/2:usWinAscent */
75 USHORT usWinDescent; /* OS/2:usWinDescent */
78 typedef struct _tagAFM {
82 LPCSTR EncodingScheme;
83 LONG Weight; /* FW_NORMAL etc. */
86 float UnderlinePosition;
87 float UnderlineThickness;
91 WINMETRICS WinMetrics;
93 const AFMMETRICS *Metrics;
96 /* Note no 'next' in AFM. Use AFMLISTENTRY as a container. This allow more than
97 one list to exist without having to reallocate the entire AFM structure. We
98 keep a global list of all afms (PSDRV_AFMFontList) plus a list of available
99 fonts for each DC (dc->physDev->Fonts) */
101 typedef struct _tagAFMLISTENTRY {
103 struct _tagAFMLISTENTRY *next;
106 typedef struct _tagFONTFAMILY {
107 char *FamilyName; /* family name */
108 AFMLISTENTRY *afmlist; /* list of afms for this family */
109 struct _tagFONTFAMILY *next; /* next family */
112 extern FONTFAMILY *PSDRV_AFMFontList;
113 extern const AFM *const PSDRV_BuiltinAFMs[]; /* last element is NULL */
115 typedef struct _tagFONTNAME {
117 struct _tagFONTNAME *next;
121 float llx, lly, urx, ury;
130 typedef struct _tagPAGESIZE {
133 char *InvocationString;
134 IMAGEABLEAREA *ImageableArea;
135 PAPERDIMENSION *PaperDimension;
136 WORD WinPage; /*eg DMPAPER_A4. Doesn't really belong here */
137 struct _tagPAGESIZE *next;
141 typedef struct _tagOPTIONENTRY {
142 char *Name; /* eg "True" */
143 char *FullName; /* eg "Installed" */
144 char *InvocationString; /* Often NULL */
145 struct _tagOPTIONENTRY *next;
148 typedef struct _tagOPTION { /* Treat bool as a special case of pickone */
149 char *OptionName; /* eg "*Option1" */
150 char *FullName; /* eg "Envelope Feeder" */
151 char *DefaultOption; /* eg "False" */
152 OPTIONENTRY *Options;
153 struct _tagOPTION *next;
156 typedef struct _tagCONSTRAINT {
161 struct _tagCONSTRAINT *next;
164 typedef struct _tagINPUTSLOT {
167 char *InvocationString;
168 WORD WinBin; /* eg DMBIN_LOWER */
169 struct _tagINPUTSLOT *next;
172 typedef enum _RASTERIZEROPTION
173 {RO_None, RO_Accept68K, RO_Type42, RO_TrueImage} RASTERIZEROPTION;
179 int DefaultResolution;
180 signed int LandscapeOrientation;
182 char *JCLToPSInterpreter;
185 FONTNAME *InstalledFonts; /* ptr to a list of FontNames */
187 OPTION *InstalledOptions;
188 CONSTRAINT *Constraints;
189 INPUTSLOT *InputSlots;
190 RASTERIZEROPTION TTRasterizer;
195 struct _tagdocprivate {
198 struct _tagdrvprivate {
199 UINT numInstalledOptions; /* Options at end of struct */
204 numInstalledOptions of OPTIONs
210 typedef struct _tagPI {
213 PSDRV_DEVMODEA *Devmode;
215 PPRINTER_ENUM_VALUESA FontSubTable;
216 DWORD FontSubTableSize;
229 /* def's for PSCOLOR.type */
230 #define PSCOLOR_GRAY 0
231 #define PSCOLOR_RGB 1
247 typedef struct tagTYPE42 TYPE42;
249 typedef struct tagTYPE1 TYPE1;
255 typedef struct _tagDOWNLOAD {
256 enum downloadtype type;
262 struct _tagDOWNLOAD *next;
270 enum fontloc fontloc;
278 BOOL set; /* Have we done a setfont yet */
280 /* These are needed by PSDRV_ExtTextOut */
282 int underlineThickness;
283 int underlinePosition;
284 int strikeoutThickness;
285 int strikeoutPosition;
304 LPSTR output; /* Output file/port */
305 BOOL banding; /* Have we received a NEXTBAND */
306 BOOL OutOfPage; /* Page header not sent yet */
313 PSFONT font; /* Current PS font */
314 DOWNLOAD *downloaded_fonts;
318 PSCOLOR inkColor; /* Last colour set */
320 PSDRV_DEVMODEA *Devmode;
322 SIZE PageSize; /* Physical page size in device units */
323 RECT ImageableArea; /* Imageable area in device units */
324 /* NB both PageSize and ImageableArea
325 are not rotated in landscape mode,
326 so PageSize.cx is generally
328 int horzRes; /* device caps */
338 PSDRV_DEVMODEA *dlgdm;
343 * Every glyph name in the Adobe Glyph List and the 35 core PostScript fonts
346 extern const INT PSDRV_AGLGlyphNamesSize;
347 extern GLYPHNAME PSDRV_AGLGlyphNames[];
351 * The AGL encoding vector
354 extern const INT PSDRV_AGLbyNameSize; /* sorted by name - */
355 extern const UNICODEGLYPH PSDRV_AGLbyName[]; /* duplicates omitted */
357 extern const INT PSDRV_AGLbyUVSize; /* sorted by UV - */
358 extern const UNICODEGLYPH PSDRV_AGLbyUV[]; /* duplicates included */
361 extern INT16 WINAPI PSDRV_ExtDeviceMode16(HWND16 hwnd, HANDLE16 hDriver,
362 LPDEVMODEA lpdmOutput, LPSTR lpszDevice, LPSTR lpszPort,
363 LPDEVMODEA lpdmInput, LPSTR lpszProfile, WORD fwMode);
365 extern HANDLE PSDRV_Heap;
366 extern char *PSDRV_ANSIVector[256];
368 extern void PSDRV_MergeDevmodes(PSDRV_DEVMODEA *dm1, PSDRV_DEVMODEA *dm2,
370 extern BOOL PSDRV_GetFontMetrics(void);
371 extern PPD *PSDRV_ParsePPD(char *fname);
372 extern PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name);
373 extern const AFM *PSDRV_FindAFMinList(FONTFAMILY *head, LPCSTR name);
374 extern BOOL PSDRV_AddAFMtoList(FONTFAMILY **head, const AFM *afm,
376 extern void PSDRV_FreeAFMList( FONTFAMILY *head );
378 extern BOOL WINAPI PSDRV_Init(HINSTANCE hinst, DWORD reason, LPVOID reserved);
380 extern BOOL PSDRV_Brush(PSDRV_PDEVICE *physDev, BOOL EO);
381 extern BOOL PSDRV_SetFont( PSDRV_PDEVICE *physDev );
382 extern BOOL PSDRV_SetPen( PSDRV_PDEVICE *physDev );
384 extern BOOL PSDRV_CmpColor(PSCOLOR *col1, PSCOLOR *col2);
385 extern BOOL PSDRV_CopyColor(PSCOLOR *col1, PSCOLOR *col2);
386 extern void PSDRV_CreateColor( PSDRV_PDEVICE *physDev, PSCOLOR *pscolor,
388 extern char PSDRV_UnicodeToANSI(int u);
390 extern INT PSDRV_WriteHeader( PSDRV_PDEVICE *physDev, LPCSTR title );
391 extern INT PSDRV_WriteFooter( PSDRV_PDEVICE *physDev );
392 extern INT PSDRV_WriteNewPage( PSDRV_PDEVICE *physDev );
393 extern INT PSDRV_WriteEndPage( PSDRV_PDEVICE *physDev );
394 extern BOOL PSDRV_WriteMoveTo(PSDRV_PDEVICE *physDev, INT x, INT y);
395 extern BOOL PSDRV_WriteLineTo(PSDRV_PDEVICE *physDev, INT x, INT y);
396 extern BOOL PSDRV_WriteStroke(PSDRV_PDEVICE *physDev);
397 extern BOOL PSDRV_WriteRectangle(PSDRV_PDEVICE *physDev, INT x, INT y, INT width,
399 extern BOOL PSDRV_WriteRRectangle(PSDRV_PDEVICE *physDev, INT x, INT y, INT width,
401 extern BOOL PSDRV_WriteSetFont(PSDRV_PDEVICE *physDev, const char *name, INT size,
403 extern BOOL PSDRV_WriteGlyphShow(PSDRV_PDEVICE *physDev, LPCSTR g_name);
404 extern BOOL PSDRV_WriteSetPen(PSDRV_PDEVICE *physDev);
405 extern BOOL PSDRV_WriteArc(PSDRV_PDEVICE *physDev, INT x, INT y, INT w, INT h,
406 double ang1, double ang2);
407 extern BOOL PSDRV_WriteSetColor(PSDRV_PDEVICE *physDev, PSCOLOR *color);
408 extern BOOL PSDRV_WriteSetBrush(PSDRV_PDEVICE *physDev);
409 extern BOOL PSDRV_WriteFill(PSDRV_PDEVICE *physDev);
410 extern BOOL PSDRV_WriteEOFill(PSDRV_PDEVICE *physDev);
411 extern BOOL PSDRV_WriteGSave(PSDRV_PDEVICE *physDev);
412 extern BOOL PSDRV_WriteGRestore(PSDRV_PDEVICE *physDev);
413 extern BOOL PSDRV_WriteNewPath(PSDRV_PDEVICE *physDev);
414 extern BOOL PSDRV_WriteClosePath(PSDRV_PDEVICE *physDev);
415 extern BOOL PSDRV_WriteInitClip(PSDRV_PDEVICE *physDev);
416 extern BOOL PSDRV_WriteClip(PSDRV_PDEVICE *physDev);
417 extern BOOL PSDRV_WriteRectClip(PSDRV_PDEVICE *physDev, INT x, INT y, INT w, INT h);
418 extern BOOL PSDRV_WriteRectClip2(PSDRV_PDEVICE *physDev, CHAR *pszArrayName);
419 extern BOOL PSDRV_WriteEOClip(PSDRV_PDEVICE *physDev);
420 extern BOOL PSDRV_WriteHatch(PSDRV_PDEVICE *physDev);
421 extern BOOL PSDRV_WriteRotate(PSDRV_PDEVICE *physDev, float ang);
422 extern BOOL PSDRV_WriteIndexColorSpaceBegin(PSDRV_PDEVICE *physDev, int size);
423 extern BOOL PSDRV_WriteIndexColorSpaceEnd(PSDRV_PDEVICE *physDev);
424 extern BOOL PSDRV_WriteRGB(PSDRV_PDEVICE *physDev, COLORREF *map, int number);
425 extern BOOL PSDRV_WriteImageDict(PSDRV_PDEVICE *physDev, WORD depth, INT xDst, INT yDst,
426 INT widthDst, INT heightDst, INT widthSrc,
427 INT heightSrc, char *bits);
428 extern BOOL PSDRV_WriteBytes(PSDRV_PDEVICE *physDev, const BYTE *bytes, int number);
429 extern BOOL PSDRV_WriteDIBits16(PSDRV_PDEVICE *physDev, const WORD *words, int number);
430 extern BOOL PSDRV_WriteDIBits24(PSDRV_PDEVICE *physDev, const BYTE *bits, int number);
431 extern BOOL PSDRV_WriteDIBits32(PSDRV_PDEVICE *physDev, const BYTE *bits, int number);
432 extern int PSDRV_WriteSpool(PSDRV_PDEVICE *physDev, LPSTR lpData, WORD cch);
433 extern BOOL PSDRV_WritePatternDict(PSDRV_PDEVICE *physDev, BITMAP *bm, BYTE *bits);
434 extern BOOL PSDRV_WriteDIBPatternDict(PSDRV_PDEVICE *physDev, BITMAPINFO *bmi, UINT usage);
435 extern BOOL PSDRV_WriteArrayPut(PSDRV_PDEVICE *physDev, CHAR *pszArrayName, INT nIndex, LONG lCoord);
436 extern BOOL PSDRV_WriteArrayDef(PSDRV_PDEVICE *physDev, CHAR *pszArrayName, INT nSize);
438 extern BOOL PSDRV_Arc( PSDRV_PDEVICE *physDev, INT left, INT top, INT right,
439 INT bottom, INT xstart, INT ystart,
440 INT xend, INT yend );
441 extern BOOL PSDRV_Chord( PSDRV_PDEVICE *physDev, INT left, INT top, INT right,
442 INT bottom, INT xstart, INT ystart,
443 INT xend, INT yend );
444 extern BOOL PSDRV_Ellipse( PSDRV_PDEVICE *physDev, INT left, INT top, INT right,
446 extern INT PSDRV_EndDoc( PSDRV_PDEVICE *physDev );
447 extern INT PSDRV_EndPage( PSDRV_PDEVICE *physDev );
448 extern BOOL PSDRV_ExtTextOut( PSDRV_PDEVICE *physDev, INT x, INT y, UINT flags,
449 const RECT *lprect, LPCWSTR str, UINT count,
451 extern BOOL PSDRV_GetCharWidth( PSDRV_PDEVICE *physDev, UINT firstChar, UINT lastChar,
453 extern BOOL PSDRV_GetTextExtentPoint( PSDRV_PDEVICE *physDev, LPCWSTR str, INT count,
455 extern BOOL PSDRV_GetTextMetrics( PSDRV_PDEVICE *physDev, TEXTMETRICW *metrics );
456 extern BOOL PSDRV_LineTo( PSDRV_PDEVICE *physDev, INT x, INT y );
457 extern BOOL PSDRV_PatBlt( PSDRV_PDEVICE *physDev, INT x, INT y, INT width, INT height, DWORD
459 extern BOOL PSDRV_Pie( PSDRV_PDEVICE *physDev, INT left, INT top, INT right,
460 INT bottom, INT xstart, INT ystart,
461 INT xend, INT yend );
462 extern BOOL PSDRV_Polygon( PSDRV_PDEVICE *physDev, const POINT* pt, INT count );
463 extern BOOL PSDRV_Polyline( PSDRV_PDEVICE *physDev, const POINT* pt, INT count );
464 extern BOOL PSDRV_PolyPolygon( PSDRV_PDEVICE *physDev, const POINT* pts, const INT* counts,
466 extern BOOL PSDRV_PolyPolyline( PSDRV_PDEVICE *physDev, const POINT* pts, const DWORD* counts,
468 extern BOOL PSDRV_Rectangle( PSDRV_PDEVICE *physDev, INT left, INT top, INT right,
470 extern BOOL PSDRV_RoundRect(PSDRV_PDEVICE *physDev, INT left, INT top, INT right,
471 INT bottom, INT ell_width, INT ell_height);
472 extern COLORREF PSDRV_SetBkColor( PSDRV_PDEVICE *physDev, COLORREF color );
473 extern COLORREF PSDRV_SetPixel( PSDRV_PDEVICE *physDev, INT x, INT y, COLORREF color );
474 extern COLORREF PSDRV_SetTextColor( PSDRV_PDEVICE *physDev, COLORREF color );
475 extern INT PSDRV_StartDoc( PSDRV_PDEVICE *physDev, const DOCINFOA *doc );
476 extern INT PSDRV_StartPage( PSDRV_PDEVICE *physDev );
477 extern INT PSDRV_StretchDIBits( PSDRV_PDEVICE *physDev, INT xDst, INT yDst,
478 INT widthDst, INT heightDst, INT xSrc,
479 INT ySrc, INT widthSrc, INT heightSrc,
480 const void *bits, const BITMAPINFO *info,
481 UINT wUsage, DWORD dwRop );
483 extern INT PSDRV_ExtDeviceMode(LPSTR lpszDriver, HWND hwnd,
484 LPDEVMODEA lpdmOutput,
485 LPSTR lpszDevice, LPSTR lpszPort,
486 LPDEVMODEA lpdmInput, LPSTR lpszProfile,
488 extern DWORD PSDRV_DeviceCapabilities(LPSTR lpszDriver, LPCSTR lpszDevice,
490 WORD fwCapability, LPSTR lpszOutput,
492 VOID PSDRV_DrawLine( PSDRV_PDEVICE *physDev );
493 INT PSDRV_GlyphListInit(void);
494 const GLYPHNAME *PSDRV_GlyphName(LPCSTR szName);
495 VOID PSDRV_IndexGlyphList(void);
496 BOOL PSDRV_GetTrueTypeMetrics(void);
497 BOOL PSDRV_GetType1Metrics(void);
498 const AFMMETRICS *PSDRV_UVMetrics(LONG UV, const AFM *afm);
499 SHORT PSDRV_CalcAvgCharWidth(const AFM *afm);
501 extern BOOL PSDRV_SelectBuiltinFont(PSDRV_PDEVICE *physDev, HFONT hfont,
502 LOGFONTW *plf, LPSTR FaceName);
503 extern BOOL PSDRV_WriteSetBuiltinFont(PSDRV_PDEVICE *physDev);
504 extern BOOL PSDRV_WriteBuiltinGlyphShow(PSDRV_PDEVICE *physDev, LPCWSTR str, INT count);
506 extern BOOL PSDRV_SelectDownloadFont(PSDRV_PDEVICE *physDev);
507 extern BOOL PSDRV_WriteSetDownloadFont(PSDRV_PDEVICE *physDev);
508 extern BOOL PSDRV_WriteDownloadGlyphShow(PSDRV_PDEVICE *physDev, WORD *glpyhs,
510 extern BOOL PSDRV_EmptyDownloadList(PSDRV_PDEVICE *physDev);
512 #define MAX_G_NAME 31 /* max length of PS glyph name */
513 extern void get_glyph_name(HDC hdc, WORD index, char *name);
515 extern TYPE1 *T1_download_header(PSDRV_PDEVICE *physDev,
516 LPOUTLINETEXTMETRICA potm,
518 extern BOOL T1_download_glyph(PSDRV_PDEVICE *physDev, DOWNLOAD *pdl,
519 DWORD index, char *glyph_name);
520 extern void T1_free(TYPE1 *t1);
522 extern TYPE42 *T42_download_header(PSDRV_PDEVICE *physDev,
523 LPOUTLINETEXTMETRICA ptom,
525 extern BOOL T42_download_glyph(PSDRV_PDEVICE *physDev, DOWNLOAD *pdl,
526 DWORD index, char *glyph_name);
527 extern void T42_free(TYPE42 *t42);