oleaut32: Use a saner calling convention for the marshaller asm thunks.
[wine] / dlls / wineps.drv / psdrv.h
1 /*
2  *      PostScript driver definitions
3  *
4  *      Copyright 1998  Huw D M Davies
5  *
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.
10  *
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.
15  *
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
19  */
20
21 #ifndef __WINE_PSDRV_H
22 #define __WINE_PSDRV_H
23
24 #include <stdarg.h>
25
26 #include "windef.h"
27 #include "winbase.h"
28 #include "wingdi.h"
29 #include "winspool.h"
30
31 #include "wine/unicode.h"
32 #include "wine/gdi_driver.h"
33 #include "wine/list.h"
34
35 typedef struct {
36     INT             index;
37     LPCSTR          sz;
38 } GLYPHNAME;
39
40 typedef struct {
41     LONG            UV;
42     const GLYPHNAME *name;
43 } UNICODEGLYPH;
44
45 typedef struct {
46     float       llx, lly, urx, ury;
47 } AFMBBOX;
48
49 typedef struct _tagAFMLIGS {
50     char                *successor;
51     char                *ligature;
52     struct _tagAFMLIGS  *next;
53 } AFMLIGS;
54
55 typedef struct {
56     int                 C;              /* character */
57     LONG                UV;
58     float               WX;
59     const GLYPHNAME     *N;             /* name */
60     AFMBBOX             B;
61     const AFMLIGS       *L;             /* Ligatures */
62 } OLD_AFMMETRICS;
63
64 typedef struct {
65     INT                 C;                      /* AFM encoding (or -1) */
66     LONG                UV;                     /* Unicode value */
67     FLOAT               WX;                     /* Advance width */
68     const GLYPHNAME     *N;                     /* Glyph name */
69 } AFMMETRICS;
70
71 typedef struct {
72     USHORT              usUnitsPerEm;           /* head:unitsPerEm */
73     SHORT               sAscender;              /* hhea:Ascender */
74     SHORT               sDescender;             /* hhea:Descender */
75     SHORT               sLineGap;               /* hhea:LineGap */
76     SHORT               sAvgCharWidth;          /* OS/2:xAvgCharWidth */
77     SHORT               sTypoAscender;          /* OS/2:sTypoAscender */
78     SHORT               sTypoDescender;         /* OS/2:sTypoDescender */
79     SHORT               sTypoLineGap;           /* OS/2:sTypeLineGap */
80     USHORT              usWinAscent;            /* OS/2:usWinAscent */
81     USHORT              usWinDescent;           /* OS/2:usWinDescent */
82 } WINMETRICS;
83
84 typedef struct _tagAFM {
85     LPCSTR              FontName;
86     LPCSTR              FullName;
87     LPCSTR              FamilyName;
88     LPCSTR              EncodingScheme;
89     LONG                Weight;                 /* FW_NORMAL etc. */
90     float               ItalicAngle;
91     BOOL                IsFixedPitch;
92     float               UnderlinePosition;
93     float               UnderlineThickness;
94     AFMBBOX             FontBBox;
95     float               Ascender;
96     float               Descender;
97     WINMETRICS          WinMetrics;
98     int                 NumofMetrics;
99     const AFMMETRICS    *Metrics;
100 } AFM;
101
102 /* Note no 'next' in AFM. Use AFMLISTENTRY as a container. This allow more than
103    one list to exist without having to reallocate the entire AFM structure. We
104    keep a global list of all afms (PSDRV_AFMFontList) plus a list of available
105    fonts for each DC (dc->physDev->Fonts) */
106
107 typedef struct _tagAFMLISTENTRY {
108     const AFM                   *afm;
109     struct _tagAFMLISTENTRY     *next;
110 } AFMLISTENTRY;
111
112 typedef struct _tagFONTFAMILY {
113     char                        *FamilyName; /* family name */
114     AFMLISTENTRY                *afmlist;    /* list of afms for this family */
115     struct _tagFONTFAMILY       *next;       /* next family */
116 } FONTFAMILY;
117
118 extern FONTFAMILY   *PSDRV_AFMFontList DECLSPEC_HIDDEN;
119 extern const AFM    *const PSDRV_BuiltinAFMs[] DECLSPEC_HIDDEN;     /* last element is NULL */
120
121 typedef struct
122 {
123     struct list          entry;
124     char                *Name;
125 } FONTNAME;
126
127 typedef struct {
128     float       llx, lly, urx, ury;
129 } IMAGEABLEAREA;
130
131 typedef struct {
132     float       x, y;
133 } PAPERDIMENSION;
134
135 /* Solaris kludge */
136 #undef PAGESIZE
137 typedef struct _tagPAGESIZE {
138     struct list         entry;
139     char                *Name;
140     char                *FullName;
141     char                *InvocationString;
142     IMAGEABLEAREA       *ImageableArea;
143     PAPERDIMENSION      *PaperDimension;
144     WORD                WinPage; /*eg DMPAPER_A4. Doesn't really belong here */
145 } PAGESIZE;
146
147
148 /* For BANDINFO Escape */
149 typedef struct _BANDINFOSTRUCT
150 {
151     BOOL GraphicsFlag;
152     BOOL TextFlag;
153     RECT GraphicsRect;
154 } BANDINFOSTRUCT, *PBANDINFOSTRUCT;
155
156 typedef struct
157 {
158     struct list                 entry;
159     char                        *Feature1;
160     char                        *Value1;
161     char                        *Feature2;
162     char                        *Value2;
163 } CONSTRAINT;
164
165 typedef struct
166 {
167     struct list                 entry;
168     const char                  *Name;
169     const char                  *FullName;
170     char                        *InvocationString;
171     WORD                        WinBin; /* eg DMBIN_LOWER */
172 } INPUTSLOT;
173
174 typedef enum _RASTERIZEROPTION
175   {RO_None, RO_Accept68K, RO_Type42, RO_TrueImage} RASTERIZEROPTION;
176
177 typedef struct
178 {
179     struct list                 entry;
180     char                        *Name;
181     char                        *FullName;
182     char                        *InvocationString;
183     WORD                        WinDuplex; /* eg DMDUP_SIMPLEX */
184 } DUPLEX;
185
186 /* Many Mac OS X based ppd files don't include a *ColorDevice line, so
187    we use a tristate here rather than a boolean.  Code that
188    cares is expected to treat these as if they were colour. */
189 typedef enum {
190     CD_NotSpecified,
191     CD_False,
192     CD_True
193 } COLORDEVICE;
194
195 typedef struct {
196     char                *NickName;
197     int                 LanguageLevel;
198     COLORDEVICE         ColorDevice;
199     int                 DefaultResolution;
200     signed int          LandscapeOrientation;
201     char                *JCLBegin;
202     char                *JCLToPSInterpreter;
203     char                *JCLEnd;
204     char                *DefaultFont;
205     struct list         InstalledFonts;
206     struct list         PageSizes;
207     PAGESIZE            *DefaultPageSize;
208     struct list         Constraints;
209     struct list         InputSlots;
210     RASTERIZEROPTION    TTRasterizer;
211     struct list         Duplexes;
212     DUPLEX              *DefaultDuplex;
213 } PPD;
214
215 typedef struct {
216     DEVMODEW                    dmPublic;
217     struct _tagdocprivate {
218       int dummy;
219     }                           dmDocPrivate;
220     struct _tagdrvprivate {
221       UINT      numInstalledOptions; /* Options at end of struct */
222     }                           dmDrvPrivate;
223
224 /* Now comes:
225
226 numInstalledOptions of OPTIONs
227
228 */
229
230 } PSDRV_DEVMODE;
231
232 typedef struct
233 {
234     struct list             entry;
235     WCHAR                   *friendly_name;
236     PPD                     *ppd;
237     PSDRV_DEVMODE           *Devmode;
238     FONTFAMILY              *Fonts;
239     PPRINTER_ENUM_VALUESA   FontSubTable;
240     DWORD                   FontSubTableSize;
241 } PRINTERINFO;
242
243 typedef struct {
244     float               r, g, b;
245 } PSRGB;
246
247 typedef struct {
248     float               i;
249 } PSGRAY;
250
251
252 /* def's for PSCOLOR.type */
253 #define PSCOLOR_GRAY    0
254 #define PSCOLOR_RGB     1
255
256 typedef struct {
257     int                 type;
258     union {
259         PSRGB  rgb;
260         PSGRAY gray;
261     }                   value;
262 } PSCOLOR;
263
264 typedef struct {
265     const AFM           *afm;
266     float               scale;
267     TEXTMETRICW         tm;
268 } BUILTIN;
269
270 typedef struct tagTYPE42 TYPE42;
271
272 typedef struct tagTYPE1 TYPE1;
273
274 enum downloadtype {
275   Type1, Type42
276 };
277
278 typedef struct _tagDOWNLOAD {
279   enum downloadtype type;
280   union {
281     TYPE1  *Type1;
282     TYPE42 *Type42;
283   } typeinfo;
284   char *ps_name;
285   struct _tagDOWNLOAD *next;
286 } DOWNLOAD;
287
288 enum fontloc {
289   Builtin, Download
290 };
291
292 typedef struct
293 {
294     INT xx, xy, yx, yy;
295 } matrix;
296
297 typedef struct {
298     enum fontloc        fontloc;
299     union {
300         BUILTIN  Builtin;
301         DOWNLOAD *Download;
302     }                   fontinfo;
303
304     matrix              size;
305     PSCOLOR             color;
306     BOOL                set;            /* Have we done a setfont yet */
307
308   /* These are needed by PSDRV_ExtTextOut */
309     int                 escapement;
310     int                 underlineThickness;
311     int                 underlinePosition;
312     int                 strikeoutThickness;
313     int                 strikeoutPosition;
314
315 } PSFONT;
316
317 typedef struct {
318     PSCOLOR              color;
319     BOOL                 set;
320     struct brush_pattern pattern;
321 } PSBRUSH;
322
323 #define MAX_DASHLEN 16
324
325 typedef struct {
326     INT                 style;
327     INT                 width;
328     BYTE                join;
329     BYTE                endcap;
330     DWORD               dash[MAX_DASHLEN];
331     DWORD               dash_len;
332     PSCOLOR             color;
333     BOOL                set;
334 } PSPEN;
335
336 typedef struct {
337     DWORD               id;             /* Job id */
338     HANDLE              hprinter;       /* Printer handle */
339     LPWSTR              output;         /* Output file/port */
340     LPWSTR              doc_name;       /* Document Name */
341     BOOL                banding;        /* Have we received a NEXTBAND */
342     BOOL                OutOfPage;      /* Page header not sent yet */
343     INT                 PageNo;
344     BOOL                quiet;          /* Don't actually output anything */
345     BOOL                in_passthrough; /* In PASSTHROUGH mode */
346     BOOL                had_passthrough_rect; /* See the comment in PSDRV_Rectangle */
347 } JOB;
348
349 typedef struct
350 {
351     struct gdi_physdev  dev;
352     PSFONT              font;           /* Current PS font */
353     DOWNLOAD            *downloaded_fonts;
354     PSPEN               pen;
355     PSBRUSH             brush;
356     PSCOLOR             bkColor;
357     PSCOLOR             inkColor;       /* Last colour set */
358     JOB                 job;
359     PSDRV_DEVMODE       *Devmode;
360     PRINTERINFO         *pi;
361     SIZE                PageSize;      /* Physical page size in device units */
362     RECT                ImageableArea; /* Imageable area in device units */
363                                        /* NB both PageSize and ImageableArea
364                                           are not rotated in landscape mode,
365                                           so PageSize.cx is generally
366                                           < PageSize.cy */
367     int                 horzRes;       /* device caps */
368     int                 vertRes;
369     int                 horzSize;
370     int                 vertSize;
371     int                 logPixelsX;
372     int                 logPixelsY;
373
374     int                 pathdepth;
375 } PSDRV_PDEVICE;
376
377 static inline PSDRV_PDEVICE *get_psdrv_dev( PHYSDEV dev )
378 {
379     return (PSDRV_PDEVICE *)dev;
380 }
381
382 /*
383  *  Every glyph name in the Adobe Glyph List and the 35 core PostScript fonts
384  */
385
386 extern const INT    PSDRV_AGLGlyphNamesSize;
387 extern GLYPHNAME    PSDRV_AGLGlyphNames[] DECLSPEC_HIDDEN;
388
389
390 /*
391  *  The AGL encoding vector
392  */
393
394 extern const INT            PSDRV_AGLbyNameSize;    /* sorted by name -     */
395 extern const UNICODEGLYPH   PSDRV_AGLbyName[] DECLSPEC_HIDDEN;      /*  duplicates omitted  */
396
397 extern const INT            PSDRV_AGLbyUVSize;      /* sorted by UV -       */
398 extern const UNICODEGLYPH   PSDRV_AGLbyUV[] DECLSPEC_HIDDEN;        /*  duplicates included */
399
400 extern HINSTANCE PSDRV_hInstance DECLSPEC_HIDDEN;
401 extern HANDLE PSDRV_Heap DECLSPEC_HIDDEN;
402 extern char *PSDRV_ANSIVector[256] DECLSPEC_HIDDEN;
403
404 extern INPUTSLOT *find_slot( PPD *ppd, PSDRV_DEVMODE *dm );
405 extern PAGESIZE *find_pagesize( PPD *ppd, PSDRV_DEVMODE *dm );
406 extern DUPLEX *find_duplex( PPD *ppd, PSDRV_DEVMODE *dm );
407
408 /* GDI driver functions */
409 extern BOOL PSDRV_Arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
410                        INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN;
411 extern BOOL PSDRV_Chord( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
412                          INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN;
413 extern DWORD PSDRV_DeviceCapabilities(LPSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszPort,
414                                       WORD fwCapability, LPSTR lpszOutput, LPDEVMODEA lpDevMode) DECLSPEC_HIDDEN;
415 extern BOOL PSDRV_Ellipse( PHYSDEV dev, INT left, INT top, INT right, INT bottom) DECLSPEC_HIDDEN;
416 extern INT PSDRV_EndDoc( PHYSDEV dev ) DECLSPEC_HIDDEN;
417 extern INT PSDRV_EndPage( PHYSDEV dev ) DECLSPEC_HIDDEN;
418 extern BOOL PSDRV_EnumFonts( PHYSDEV dev, LPLOGFONTW plf, FONTENUMPROCW proc, LPARAM lp ) DECLSPEC_HIDDEN;
419 extern INT PSDRV_ExtDeviceMode(LPSTR lpszDriver, HWND hwnd, LPDEVMODEA lpdmOutput,
420                                LPSTR lpszDevice, LPSTR lpszPort, LPDEVMODEA lpdmInput,
421                                LPSTR lpszProfile, DWORD dwMode) DECLSPEC_HIDDEN;
422 extern INT PSDRV_ExtEscape( PHYSDEV dev, INT nEscape, INT cbInput, LPCVOID in_data,
423                             INT cbOutput, LPVOID out_data ) DECLSPEC_HIDDEN;
424 extern BOOL PSDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
425                               const RECT *lprect, LPCWSTR str, UINT count, const INT *lpDx ) DECLSPEC_HIDDEN;
426 extern BOOL PSDRV_FillPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
427 extern BOOL PSDRV_GetCharWidth(PHYSDEV dev, UINT firstChar, UINT lastChar, LPINT buffer) DECLSPEC_HIDDEN;
428 extern BOOL PSDRV_GetTextExtentExPoint(PHYSDEV dev, LPCWSTR str, INT count, LPINT alpDx) DECLSPEC_HIDDEN;
429 extern BOOL PSDRV_GetTextMetrics(PHYSDEV dev, TEXTMETRICW *metrics) DECLSPEC_HIDDEN;
430 extern BOOL PSDRV_LineTo(PHYSDEV dev, INT x, INT y) DECLSPEC_HIDDEN;
431 extern BOOL PSDRV_PaintRgn( PHYSDEV dev, HRGN hrgn ) DECLSPEC_HIDDEN;
432 extern BOOL PSDRV_PatBlt(PHYSDEV dev, struct bitblt_coords *dst, DWORD dwRop) DECLSPEC_HIDDEN;
433 extern BOOL PSDRV_Pie( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
434                        INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN;
435 extern BOOL PSDRV_PolyBezier( PHYSDEV dev, const POINT *pts, DWORD count ) DECLSPEC_HIDDEN;
436 extern BOOL PSDRV_PolyBezierTo( PHYSDEV dev, const POINT *pts, DWORD count ) DECLSPEC_HIDDEN;
437 extern BOOL PSDRV_PolyPolygon( PHYSDEV dev, const POINT* pts, const INT* counts, UINT polygons ) DECLSPEC_HIDDEN;
438 extern BOOL PSDRV_PolyPolyline( PHYSDEV dev, const POINT* pts, const DWORD* counts, DWORD polylines ) DECLSPEC_HIDDEN;
439 extern DWORD PSDRV_PutImage( PHYSDEV dev, HRGN clip, BITMAPINFO *info,
440                              const struct gdi_image_bits *bits, struct bitblt_coords *src,
441                              struct bitblt_coords *dst, DWORD rop ) DECLSPEC_HIDDEN;
442 extern BOOL PSDRV_Rectangle( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN;
443 extern BOOL PSDRV_RoundRect( PHYSDEV dev, INT left, INT top, INT right,
444                              INT bottom, INT ell_width, INT ell_height ) DECLSPEC_HIDDEN;
445 extern HBRUSH PSDRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush, const struct brush_pattern *pattern ) DECLSPEC_HIDDEN;
446 extern HFONT PSDRV_SelectFont( PHYSDEV dev, HFONT hfont, UINT *aa_flags ) DECLSPEC_HIDDEN;
447 extern HPEN PSDRV_SelectPen( PHYSDEV dev, HPEN hpen, const struct brush_pattern *pattern ) DECLSPEC_HIDDEN;
448 extern COLORREF PSDRV_SetBkColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
449 extern COLORREF PSDRV_SetDCBrushColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
450 extern COLORREF PSDRV_SetDCPenColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
451 extern COLORREF PSDRV_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color ) DECLSPEC_HIDDEN;
452 extern COLORREF PSDRV_SetTextColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
453 extern INT PSDRV_StartDoc( PHYSDEV dev, const DOCINFOW *doc ) DECLSPEC_HIDDEN;
454 extern BOOL PSDRV_StrokeAndFillPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
455 extern BOOL PSDRV_StrokePath( PHYSDEV dev ) DECLSPEC_HIDDEN;
456
457 extern void PSDRV_MergeDevmodes(PSDRV_DEVMODE *dm1, PSDRV_DEVMODE *dm2,
458                          PRINTERINFO *pi) DECLSPEC_HIDDEN;
459 extern BOOL PSDRV_GetFontMetrics(void) DECLSPEC_HIDDEN;
460 extern PPD *PSDRV_ParsePPD(char *fname, HANDLE printer) DECLSPEC_HIDDEN;
461 extern PRINTERINFO *PSDRV_FindPrinterInfo(LPCWSTR name) DECLSPEC_HIDDEN;
462 extern const AFM *PSDRV_FindAFMinList(FONTFAMILY *head, LPCSTR name) DECLSPEC_HIDDEN;
463 extern BOOL PSDRV_AddAFMtoList(FONTFAMILY **head, const AFM *afm,
464         BOOL *p_added) DECLSPEC_HIDDEN;
465 extern void PSDRV_FreeAFMList( FONTFAMILY *head ) DECLSPEC_HIDDEN;
466
467 extern INT PSDRV_XWStoDS( PHYSDEV dev, INT width ) DECLSPEC_HIDDEN;
468
469 extern BOOL PSDRV_Brush(PHYSDEV dev, BOOL EO) DECLSPEC_HIDDEN;
470 extern BOOL PSDRV_SetFont( PHYSDEV dev ) DECLSPEC_HIDDEN;
471 extern BOOL PSDRV_SetPen( PHYSDEV dev ) DECLSPEC_HIDDEN;
472
473 extern void PSDRV_AddClip( PHYSDEV dev, HRGN hrgn ) DECLSPEC_HIDDEN;
474 extern void PSDRV_SetClip( PHYSDEV dev ) DECLSPEC_HIDDEN;
475 extern void PSDRV_ResetClip( PHYSDEV dev ) DECLSPEC_HIDDEN;
476
477 extern BOOL PSDRV_CopyColor(PSCOLOR *col1, PSCOLOR *col2) DECLSPEC_HIDDEN;
478 extern void PSDRV_CreateColor( PHYSDEV dev, PSCOLOR *pscolor,
479                      COLORREF wincolor ) DECLSPEC_HIDDEN;
480 extern char PSDRV_UnicodeToANSI(int u) DECLSPEC_HIDDEN;
481
482 extern INT PSDRV_WriteHeader( PHYSDEV dev, LPCWSTR title ) DECLSPEC_HIDDEN;
483 extern INT PSDRV_WriteFooter( PHYSDEV dev ) DECLSPEC_HIDDEN;
484 extern INT PSDRV_WriteNewPage( PHYSDEV dev ) DECLSPEC_HIDDEN;
485 extern INT PSDRV_WriteEndPage( PHYSDEV dev ) DECLSPEC_HIDDEN;
486 extern BOOL PSDRV_WriteMoveTo(PHYSDEV dev, INT x, INT y) DECLSPEC_HIDDEN;
487 extern BOOL PSDRV_WriteLineTo(PHYSDEV dev, INT x, INT y) DECLSPEC_HIDDEN;
488 extern BOOL PSDRV_WriteStroke(PHYSDEV dev) DECLSPEC_HIDDEN;
489 extern BOOL PSDRV_WriteRectangle(PHYSDEV dev, INT x, INT y, INT width, INT height) DECLSPEC_HIDDEN;
490 extern BOOL PSDRV_WriteRRectangle(PHYSDEV dev, INT x, INT y, INT width, INT height) DECLSPEC_HIDDEN;
491 extern BOOL PSDRV_WriteSetFont(PHYSDEV dev, const char *name, matrix size, INT escapement,
492                                BOOL fake_italic) DECLSPEC_HIDDEN;
493 extern BOOL PSDRV_WriteGlyphShow(PHYSDEV dev, LPCSTR g_name) DECLSPEC_HIDDEN;
494 extern BOOL PSDRV_WriteSetPen(PHYSDEV dev) DECLSPEC_HIDDEN;
495 extern BOOL PSDRV_WriteArc(PHYSDEV dev, INT x, INT y, INT w, INT h,
496                              double ang1, double ang2) DECLSPEC_HIDDEN;
497 extern BOOL PSDRV_WriteCurveTo(PHYSDEV dev, POINT pts[3]) DECLSPEC_HIDDEN;
498 extern BOOL PSDRV_WriteSetColor(PHYSDEV dev, PSCOLOR *color) DECLSPEC_HIDDEN;
499 extern BOOL PSDRV_WriteSetBrush(PHYSDEV dev) DECLSPEC_HIDDEN;
500 extern BOOL PSDRV_WriteFill(PHYSDEV dev) DECLSPEC_HIDDEN;
501 extern BOOL PSDRV_WriteEOFill(PHYSDEV dev) DECLSPEC_HIDDEN;
502 extern BOOL PSDRV_WriteGSave(PHYSDEV dev) DECLSPEC_HIDDEN;
503 extern BOOL PSDRV_WriteGRestore(PHYSDEV dev) DECLSPEC_HIDDEN;
504 extern BOOL PSDRV_WriteNewPath(PHYSDEV dev) DECLSPEC_HIDDEN;
505 extern BOOL PSDRV_WriteClosePath(PHYSDEV dev) DECLSPEC_HIDDEN;
506 extern BOOL PSDRV_WriteClip(PHYSDEV dev) DECLSPEC_HIDDEN;
507 extern BOOL PSDRV_WriteRectClip(PHYSDEV dev, INT x, INT y, INT w, INT h) DECLSPEC_HIDDEN;
508 extern BOOL PSDRV_WriteRectClip2(PHYSDEV dev, CHAR *pszArrayName) DECLSPEC_HIDDEN;
509 extern BOOL PSDRV_WriteEOClip(PHYSDEV dev) DECLSPEC_HIDDEN;
510 extern BOOL PSDRV_WriteHatch(PHYSDEV dev) DECLSPEC_HIDDEN;
511 extern BOOL PSDRV_WriteRotate(PHYSDEV dev, float ang) DECLSPEC_HIDDEN;
512 extern BOOL PSDRV_WriteIndexColorSpaceBegin(PHYSDEV dev, int size) DECLSPEC_HIDDEN;
513 extern BOOL PSDRV_WriteIndexColorSpaceEnd(PHYSDEV dev) DECLSPEC_HIDDEN;
514 extern BOOL PSDRV_WriteRGBQUAD(PHYSDEV dev, const RGBQUAD *rgb, int number) DECLSPEC_HIDDEN;
515 extern BOOL PSDRV_WriteImage(PHYSDEV dev, WORD depth, INT xDst, INT yDst,
516                              INT widthDst, INT heightDst, INT widthSrc,
517                              INT heightSrc, BOOL mask, BOOL top_down) DECLSPEC_HIDDEN;
518 extern BOOL PSDRV_WriteBytes(PHYSDEV dev, const BYTE *bytes, DWORD number) DECLSPEC_HIDDEN;
519 extern BOOL PSDRV_WriteData(PHYSDEV dev, const BYTE *byte, DWORD number) DECLSPEC_HIDDEN;
520 extern DWORD PSDRV_WriteSpool(PHYSDEV dev, LPCSTR lpData, DWORD cch) DECLSPEC_HIDDEN;
521 extern BOOL PSDRV_WriteDIBPatternDict(PHYSDEV dev, const BITMAPINFO *bmi, BYTE *bits, UINT usage) DECLSPEC_HIDDEN;
522 extern BOOL PSDRV_WriteArrayPut(PHYSDEV dev, CHAR *pszArrayName, INT nIndex, LONG lCoord) DECLSPEC_HIDDEN;
523 extern BOOL PSDRV_WriteArrayDef(PHYSDEV dev, CHAR *pszArrayName, INT nSize) DECLSPEC_HIDDEN;
524
525 extern INT PSDRV_StartPage( PHYSDEV dev ) DECLSPEC_HIDDEN;
526
527 INT PSDRV_GlyphListInit(void) DECLSPEC_HIDDEN;
528 const GLYPHNAME *PSDRV_GlyphName(LPCSTR szName) DECLSPEC_HIDDEN;
529 VOID PSDRV_IndexGlyphList(void) DECLSPEC_HIDDEN;
530 BOOL PSDRV_GetType1Metrics(void) DECLSPEC_HIDDEN;
531 const AFMMETRICS *PSDRV_UVMetrics(LONG UV, const AFM *afm) DECLSPEC_HIDDEN;
532 SHORT PSDRV_CalcAvgCharWidth(const AFM *afm) DECLSPEC_HIDDEN;
533
534 extern BOOL PSDRV_SelectBuiltinFont(PHYSDEV dev, HFONT hfont,
535                                     LOGFONTW *plf, LPSTR FaceName) DECLSPEC_HIDDEN;
536 extern BOOL PSDRV_WriteSetBuiltinFont(PHYSDEV dev) DECLSPEC_HIDDEN;
537 extern BOOL PSDRV_WriteBuiltinGlyphShow(PHYSDEV dev, LPCWSTR str, INT count) DECLSPEC_HIDDEN;
538
539 extern BOOL PSDRV_SelectDownloadFont(PHYSDEV dev) DECLSPEC_HIDDEN;
540 extern BOOL PSDRV_WriteSetDownloadFont(PHYSDEV dev) DECLSPEC_HIDDEN;
541 extern BOOL PSDRV_WriteDownloadGlyphShow(PHYSDEV dev, const WORD *glpyhs, UINT count) DECLSPEC_HIDDEN;
542 extern BOOL PSDRV_EmptyDownloadList(PHYSDEV dev, BOOL write_undef) DECLSPEC_HIDDEN;
543
544 extern DWORD write_spool( PHYSDEV dev, const void *data, DWORD num ) DECLSPEC_HIDDEN;
545
546 #define MAX_G_NAME 31 /* max length of PS glyph name */
547 extern void get_glyph_name(HDC hdc, WORD index, char *name) DECLSPEC_HIDDEN;
548
549 extern TYPE1 *T1_download_header(PHYSDEV dev, char *ps_name,
550                                  RECT *bbox, UINT emsize) DECLSPEC_HIDDEN;
551 extern BOOL T1_download_glyph(PHYSDEV dev, DOWNLOAD *pdl,
552                               DWORD index, char *glyph_name) DECLSPEC_HIDDEN;
553 extern void T1_free(TYPE1 *t1) DECLSPEC_HIDDEN;
554
555 extern TYPE42 *T42_download_header(PHYSDEV dev, char *ps_name,
556                                    RECT *bbox, UINT emsize) DECLSPEC_HIDDEN;
557 extern BOOL T42_download_glyph(PHYSDEV dev, DOWNLOAD *pdl,
558                                DWORD index, char *glyph_name) DECLSPEC_HIDDEN;
559 extern void T42_free(TYPE42 *t42) DECLSPEC_HIDDEN;
560
561 extern DWORD RLE_encode(BYTE *in_buf, DWORD len, BYTE *out_buf) DECLSPEC_HIDDEN;
562 extern DWORD ASCII85_encode(BYTE *in_buf, DWORD len, BYTE *out_buf) DECLSPEC_HIDDEN;
563
564 #define push_lc_numeric(x) do {                                 \
565         const char *tmplocale = setlocale(LC_NUMERIC,NULL);     \
566         setlocale(LC_NUMERIC,x);
567
568 #define pop_lc_numeric()                                        \
569         setlocale(LC_NUMERIC,tmplocale);                        \
570 } while (0)
571
572 static inline WCHAR *strdupW( const WCHAR *str )
573 {
574     int size;
575     WCHAR *ret;
576
577     if (!str) return NULL;
578     size = (strlenW( str ) + 1) * sizeof(WCHAR);
579     ret = HeapAlloc( GetProcessHeap(), 0, size );
580     if (ret) memcpy( ret, str, size );
581     return ret;
582 }
583
584 #endif