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
29 #include "wine/wingdi16.h"
39 const GLYPHNAME
*name
;
43 float llx
, lly
, urx
, ury
;
46 typedef struct _tagAFMLIGS
{
49 struct _tagAFMLIGS
*next
;
53 int C
; /* character */
56 const GLYPHNAME
*N
; /* name */
58 const AFMLIGS
*L
; /* Ligatures */
62 INT C
; /* AFM encoding (or -1) */
63 LONG UV
; /* Unicode value */
64 FLOAT WX
; /* Advance width */
65 const GLYPHNAME
*N
; /* Glyph name */
69 USHORT usUnitsPerEm
; /* head:unitsPerEm */
70 SHORT sAscender
; /* hhea:Ascender */
71 SHORT sDescender
; /* hhea:Descender */
72 SHORT sLineGap
; /* hhea:LineGap */
73 SHORT sAvgCharWidth
; /* OS/2:xAvgCharWidth */
74 SHORT sTypoAscender
; /* OS/2:sTypoAscender */
75 SHORT sTypoDescender
; /* OS/2:sTypoDescender */
76 SHORT sTypoLineGap
; /* OS/2:sTypeLineGap */
77 USHORT usWinAscent
; /* OS/2:usWinAscent */
78 USHORT usWinDescent
; /* OS/2:usWinDescent */
81 typedef struct _tagAFM
{
85 LPCSTR EncodingScheme
;
86 LONG Weight
; /* FW_NORMAL etc. */
89 float UnderlinePosition
;
90 float UnderlineThickness
;
94 WINMETRICS WinMetrics
;
96 const AFMMETRICS
*Metrics
;
99 /* Note no 'next' in AFM. Use AFMLISTENTRY as a container. This allow more than
100 one list to exist without having to reallocate the entire AFM structure. We
101 keep a global list of all afms (PSDRV_AFMFontList) plus a list of available
102 fonts for each DC (dc->physDev->Fonts) */
104 typedef struct _tagAFMLISTENTRY
{
106 struct _tagAFMLISTENTRY
*next
;
109 typedef struct _tagFONTFAMILY
{
110 char *FamilyName
; /* family name */
111 AFMLISTENTRY
*afmlist
; /* list of afms for this family */
112 struct _tagFONTFAMILY
*next
; /* next family */
115 extern FONTFAMILY
*PSDRV_AFMFontList
;
116 extern const AFM
*const PSDRV_BuiltinAFMs
[]; /* last element is NULL */
118 typedef struct _tagFONTNAME
{
120 struct _tagFONTNAME
*next
;
124 float llx
, lly
, urx
, ury
;
133 typedef struct _tagPAGESIZE
{
136 char *InvocationString
;
137 IMAGEABLEAREA
*ImageableArea
;
138 PAPERDIMENSION
*PaperDimension
;
139 WORD WinPage
; /*eg DMPAPER_A4. Doesn't really belong here */
140 struct _tagPAGESIZE
*next
;
144 typedef struct _tagOPTIONENTRY
{
145 char *Name
; /* eg "True" */
146 char *FullName
; /* eg "Installed" */
147 char *InvocationString
; /* Often NULL */
148 struct _tagOPTIONENTRY
*next
;
151 typedef struct _tagOPTION
{ /* Treat bool as a special case of pickone */
152 char *OptionName
; /* eg "*Option1" */
153 char *FullName
; /* eg "Envelope Feeder" */
154 char *DefaultOption
; /* eg "False" */
155 OPTIONENTRY
*Options
;
156 struct _tagOPTION
*next
;
159 typedef struct _tagCONSTRAINT
{
164 struct _tagCONSTRAINT
*next
;
167 typedef struct _tagINPUTSLOT
{
170 char *InvocationString
;
171 WORD WinBin
; /* eg DMBIN_LOWER */
172 struct _tagINPUTSLOT
*next
;
175 typedef enum _RASTERIZEROPTION
176 {RO_None
, RO_Accept68K
, RO_Type42
, RO_TrueImage
} RASTERIZEROPTION
;
178 typedef struct _tagDUPLEX
{
181 char *InvocationString
;
182 WORD WinDuplex
; /* eg DMDUP_SIMPLEX */
183 struct _tagDUPLEX
*next
;
190 int DefaultResolution
;
191 signed int LandscapeOrientation
;
193 char *JCLToPSInterpreter
;
196 FONTNAME
*InstalledFonts
; /* ptr to a list of FontNames */
198 PAGESIZE
*DefaultPageSize
;
199 OPTION
*InstalledOptions
;
200 CONSTRAINT
*Constraints
;
201 INPUTSLOT
*InputSlots
;
202 RASTERIZEROPTION TTRasterizer
;
204 DUPLEX
*DefaultDuplex
;
209 struct _tagdocprivate
{
212 struct _tagdrvprivate
{
213 UINT numInstalledOptions
; /* Options at end of struct */
218 numInstalledOptions of OPTIONs
224 typedef struct _tagPI
{
227 PSDRV_DEVMODEA
*Devmode
;
229 PPRINTER_ENUM_VALUESA FontSubTable
;
230 DWORD FontSubTableSize
;
243 /* def's for PSCOLOR.type */
244 #define PSCOLOR_GRAY 0
245 #define PSCOLOR_RGB 1
261 typedef struct tagTYPE42 TYPE42
;
263 typedef struct tagTYPE1 TYPE1
;
269 typedef struct _tagDOWNLOAD
{
270 enum downloadtype type
;
276 struct _tagDOWNLOAD
*next
;
284 enum fontloc fontloc
;
292 BOOL set
; /* Have we done a setfont yet */
294 /* These are needed by PSDRV_ExtTextOut */
296 int underlineThickness
;
297 int underlinePosition
;
298 int strikeoutThickness
;
299 int strikeoutPosition
;
318 LPSTR output
; /* Output file/port */
319 BOOL banding
; /* Have we received a NEXTBAND */
320 BOOL OutOfPage
; /* Page header not sent yet */
322 BOOL quiet
; /* Don't actually output anything */
328 PSFONT font
; /* Current PS font */
329 DOWNLOAD
*downloaded_fonts
;
333 PSCOLOR inkColor
; /* Last colour set */
335 PSDRV_DEVMODEA
*Devmode
;
337 SIZE PageSize
; /* Physical page size in device units */
338 RECT ImageableArea
; /* Imageable area in device units */
339 /* NB both PageSize and ImageableArea
340 are not rotated in landscape mode,
341 so PageSize.cx is generally
343 int horzRes
; /* device caps */
355 PSDRV_DEVMODEA
*dlgdm
;
360 * Every glyph name in the Adobe Glyph List and the 35 core PostScript fonts
363 extern const INT PSDRV_AGLGlyphNamesSize
;
364 extern GLYPHNAME PSDRV_AGLGlyphNames
[];
368 * The AGL encoding vector
371 extern const INT PSDRV_AGLbyNameSize
; /* sorted by name - */
372 extern const UNICODEGLYPH PSDRV_AGLbyName
[]; /* duplicates omitted */
374 extern const INT PSDRV_AGLbyUVSize
; /* sorted by UV - */
375 extern const UNICODEGLYPH PSDRV_AGLbyUV
[]; /* duplicates included */
378 extern INT16 WINAPI
PSDRV_ExtDeviceMode16(HWND16 hwnd
, HANDLE16 hDriver
,
379 LPDEVMODEA lpdmOutput
, LPSTR lpszDevice
, LPSTR lpszPort
,
380 LPDEVMODEA lpdmInput
, LPSTR lpszProfile
, WORD fwMode
);
382 extern HANDLE PSDRV_Heap
;
383 extern char *PSDRV_ANSIVector
[256];
385 extern void PSDRV_MergeDevmodes(PSDRV_DEVMODEA
*dm1
, PSDRV_DEVMODEA
*dm2
,
387 extern BOOL
PSDRV_GetFontMetrics(void);
388 extern PPD
*PSDRV_ParsePPD(char *fname
);
389 extern PRINTERINFO
*PSDRV_FindPrinterInfo(LPCSTR name
);
390 extern const AFM
*PSDRV_FindAFMinList(FONTFAMILY
*head
, LPCSTR name
);
391 extern BOOL
PSDRV_AddAFMtoList(FONTFAMILY
**head
, const AFM
*afm
,
393 extern void PSDRV_FreeAFMList( FONTFAMILY
*head
);
395 extern BOOL WINAPI
PSDRV_Init(HINSTANCE hinst
, DWORD reason
, LPVOID reserved
);
397 extern BOOL
PSDRV_Brush(PSDRV_PDEVICE
*physDev
, BOOL EO
);
398 extern BOOL
PSDRV_SetFont( PSDRV_PDEVICE
*physDev
);
399 extern BOOL
PSDRV_SetPen( PSDRV_PDEVICE
*physDev
);
401 extern void PSDRV_SetClip(PSDRV_PDEVICE
* phyDev
);
402 extern void PSDRV_ResetClip(PSDRV_PDEVICE
* phyDev
);
404 extern BOOL
PSDRV_CmpColor(PSCOLOR
*col1
, PSCOLOR
*col2
);
405 extern BOOL
PSDRV_CopyColor(PSCOLOR
*col1
, PSCOLOR
*col2
);
406 extern void PSDRV_CreateColor( PSDRV_PDEVICE
*physDev
, PSCOLOR
*pscolor
,
408 extern char PSDRV_UnicodeToANSI(int u
);
410 extern INT
PSDRV_WriteHeader( PSDRV_PDEVICE
*physDev
, LPCSTR title
);
411 extern INT
PSDRV_WriteFooter( PSDRV_PDEVICE
*physDev
);
412 extern INT
PSDRV_WriteNewPage( PSDRV_PDEVICE
*physDev
);
413 extern INT
PSDRV_WriteEndPage( PSDRV_PDEVICE
*physDev
);
414 extern BOOL
PSDRV_WriteMoveTo(PSDRV_PDEVICE
*physDev
, INT x
, INT y
);
415 extern BOOL
PSDRV_WriteLineTo(PSDRV_PDEVICE
*physDev
, INT x
, INT y
);
416 extern BOOL
PSDRV_WriteStroke(PSDRV_PDEVICE
*physDev
);
417 extern BOOL
PSDRV_WriteRectangle(PSDRV_PDEVICE
*physDev
, INT x
, INT y
, INT width
,
419 extern BOOL
PSDRV_WriteRRectangle(PSDRV_PDEVICE
*physDev
, INT x
, INT y
, INT width
,
421 extern BOOL
PSDRV_WriteSetFont(PSDRV_PDEVICE
*physDev
, const char *name
, INT size
,
423 extern BOOL
PSDRV_WriteGlyphShow(PSDRV_PDEVICE
*physDev
, LPCSTR g_name
);
424 extern BOOL
PSDRV_WriteSetPen(PSDRV_PDEVICE
*physDev
);
425 extern BOOL
PSDRV_WriteArc(PSDRV_PDEVICE
*physDev
, INT x
, INT y
, INT w
, INT h
,
426 double ang1
, double ang2
);
427 extern BOOL
PSDRV_WriteSetColor(PSDRV_PDEVICE
*physDev
, PSCOLOR
*color
);
428 extern BOOL
PSDRV_WriteSetBrush(PSDRV_PDEVICE
*physDev
);
429 extern BOOL
PSDRV_WriteFill(PSDRV_PDEVICE
*physDev
);
430 extern BOOL
PSDRV_WriteEOFill(PSDRV_PDEVICE
*physDev
);
431 extern BOOL
PSDRV_WriteGSave(PSDRV_PDEVICE
*physDev
);
432 extern BOOL
PSDRV_WriteGRestore(PSDRV_PDEVICE
*physDev
);
433 extern BOOL
PSDRV_WriteNewPath(PSDRV_PDEVICE
*physDev
);
434 extern BOOL
PSDRV_WriteClosePath(PSDRV_PDEVICE
*physDev
);
435 extern BOOL
PSDRV_WriteInitClip(PSDRV_PDEVICE
*physDev
);
436 extern BOOL
PSDRV_WriteClip(PSDRV_PDEVICE
*physDev
);
437 extern BOOL
PSDRV_WriteRectClip(PSDRV_PDEVICE
*physDev
, INT x
, INT y
, INT w
, INT h
);
438 extern BOOL
PSDRV_WriteRectClip2(PSDRV_PDEVICE
*physDev
, CHAR
*pszArrayName
);
439 extern BOOL
PSDRV_WriteEOClip(PSDRV_PDEVICE
*physDev
);
440 extern BOOL
PSDRV_WriteHatch(PSDRV_PDEVICE
*physDev
);
441 extern BOOL
PSDRV_WriteRotate(PSDRV_PDEVICE
*physDev
, float ang
);
442 extern BOOL
PSDRV_WriteIndexColorSpaceBegin(PSDRV_PDEVICE
*physDev
, int size
);
443 extern BOOL
PSDRV_WriteIndexColorSpaceEnd(PSDRV_PDEVICE
*physDev
);
444 extern BOOL
PSDRV_WriteRGB(PSDRV_PDEVICE
*physDev
, COLORREF
*map
, int number
);
445 extern BOOL
PSDRV_WriteImageDict(PSDRV_PDEVICE
*physDev
, WORD depth
, INT xDst
, INT yDst
,
446 INT widthDst
, INT heightDst
, INT widthSrc
,
447 INT heightSrc
, char *bits
, BOOL mask
);
448 extern BOOL
PSDRV_WriteBytes(PSDRV_PDEVICE
*physDev
, const BYTE
*bytes
, int number
);
449 extern BOOL
PSDRV_WriteDIBits16(PSDRV_PDEVICE
*physDev
, const WORD
*words
, int number
);
450 extern BOOL
PSDRV_WriteDIBits24(PSDRV_PDEVICE
*physDev
, const BYTE
*bits
, int number
);
451 extern BOOL
PSDRV_WriteDIBits32(PSDRV_PDEVICE
*physDev
, const BYTE
*bits
, int number
);
452 extern int PSDRV_WriteSpool(PSDRV_PDEVICE
*physDev
, LPSTR lpData
, WORD cch
);
453 extern BOOL
PSDRV_WritePatternDict(PSDRV_PDEVICE
*physDev
, BITMAP
*bm
, BYTE
*bits
);
454 extern BOOL
PSDRV_WriteDIBPatternDict(PSDRV_PDEVICE
*physDev
, BITMAPINFO
*bmi
, UINT usage
);
455 extern BOOL
PSDRV_WriteArrayPut(PSDRV_PDEVICE
*physDev
, CHAR
*pszArrayName
, INT nIndex
, LONG lCoord
);
456 extern BOOL
PSDRV_WriteArrayDef(PSDRV_PDEVICE
*physDev
, CHAR
*pszArrayName
, INT nSize
);
458 extern BOOL
PSDRV_Arc( PSDRV_PDEVICE
*physDev
, INT left
, INT top
, INT right
,
459 INT bottom
, INT xstart
, INT ystart
,
460 INT xend
, INT yend
);
461 extern BOOL
PSDRV_Chord( PSDRV_PDEVICE
*physDev
, INT left
, INT top
, INT right
,
462 INT bottom
, INT xstart
, INT ystart
,
463 INT xend
, INT yend
);
464 extern BOOL
PSDRV_Ellipse( PSDRV_PDEVICE
*physDev
, INT left
, INT top
, INT right
,
466 extern INT
PSDRV_EndDoc( PSDRV_PDEVICE
*physDev
);
467 extern INT
PSDRV_EndPage( PSDRV_PDEVICE
*physDev
);
468 extern BOOL
PSDRV_ExtTextOut( PSDRV_PDEVICE
*physDev
, INT x
, INT y
, UINT flags
,
469 const RECT
*lprect
, LPCWSTR str
, UINT count
,
471 extern BOOL
PSDRV_GetCharWidth( PSDRV_PDEVICE
*physDev
, UINT firstChar
, UINT lastChar
,
473 extern BOOL
PSDRV_GetTextExtentPoint( PSDRV_PDEVICE
*physDev
, LPCWSTR str
, INT count
,
475 extern BOOL
PSDRV_GetTextMetrics( PSDRV_PDEVICE
*physDev
, TEXTMETRICW
*metrics
);
476 extern BOOL
PSDRV_LineTo( PSDRV_PDEVICE
*physDev
, INT x
, INT y
);
477 extern BOOL
PSDRV_PatBlt( PSDRV_PDEVICE
*physDev
, INT x
, INT y
, INT width
, INT height
, DWORD
479 extern BOOL
PSDRV_Pie( PSDRV_PDEVICE
*physDev
, INT left
, INT top
, INT right
,
480 INT bottom
, INT xstart
, INT ystart
,
481 INT xend
, INT yend
);
482 extern BOOL
PSDRV_Polygon( PSDRV_PDEVICE
*physDev
, const POINT
* pt
, INT count
);
483 extern BOOL
PSDRV_Polyline( PSDRV_PDEVICE
*physDev
, const POINT
* pt
, INT count
);
484 extern BOOL
PSDRV_PolyPolygon( PSDRV_PDEVICE
*physDev
, const POINT
* pts
, const INT
* counts
,
486 extern BOOL
PSDRV_PolyPolyline( PSDRV_PDEVICE
*physDev
, const POINT
* pts
, const DWORD
* counts
,
488 extern BOOL
PSDRV_Rectangle( PSDRV_PDEVICE
*physDev
, INT left
, INT top
, INT right
,
490 extern BOOL
PSDRV_RoundRect(PSDRV_PDEVICE
*physDev
, INT left
, INT top
, INT right
,
491 INT bottom
, INT ell_width
, INT ell_height
);
492 extern COLORREF
PSDRV_SetBkColor( PSDRV_PDEVICE
*physDev
, COLORREF color
);
493 extern COLORREF
PSDRV_SetPixel( PSDRV_PDEVICE
*physDev
, INT x
, INT y
, COLORREF color
);
494 extern COLORREF
PSDRV_SetTextColor( PSDRV_PDEVICE
*physDev
, COLORREF color
);
495 extern INT
PSDRV_StartDoc( PSDRV_PDEVICE
*physDev
, const DOCINFOA
*doc
);
496 extern INT
PSDRV_StartPage( PSDRV_PDEVICE
*physDev
);
497 extern INT
PSDRV_StretchDIBits( PSDRV_PDEVICE
*physDev
, INT xDst
, INT yDst
,
498 INT widthDst
, INT heightDst
, INT xSrc
,
499 INT ySrc
, INT widthSrc
, INT heightSrc
,
500 const void *bits
, const BITMAPINFO
*info
,
501 UINT wUsage
, DWORD dwRop
);
503 extern INT
PSDRV_ExtDeviceMode(LPSTR lpszDriver
, HWND hwnd
,
504 LPDEVMODEA lpdmOutput
,
505 LPSTR lpszDevice
, LPSTR lpszPort
,
506 LPDEVMODEA lpdmInput
, LPSTR lpszProfile
,
508 extern DWORD
PSDRV_DeviceCapabilities(LPSTR lpszDriver
, LPCSTR lpszDevice
,
510 WORD fwCapability
, LPSTR lpszOutput
,
512 INT
PSDRV_GlyphListInit(void);
513 const GLYPHNAME
*PSDRV_GlyphName(LPCSTR szName
);
514 VOID
PSDRV_IndexGlyphList(void);
515 BOOL
PSDRV_GetTrueTypeMetrics(void);
516 BOOL
PSDRV_GetType1Metrics(void);
517 const AFMMETRICS
*PSDRV_UVMetrics(LONG UV
, const AFM
*afm
);
518 SHORT
PSDRV_CalcAvgCharWidth(const AFM
*afm
);
520 extern BOOL
PSDRV_SelectBuiltinFont(PSDRV_PDEVICE
*physDev
, HFONT hfont
,
521 LOGFONTW
*plf
, LPSTR FaceName
);
522 extern BOOL
PSDRV_WriteSetBuiltinFont(PSDRV_PDEVICE
*physDev
);
523 extern BOOL
PSDRV_WriteBuiltinGlyphShow(PSDRV_PDEVICE
*physDev
, LPCWSTR str
, INT count
);
525 extern BOOL
PSDRV_SelectDownloadFont(PSDRV_PDEVICE
*physDev
);
526 extern BOOL
PSDRV_WriteSetDownloadFont(PSDRV_PDEVICE
*physDev
);
527 extern BOOL
PSDRV_WriteDownloadGlyphShow(PSDRV_PDEVICE
*physDev
, WORD
*glpyhs
,
529 extern BOOL
PSDRV_EmptyDownloadList(PSDRV_PDEVICE
*physDev
, BOOL write_undef
);
531 #define MAX_G_NAME 31 /* max length of PS glyph name */
532 extern void get_glyph_name(HDC hdc
, WORD index
, char *name
);
534 extern TYPE1
*T1_download_header(PSDRV_PDEVICE
*physDev
,
535 LPOUTLINETEXTMETRICA potm
,
537 extern BOOL
T1_download_glyph(PSDRV_PDEVICE
*physDev
, DOWNLOAD
*pdl
,
538 DWORD index
, char *glyph_name
);
539 extern void T1_free(TYPE1
*t1
);
541 extern TYPE42
*T42_download_header(PSDRV_PDEVICE
*physDev
,
542 LPOUTLINETEXTMETRICA ptom
,
544 extern BOOL
T42_download_glyph(PSDRV_PDEVICE
*physDev
, DOWNLOAD
*pdl
,
545 DWORD index
, char *glyph_name
);
546 extern void T42_free(TYPE42
*t42
);