psdrv.h 21.2 KB
Newer Older
Alexandre Julliard's avatar
Alexandre Julliard committed
1
/*
Alexandre Julliard's avatar
Alexandre Julliard committed
2
 *	PostScript driver definitions
Alexandre Julliard's avatar
Alexandre Julliard committed
3 4
 *
 *	Copyright 1998  Huw D M Davies
5 6 7 8 9 10 11 12 13 14 15 16 17
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * 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
Alexandre Julliard's avatar
Alexandre Julliard committed
19
 */
20 21 22 23

#ifndef __WINE_PSDRV_H
#define __WINE_PSDRV_H

24 25
#include <stdarg.h>

26
#include "windef.h"
27
#include "winbase.h"
28
#include "wingdi.h"
29
#include "winspool.h"
Alexandre Julliard's avatar
Alexandre Julliard committed
30

31
#include "wine/unicode.h"
32
#include "wine/gdi_driver.h"
33 34
#include "wine/list.h"

35
typedef struct {
36 37
    INT		    index;
    LPCSTR	    sz;
38 39 40
} GLYPHNAME;

typedef struct {
41
    LONG	    UV;
42
    const GLYPHNAME *name;
43 44
} UNICODEGLYPH;

Alexandre Julliard's avatar
Alexandre Julliard committed
45 46 47 48 49 50 51 52 53 54
typedef struct {
    float	llx, lly, urx, ury;
} AFMBBOX;

typedef struct _tagAFMLIGS {
    char		*successor;
    char		*ligature;
    struct _tagAFMLIGS	*next;
} AFMLIGS;

55
typedef struct {
56
    int			C;		/* character */
57 58
    LONG     	    	UV;
    float		WX;
59
    const GLYPHNAME	*N;		/* name */
60
    AFMBBOX		B;
61
    const AFMLIGS	*L;		/* Ligatures */
62 63 64 65 66 67 68
} OLD_AFMMETRICS;

typedef struct {
    INT     	    	C;  	    	    	/* AFM encoding (or -1) */
    LONG    	    	UV; 	    	    	/* Unicode value */
    FLOAT   	    	WX; 	    	    	/* Advance width */
    const GLYPHNAME 	*N; 	    	    	/* Glyph name */
Alexandre Julliard's avatar
Alexandre Julliard committed
69 70
} AFMMETRICS;

71
typedef struct {
72 73 74 75
    USHORT    	    	usUnitsPerEm; 	    	/* head:unitsPerEm */
    SHORT   	    	sAscender;  	    	/* hhea:Ascender */
    SHORT   	    	sDescender; 	    	/* hhea:Descender */
    SHORT   	    	sLineGap;   	    	/* hhea:LineGap */
76
    SHORT   	    	sAvgCharWidth;	    	/* OS/2:xAvgCharWidth */
77 78 79 80 81
    SHORT   	    	sTypoAscender;	    	/* OS/2:sTypoAscender */
    SHORT   	    	sTypoDescender;     	/* OS/2:sTypoDescender */
    SHORT   	    	sTypoLineGap;	    	/* OS/2:sTypeLineGap */
    USHORT  	    	usWinAscent;	    	/* OS/2:usWinAscent */
    USHORT  	    	usWinDescent;	    	/* OS/2:usWinDescent */
82 83
} WINMETRICS;

Alexandre Julliard's avatar
Alexandre Julliard committed
84
typedef struct _tagAFM {
85 86 87 88
    LPCSTR		FontName;
    LPCSTR		FullName;
    LPCSTR		FamilyName;
    LPCSTR		EncodingScheme;
89
    LONG		Weight;			/* FW_NORMAL etc. */
Alexandre Julliard's avatar
Alexandre Julliard committed
90
    float		ItalicAngle;
91
    BOOL		IsFixedPitch;
Alexandre Julliard's avatar
Alexandre Julliard committed
92 93 94 95 96
    float		UnderlinePosition;
    float		UnderlineThickness;
    AFMBBOX		FontBBox;
    float		Ascender;
    float		Descender;
97
    WINMETRICS	    	WinMetrics;
Alexandre Julliard's avatar
Alexandre Julliard committed
98
    int			NumofMetrics;
99
    const AFMMETRICS	*Metrics;
100
} AFM;
Alexandre Julliard's avatar
Alexandre Julliard committed
101

Alexandre Julliard's avatar
Alexandre Julliard committed
102 103 104 105 106 107
/* Note no 'next' in AFM. Use AFMLISTENTRY as a container. This allow more than
   one list to exist without having to reallocate the entire AFM structure. We
   keep a global list of all afms (PSDRV_AFMFontList) plus a list of available
   fonts for each DC (dc->physDev->Fonts) */

typedef struct _tagAFMLISTENTRY {
108
    const AFM			*afm;
Alexandre Julliard's avatar
Alexandre Julliard committed
109 110 111 112
    struct _tagAFMLISTENTRY	*next;
} AFMLISTENTRY;

typedef struct _tagFONTFAMILY {
Alexandre Julliard's avatar
Alexandre Julliard committed
113
    char			*FamilyName; /* family name */
Alexandre Julliard's avatar
Alexandre Julliard committed
114 115 116 117
    AFMLISTENTRY		*afmlist;    /* list of afms for this family */
    struct _tagFONTFAMILY	*next;       /* next family */
} FONTFAMILY;

118 119
extern FONTFAMILY   *PSDRV_AFMFontList DECLSPEC_HIDDEN;
extern const AFM    *const PSDRV_BuiltinAFMs[] DECLSPEC_HIDDEN;     /* last element is NULL */
Alexandre Julliard's avatar
Alexandre Julliard committed
120

121 122 123
typedef struct
{
    struct list          entry;
Alexandre Julliard's avatar
Alexandre Julliard committed
124 125 126 127 128 129 130 131 132 133 134
    char		*Name;
} FONTNAME;

typedef struct {
    float	llx, lly, urx, ury;
} IMAGEABLEAREA;

typedef struct {
    float	x, y;
} PAPERDIMENSION;

135 136
/* Solaris kludge */
#undef PAGESIZE
Alexandre Julliard's avatar
Alexandre Julliard committed
137
typedef struct _tagPAGESIZE {
138
    struct list         entry;
Alexandre Julliard's avatar
Alexandre Julliard committed
139 140 141 142 143 144 145 146 147
    char		*Name;
    char		*FullName;
    char		*InvocationString;
    IMAGEABLEAREA	*ImageableArea;
    PAPERDIMENSION	*PaperDimension;
    WORD		WinPage; /*eg DMPAPER_A4. Doesn't really belong here */
} PAGESIZE;


148 149 150 151 152 153 154 155
/* For BANDINFO Escape */
typedef struct _BANDINFOSTRUCT
{
    BOOL GraphicsFlag;
    BOOL TextFlag;
    RECT GraphicsRect;
} BANDINFOSTRUCT, *PBANDINFOSTRUCT;

156 157 158
typedef struct
{
    struct list                 entry;
Alexandre Julliard's avatar
Alexandre Julliard committed
159 160 161 162 163 164
    char			*Feature1;
    char			*Value1;
    char			*Feature2;
    char			*Value2;
} CONSTRAINT;

165 166 167
typedef struct
{
    struct list                 entry;
168 169
    const char			*Name;
    const char			*FullName;
Alexandre Julliard's avatar
Alexandre Julliard committed
170 171 172 173
    char			*InvocationString;
    WORD			WinBin; /* eg DMBIN_LOWER */
} INPUTSLOT;

174 175 176
typedef enum _RASTERIZEROPTION
  {RO_None, RO_Accept68K, RO_Type42, RO_TrueImage} RASTERIZEROPTION;

177 178 179
typedef struct
{
    struct list                 entry;
180 181 182 183 184 185
    char                        *Name;
    char                        *FullName;
    char                        *InvocationString;
    WORD                        WinDuplex; /* eg DMDUP_SIMPLEX */
} DUPLEX;

186
/* Many Mac OS X based ppd files don't include a *ColorDevice line, so
187 188 189 190 191 192 193 194
   we use a tristate here rather than a boolean.  Code that
   cares is expected to treat these as if they were colour. */
typedef enum {
    CD_NotSpecified,
    CD_False,
    CD_True
} COLORDEVICE;

Alexandre Julliard's avatar
Alexandre Julliard committed
195 196 197
typedef struct {
    char		*NickName;
    int			LanguageLevel;
198
    COLORDEVICE	        ColorDevice;
Alexandre Julliard's avatar
Alexandre Julliard committed
199
    int			DefaultResolution;
Alexandre Julliard's avatar
Alexandre Julliard committed
200
    signed int		LandscapeOrientation;
Alexandre Julliard's avatar
Alexandre Julliard committed
201 202 203 204
    char		*JCLBegin;
    char		*JCLToPSInterpreter;
    char		*JCLEnd;
    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;
Alexandre Julliard's avatar
Alexandre Julliard committed
213 214 215
} PPD;

typedef struct {
216
    DEVMODEW			dmPublic;
Alexandre Julliard's avatar
Alexandre Julliard committed
217
    struct _tagdocprivate {
Patrik Stridvall's avatar
Patrik Stridvall committed
218
      int dummy;
Alexandre Julliard's avatar
Alexandre Julliard committed
219 220
    }				dmDocPrivate;
    struct _tagdrvprivate {
221
      UINT	numInstalledOptions; /* Options at end of struct */
Alexandre Julliard's avatar
Alexandre Julliard committed
222 223 224 225 226 227 228 229
    }				dmDrvPrivate;

/* Now comes:

numInstalledOptions of OPTIONs

*/

230
} PSDRV_DEVMODE;
Alexandre Julliard's avatar
Alexandre Julliard committed
231

232 233 234
typedef struct
{
    struct list             entry;
235
    WCHAR                   *friendly_name;
236
    PPD			    *ppd;
237
    PSDRV_DEVMODE	    *Devmode;
238 239 240
    FONTFAMILY		    *Fonts;
    PPRINTER_ENUM_VALUESA   FontSubTable;
    DWORD		    FontSubTableSize;
Alexandre Julliard's avatar
Alexandre Julliard committed
241
} PRINTERINFO;
Alexandre Julliard's avatar
Alexandre Julliard committed
242

Alexandre Julliard's avatar
Alexandre Julliard committed
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263
typedef struct {
    float		r, g, b;
} PSRGB;

typedef struct {
    float		i;
} PSGRAY;


/* def's for PSCOLOR.type */
#define PSCOLOR_GRAY	0
#define PSCOLOR_RGB	1

typedef struct {
    int			type;
    union {
        PSRGB  rgb;
        PSGRAY gray;
    }                   value;
} PSCOLOR;

Alexandre Julliard's avatar
Alexandre Julliard committed
264
typedef struct {
265
    const AFM           *afm;
266
    float               scale;
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291
    TEXTMETRICW         tm;
} BUILTIN;

typedef struct tagTYPE42 TYPE42;

typedef struct tagTYPE1 TYPE1;

enum downloadtype {
  Type1, Type42
};

typedef struct _tagDOWNLOAD {
  enum downloadtype type;
  union {
    TYPE1  *Type1;
    TYPE42 *Type42;
  } typeinfo;
  char *ps_name;
  struct _tagDOWNLOAD *next;
} DOWNLOAD;

enum fontloc {
  Builtin, Download
};

292 293 294 295 296
typedef struct
{
    INT xx, xy, yx, yy;
} matrix;

297 298 299 300 301 302 303
typedef struct {
    enum fontloc        fontloc;
    union {
        BUILTIN  Builtin;
        DOWNLOAD *Download;
    }                   fontinfo;

304
    matrix              size;
305 306
    PSCOLOR             color;
    BOOL                set;		/* Have we done a setfont yet */
307 308 309 310 311 312 313 314

  /* These are needed by PSDRV_ExtTextOut */
    int                 escapement;
    int                 underlineThickness;
    int                 underlinePosition;
    int                 strikeoutThickness;
    int                 strikeoutPosition;

Alexandre Julliard's avatar
Alexandre Julliard committed
315 316
} PSFONT;

Alexandre Julliard's avatar
Alexandre Julliard committed
317
typedef struct {
318 319 320
    PSCOLOR              color;
    BOOL                 set;
    struct brush_pattern pattern;
Alexandre Julliard's avatar
Alexandre Julliard committed
321 322
} PSBRUSH;

323 324
#define MAX_DASHLEN 16

Alexandre Julliard's avatar
Alexandre Julliard committed
325
typedef struct {
326
    INT                 style;
327 328 329
    INT                 width;
    BYTE                join;
    BYTE                endcap;
330 331
    DWORD               dash[MAX_DASHLEN];
    DWORD               dash_len;
Alexandre Julliard's avatar
Alexandre Julliard committed
332
    PSCOLOR		color;
333
    BOOL		set;
Alexandre Julliard's avatar
Alexandre Julliard committed
334 335
} PSPEN;

Alexandre Julliard's avatar
Alexandre Julliard committed
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 342 343
    BOOL		banding;        /* Have we received a NEXTBAND */
    BOOL		OutOfPage;      /* Page header not sent yet */
    INT			PageNo;
344
    BOOL                quiet;          /* Don't actually output anything */
345 346
    BOOL                in_passthrough; /* In PASSTHROUGH mode */
    BOOL                had_passthrough_rect; /* See the comment in PSDRV_Rectangle */
Alexandre Julliard's avatar
Alexandre Julliard committed
347 348
} JOB;

349 350
typedef struct
{
351
    struct gdi_physdev  dev;
Alexandre Julliard's avatar
Alexandre Julliard committed
352
    PSFONT		font;		/* Current PS font */
353
    DOWNLOAD            *downloaded_fonts;
Alexandre Julliard's avatar
Alexandre Julliard committed
354 355 356 357
    PSPEN		pen;
    PSBRUSH		brush;
    PSCOLOR		bkColor;
    PSCOLOR		inkColor;	/* Last colour set */
Alexandre Julliard's avatar
Alexandre Julliard committed
358
    JOB			job;
359
    PSDRV_DEVMODE	*Devmode;
Alexandre Julliard's avatar
Alexandre Julliard committed
360
    PRINTERINFO		*pi;
361 362 363 364 365 366
    SIZE                PageSize;      /* Physical page size in device units */
    RECT                ImageableArea; /* Imageable area in device units */
                                       /* NB both PageSize and ImageableArea
					  are not rotated in landscape mode,
					  so PageSize.cx is generally
					  < PageSize.cy */
367 368 369 370 371 372
    int                 horzRes;       /* device caps */
    int                 vertRes;
    int                 horzSize;
    int                 vertSize;
    int                 logPixelsX;
    int                 logPixelsY;
373 374

    int                 pathdepth;
Alexandre Julliard's avatar
Alexandre Julliard committed
375 376
} PSDRV_PDEVICE;

377 378 379 380
static inline PSDRV_PDEVICE *get_psdrv_dev( PHYSDEV dev )
{
    return (PSDRV_PDEVICE *)dev;
}
381 382 383 384

/*
 *  Every glyph name in the Adobe Glyph List and the 35 core PostScript fonts
 */
385

386
extern const INT    PSDRV_AGLGlyphNamesSize;
387
extern GLYPHNAME    PSDRV_AGLGlyphNames[] DECLSPEC_HIDDEN;
388 389 390 391 392


/*
 *  The AGL encoding vector
 */
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 401 402
extern HINSTANCE PSDRV_hInstance DECLSPEC_HIDDEN;
extern HANDLE PSDRV_Heap DECLSPEC_HIDDEN;
extern char *PSDRV_ANSIVector[256] DECLSPEC_HIDDEN;
Alexandre Julliard's avatar
Alexandre Julliard committed
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 410 411 412 413 414 415 416 417
extern BOOL PSDRV_Arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
                       INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN;
extern BOOL PSDRV_Chord( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
                         INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN;
extern DWORD PSDRV_DeviceCapabilities(LPSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszPort,
                                      WORD fwCapability, LPSTR lpszOutput, LPDEVMODEA lpDevMode) DECLSPEC_HIDDEN;
extern BOOL PSDRV_Ellipse( PHYSDEV dev, INT left, INT top, INT right, INT bottom) DECLSPEC_HIDDEN;
extern INT PSDRV_EndDoc( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern INT PSDRV_EndPage( PHYSDEV dev ) DECLSPEC_HIDDEN;
418
extern BOOL PSDRV_EnumFonts( PHYSDEV dev, LPLOGFONTW plf, FONTENUMPROCW proc, LPARAM lp ) DECLSPEC_HIDDEN;
419 420 421 422 423 424 425
extern INT PSDRV_ExtDeviceMode(LPSTR lpszDriver, HWND hwnd, LPDEVMODEA lpdmOutput,
                               LPSTR lpszDevice, LPSTR lpszPort, LPDEVMODEA lpdmInput,
                               LPSTR lpszProfile, DWORD dwMode) DECLSPEC_HIDDEN;
extern INT PSDRV_ExtEscape( PHYSDEV dev, INT nEscape, INT cbInput, LPCVOID in_data,
                            INT cbOutput, LPVOID out_data ) DECLSPEC_HIDDEN;
extern BOOL PSDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
                              const RECT *lprect, LPCWSTR str, UINT count, const INT *lpDx ) DECLSPEC_HIDDEN;
426
extern BOOL PSDRV_FillPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
427 428 429 430 431 432 433 434 435
extern BOOL PSDRV_GetCharWidth(PHYSDEV dev, UINT firstChar, UINT lastChar, LPINT buffer) DECLSPEC_HIDDEN;
extern BOOL PSDRV_GetTextExtentExPoint(PHYSDEV dev, LPCWSTR str, INT count,
                                       INT maxExt, LPINT lpnFit, LPINT alpDx, LPSIZE size) DECLSPEC_HIDDEN;
extern BOOL PSDRV_GetTextMetrics(PHYSDEV dev, TEXTMETRICW *metrics) DECLSPEC_HIDDEN;
extern BOOL PSDRV_LineTo(PHYSDEV dev, INT x, INT y) DECLSPEC_HIDDEN;
extern BOOL PSDRV_PaintRgn( PHYSDEV dev, HRGN hrgn ) DECLSPEC_HIDDEN;
extern BOOL PSDRV_PatBlt(PHYSDEV dev, struct bitblt_coords *dst, DWORD dwRop) DECLSPEC_HIDDEN;
extern BOOL PSDRV_Pie( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
                       INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN;
436 437
extern BOOL PSDRV_PolyBezier( PHYSDEV dev, const POINT *pts, DWORD count ) DECLSPEC_HIDDEN;
extern BOOL PSDRV_PolyBezierTo( PHYSDEV dev, const POINT *pts, DWORD count ) DECLSPEC_HIDDEN;
438 439
extern BOOL PSDRV_PolyPolygon( PHYSDEV dev, const POINT* pts, const INT* counts, UINT polygons ) DECLSPEC_HIDDEN;
extern BOOL PSDRV_PolyPolyline( PHYSDEV dev, const POINT* pts, const DWORD* counts, DWORD polylines ) DECLSPEC_HIDDEN;
440
extern DWORD PSDRV_PutImage( PHYSDEV dev, HRGN clip, BITMAPINFO *info,
441 442
                             const struct gdi_image_bits *bits, struct bitblt_coords *src,
                             struct bitblt_coords *dst, DWORD rop ) DECLSPEC_HIDDEN;
443 444 445
extern BOOL PSDRV_Rectangle( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN;
extern BOOL PSDRV_RoundRect( PHYSDEV dev, INT left, INT top, INT right,
                             INT bottom, INT ell_width, INT ell_height ) DECLSPEC_HIDDEN;
446
extern HBRUSH PSDRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush, const struct brush_pattern *pattern ) DECLSPEC_HIDDEN;
447
extern HFONT PSDRV_SelectFont( PHYSDEV dev, HFONT hfont ) DECLSPEC_HIDDEN;
448
extern HPEN PSDRV_SelectPen( PHYSDEV dev, HPEN hpen, const struct brush_pattern *pattern ) DECLSPEC_HIDDEN;
449 450 451 452 453 454
extern COLORREF PSDRV_SetBkColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
extern COLORREF PSDRV_SetDCBrushColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
extern COLORREF PSDRV_SetDCPenColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
extern COLORREF PSDRV_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color ) DECLSPEC_HIDDEN;
extern COLORREF PSDRV_SetTextColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
extern INT PSDRV_StartDoc( PHYSDEV dev, const DOCINFOW *doc ) DECLSPEC_HIDDEN;
455 456
extern BOOL PSDRV_StrokeAndFillPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern BOOL PSDRV_StrokePath( PHYSDEV dev ) DECLSPEC_HIDDEN;
457

458
extern void PSDRV_MergeDevmodes(PSDRV_DEVMODE *dm1, PSDRV_DEVMODE *dm2,
459 460
			 PRINTERINFO *pi) DECLSPEC_HIDDEN;
extern BOOL PSDRV_GetFontMetrics(void) DECLSPEC_HIDDEN;
461
extern PPD *PSDRV_ParsePPD(char *fname, HANDLE printer) DECLSPEC_HIDDEN;
462
extern PRINTERINFO *PSDRV_FindPrinterInfo(LPCWSTR name) DECLSPEC_HIDDEN;
463
extern const AFM *PSDRV_FindAFMinList(FONTFAMILY *head, LPCSTR name) DECLSPEC_HIDDEN;
464
extern BOOL PSDRV_AddAFMtoList(FONTFAMILY **head, const AFM *afm,
465 466
	BOOL *p_added) DECLSPEC_HIDDEN;
extern void PSDRV_FreeAFMList( FONTFAMILY *head ) DECLSPEC_HIDDEN;
Alexandre Julliard's avatar
Alexandre Julliard committed
467

468
extern INT PSDRV_XWStoDS( PHYSDEV dev, INT width ) DECLSPEC_HIDDEN;
469

470 471 472
extern BOOL PSDRV_Brush(PHYSDEV dev, BOOL EO) DECLSPEC_HIDDEN;
extern BOOL PSDRV_SetFont( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern BOOL PSDRV_SetPen( PHYSDEV dev ) DECLSPEC_HIDDEN;
Alexandre Julliard's avatar
Alexandre Julliard committed
473

474
extern void PSDRV_AddClip( PHYSDEV dev, HRGN hrgn ) DECLSPEC_HIDDEN;
475 476
extern void PSDRV_SetClip( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern void PSDRV_ResetClip( PHYSDEV dev ) DECLSPEC_HIDDEN;
477

478
extern BOOL PSDRV_CopyColor(PSCOLOR *col1, PSCOLOR *col2) DECLSPEC_HIDDEN;
479
extern void PSDRV_CreateColor( PHYSDEV dev, PSCOLOR *pscolor,
480 481 482
		     COLORREF wincolor ) DECLSPEC_HIDDEN;
extern char PSDRV_UnicodeToANSI(int u) DECLSPEC_HIDDEN;

483
extern INT PSDRV_WriteHeader( PHYSDEV dev, LPCWSTR title ) DECLSPEC_HIDDEN;
484 485 486 487 488 489 490 491
extern INT PSDRV_WriteFooter( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern INT PSDRV_WriteNewPage( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern INT PSDRV_WriteEndPage( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern BOOL PSDRV_WriteMoveTo(PHYSDEV dev, INT x, INT y) DECLSPEC_HIDDEN;
extern BOOL PSDRV_WriteLineTo(PHYSDEV dev, INT x, INT y) DECLSPEC_HIDDEN;
extern BOOL PSDRV_WriteStroke(PHYSDEV dev) DECLSPEC_HIDDEN;
extern BOOL PSDRV_WriteRectangle(PHYSDEV dev, INT x, INT y, INT width, INT height) DECLSPEC_HIDDEN;
extern BOOL PSDRV_WriteRRectangle(PHYSDEV dev, INT x, INT y, INT width, INT height) DECLSPEC_HIDDEN;
492 493
extern BOOL PSDRV_WriteSetFont(PHYSDEV dev, const char *name, matrix size, INT escapement,
                               BOOL fake_italic) DECLSPEC_HIDDEN;
494 495 496
extern BOOL PSDRV_WriteGlyphShow(PHYSDEV dev, LPCSTR g_name) DECLSPEC_HIDDEN;
extern BOOL PSDRV_WriteSetPen(PHYSDEV dev) DECLSPEC_HIDDEN;
extern BOOL PSDRV_WriteArc(PHYSDEV dev, INT x, INT y, INT w, INT h,
497
			     double ang1, double ang2) DECLSPEC_HIDDEN;
498
extern BOOL PSDRV_WriteCurveTo(PHYSDEV dev, POINT pts[3]) DECLSPEC_HIDDEN;
499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514
extern BOOL PSDRV_WriteSetColor(PHYSDEV dev, PSCOLOR *color) DECLSPEC_HIDDEN;
extern BOOL PSDRV_WriteSetBrush(PHYSDEV dev) DECLSPEC_HIDDEN;
extern BOOL PSDRV_WriteFill(PHYSDEV dev) DECLSPEC_HIDDEN;
extern BOOL PSDRV_WriteEOFill(PHYSDEV dev) DECLSPEC_HIDDEN;
extern BOOL PSDRV_WriteGSave(PHYSDEV dev) DECLSPEC_HIDDEN;
extern BOOL PSDRV_WriteGRestore(PHYSDEV dev) DECLSPEC_HIDDEN;
extern BOOL PSDRV_WriteNewPath(PHYSDEV dev) DECLSPEC_HIDDEN;
extern BOOL PSDRV_WriteClosePath(PHYSDEV dev) DECLSPEC_HIDDEN;
extern BOOL PSDRV_WriteClip(PHYSDEV dev) DECLSPEC_HIDDEN;
extern BOOL PSDRV_WriteRectClip(PHYSDEV dev, INT x, INT y, INT w, INT h) DECLSPEC_HIDDEN;
extern BOOL PSDRV_WriteRectClip2(PHYSDEV dev, CHAR *pszArrayName) DECLSPEC_HIDDEN;
extern BOOL PSDRV_WriteEOClip(PHYSDEV dev) DECLSPEC_HIDDEN;
extern BOOL PSDRV_WriteHatch(PHYSDEV dev) DECLSPEC_HIDDEN;
extern BOOL PSDRV_WriteRotate(PHYSDEV dev, float ang) DECLSPEC_HIDDEN;
extern BOOL PSDRV_WriteIndexColorSpaceBegin(PHYSDEV dev, int size) DECLSPEC_HIDDEN;
extern BOOL PSDRV_WriteIndexColorSpaceEnd(PHYSDEV dev) DECLSPEC_HIDDEN;
515
extern BOOL PSDRV_WriteRGBQUAD(PHYSDEV dev, const RGBQUAD *rgb, int number) DECLSPEC_HIDDEN;
516
extern BOOL PSDRV_WriteImage(PHYSDEV dev, WORD depth, INT xDst, INT yDst,
517
			     INT widthDst, INT heightDst, INT widthSrc,
518
			     INT heightSrc, BOOL mask, BOOL top_down) DECLSPEC_HIDDEN;
519 520 521
extern BOOL PSDRV_WriteBytes(PHYSDEV dev, const BYTE *bytes, DWORD number) DECLSPEC_HIDDEN;
extern BOOL PSDRV_WriteData(PHYSDEV dev, const BYTE *byte, DWORD number) DECLSPEC_HIDDEN;
extern DWORD PSDRV_WriteSpool(PHYSDEV dev, LPCSTR lpData, DWORD cch) DECLSPEC_HIDDEN;
522
extern BOOL PSDRV_WriteDIBPatternDict(PHYSDEV dev, const BITMAPINFO *bmi, BYTE *bits, UINT usage) DECLSPEC_HIDDEN;
523 524
extern BOOL PSDRV_WriteArrayPut(PHYSDEV dev, CHAR *pszArrayName, INT nIndex, LONG lCoord) DECLSPEC_HIDDEN;
extern BOOL PSDRV_WriteArrayDef(PHYSDEV dev, CHAR *pszArrayName, INT nSize) DECLSPEC_HIDDEN;
525

526
extern INT PSDRV_StartPage( PHYSDEV dev ) DECLSPEC_HIDDEN;
527 528 529 530 531 532 533

INT PSDRV_GlyphListInit(void) DECLSPEC_HIDDEN;
const GLYPHNAME *PSDRV_GlyphName(LPCSTR szName) DECLSPEC_HIDDEN;
VOID PSDRV_IndexGlyphList(void) DECLSPEC_HIDDEN;
BOOL PSDRV_GetType1Metrics(void) DECLSPEC_HIDDEN;
const AFMMETRICS *PSDRV_UVMetrics(LONG UV, const AFM *afm) DECLSPEC_HIDDEN;
SHORT PSDRV_CalcAvgCharWidth(const AFM *afm) DECLSPEC_HIDDEN;
534

535
extern BOOL PSDRV_SelectBuiltinFont(PHYSDEV dev, HFONT hfont,
536
				    LOGFONTW *plf, LPSTR FaceName) DECLSPEC_HIDDEN;
537 538
extern BOOL PSDRV_WriteSetBuiltinFont(PHYSDEV dev) DECLSPEC_HIDDEN;
extern BOOL PSDRV_WriteBuiltinGlyphShow(PHYSDEV dev, LPCWSTR str, INT count) DECLSPEC_HIDDEN;
539

540 541 542 543
extern BOOL PSDRV_SelectDownloadFont(PHYSDEV dev) DECLSPEC_HIDDEN;
extern BOOL PSDRV_WriteSetDownloadFont(PHYSDEV dev) DECLSPEC_HIDDEN;
extern BOOL PSDRV_WriteDownloadGlyphShow(PHYSDEV dev, WORD *glpyhs, UINT count) DECLSPEC_HIDDEN;
extern BOOL PSDRV_EmptyDownloadList(PHYSDEV dev, BOOL write_undef) DECLSPEC_HIDDEN;
544

545
extern DWORD write_spool( PHYSDEV dev, const void *data, DWORD num ) DECLSPEC_HIDDEN;
546 547

#define MAX_G_NAME 31 /* max length of PS glyph name */
548
extern void get_glyph_name(HDC hdc, WORD index, char *name) DECLSPEC_HIDDEN;
549

550
extern TYPE1 *T1_download_header(PHYSDEV dev, char *ps_name,
551
                                 RECT *bbox, UINT emsize) DECLSPEC_HIDDEN;
552
extern BOOL T1_download_glyph(PHYSDEV dev, DOWNLOAD *pdl,
553 554
			      DWORD index, char *glyph_name) DECLSPEC_HIDDEN;
extern void T1_free(TYPE1 *t1) DECLSPEC_HIDDEN;
555

556
extern TYPE42 *T42_download_header(PHYSDEV dev, char *ps_name,
557
                                   RECT *bbox, UINT emsize) DECLSPEC_HIDDEN;
558
extern BOOL T42_download_glyph(PHYSDEV dev, DOWNLOAD *pdl,
559 560
			       DWORD index, char *glyph_name) DECLSPEC_HIDDEN;
extern void T42_free(TYPE42 *t42) DECLSPEC_HIDDEN;
561

562 563
extern DWORD RLE_encode(BYTE *in_buf, DWORD len, BYTE *out_buf) DECLSPEC_HIDDEN;
extern DWORD ASCII85_encode(BYTE *in_buf, DWORD len, BYTE *out_buf) DECLSPEC_HIDDEN;
564

565 566 567 568 569 570 571 572
#define push_lc_numeric(x) do {					\
	const char *tmplocale = setlocale(LC_NUMERIC,NULL);	\
	setlocale(LC_NUMERIC,x);

#define pop_lc_numeric()					\
	setlocale(LC_NUMERIC,tmplocale);			\
} while (0)

573 574 575 576 577 578 579 580 581 582 583
static inline WCHAR *strdupW( const WCHAR *str )
{
    int size;
    WCHAR *ret;

    if (!str) return NULL;
    size = (strlenW( str ) + 1) * sizeof(WCHAR);
    ret = HeapAlloc( GetProcessHeap(), 0, size );
    if (ret) memcpy( ret, str, size );
    return ret;
}
584

585
#endif