5 * PostScript driver definitions
7 * Copyright 1998 Huw D M Davies
12 #include "wine/wingdi16.h"
22 const GLYPHNAME
*name
;
26 float llx
, lly
, urx
, ury
;
29 typedef struct _tagAFMLIGS
{
32 struct _tagAFMLIGS
*next
;
36 int C
; /* character */
39 const GLYPHNAME
*N
; /* name */
41 const AFMLIGS
*L
; /* Ligatures */
45 INT C
; /* AFM encoding (or -1) */
46 LONG UV
; /* Unicode value */
47 FLOAT WX
; /* Advance width */
48 const GLYPHNAME
*N
; /* Glyph name */
52 USHORT usUnitsPerEm
; /* head:unitsPerEm */
53 SHORT sAscender
; /* hhea:Ascender */
54 SHORT sDescender
; /* hhea:Descender */
55 SHORT sLineGap
; /* hhea:LineGap */
56 SHORT sAvgCharWidth
; /* OS/2:xAvgCharWidth */
57 SHORT sTypoAscender
; /* OS/2:sTypoAscender */
58 SHORT sTypoDescender
; /* OS/2:sTypoDescender */
59 SHORT sTypoLineGap
; /* OS/2:sTypeLineGap */
60 USHORT usWinAscent
; /* OS/2:usWinAscent */
61 USHORT usWinDescent
; /* OS/2:usWinDescent */
64 typedef struct _tagAFM
{
68 LPCSTR EncodingScheme
;
69 LONG Weight
; /* FW_NORMAL etc. */
72 float UnderlinePosition
;
73 float UnderlineThickness
;
77 WINMETRICS WinMetrics
;
79 const AFMMETRICS
*Metrics
;
82 /* Note no 'next' in AFM. Use AFMLISTENTRY as a container. This allow more than
83 one list to exist without having to reallocate the entire AFM structure. We
84 keep a global list of all afms (PSDRV_AFMFontList) plus a list of available
85 fonts for each DC (dc->physDev->Fonts) */
87 typedef struct _tagAFMLISTENTRY
{
89 struct _tagAFMLISTENTRY
*next
;
92 typedef struct _tagFONTFAMILY
{
93 char *FamilyName
; /* family name */
94 AFMLISTENTRY
*afmlist
; /* list of afms for this family */
95 struct _tagFONTFAMILY
*next
; /* next family */
98 extern FONTFAMILY
*PSDRV_AFMFontList
;
99 extern const AFM
*const PSDRV_BuiltinAFMs
[]; /* last element is NULL */
101 typedef struct _tagFONTNAME
{
103 struct _tagFONTNAME
*next
;
107 float llx
, lly
, urx
, ury
;
116 typedef struct _tagPAGESIZE
{
119 char *InvocationString
;
120 IMAGEABLEAREA
*ImageableArea
;
121 PAPERDIMENSION
*PaperDimension
;
122 WORD WinPage
; /*eg DMPAPER_A4. Doesn't really belong here */
123 struct _tagPAGESIZE
*next
;
127 typedef struct _tagOPTIONENTRY
{
128 char *Name
; /* eg "True" */
129 char *FullName
; /* eg "Installed" */
130 char *InvocationString
; /* Often NULL */
131 struct _tagOPTIONENTRY
*next
;
134 typedef struct _tagOPTION
{ /* Treat bool as a special case of pickone */
135 char *OptionName
; /* eg "*Option1" */
136 char *FullName
; /* eg "Envelope Feeder" */
137 char *DefaultOption
; /* eg "False" */
138 OPTIONENTRY
*Options
;
139 struct _tagOPTION
*next
;
142 typedef struct _tagCONSTRAINT
{
147 struct _tagCONSTRAINT
*next
;
150 typedef struct _tagINPUTSLOT
{
153 char *InvocationString
;
154 WORD WinBin
; /* eg DMBIN_LOWER */
155 struct _tagINPUTSLOT
*next
;
162 int DefaultResolution
;
163 signed int LandscapeOrientation
;
165 char *JCLToPSInterpreter
;
168 FONTNAME
*InstalledFonts
; /* ptr to a list of FontNames */
170 OPTION
*InstalledOptions
;
171 CONSTRAINT
*Constraints
;
172 INPUTSLOT
*InputSlots
;
177 struct _tagdocprivate
{
180 struct _tagdrvprivate
{
181 UINT numInstalledOptions
; /* Options at end of struct */
186 numInstalledOptions of OPTIONs
192 typedef struct _tagPI
{
195 PSDRV_DEVMODEA
*Devmode
;
197 PPRINTER_ENUM_VALUESA FontSubTable
;
198 DWORD FontSubTableSize
;
211 /* def's for PSCOLOR.type */
212 #define PSCOLOR_GRAY 0
213 #define PSCOLOR_RGB 1
230 BOOL set
; /* Have we done a setfont yet */
248 LPSTR output
; /* Output file/port */
249 BOOL banding
; /* Have we received a NEXTBAND */
250 BOOL OutOfPage
; /* Page header not sent yet */
255 PSFONT font
; /* Current PS font */
259 PSCOLOR inkColor
; /* Last colour set */
261 PSDRV_DEVMODEA
*Devmode
;
263 RECT PageSize
; /* Imageable area in device co-ords */
264 int horzRes
; /* device caps */
274 PSDRV_DEVMODEA
*dlgdm
;
279 * Every glyph name in the Adobe Glyph List and the 35 core PostScript fonts
282 extern const INT PSDRV_AGLGlyphNamesSize
;
283 extern GLYPHNAME PSDRV_AGLGlyphNames
[];
287 * The AGL encoding vector
290 extern const INT PSDRV_AGLbyNameSize
; /* sorted by name - */
291 extern const UNICODEGLYPH PSDRV_AGLbyName
[]; /* duplicates omitted */
293 extern const INT PSDRV_AGLbyUVSize
; /* sorted by UV - */
294 extern const UNICODEGLYPH PSDRV_AGLbyUV
[]; /* duplicates included */
297 extern INT16 WINAPI
PSDRV_ExtDeviceMode16(HWND16 hwnd
, HANDLE16 hDriver
,
298 LPDEVMODEA lpdmOutput
, LPSTR lpszDevice
, LPSTR lpszPort
,
299 LPDEVMODEA lpdmInput
, LPSTR lpszProfile
, WORD fwMode
);
301 extern HANDLE PSDRV_Heap
;
302 extern char *PSDRV_ANSIVector
[256];
304 extern void PSDRV_MergeDevmodes(PSDRV_DEVMODEA
*dm1
, PSDRV_DEVMODEA
*dm2
,
306 extern BOOL
PSDRV_GetFontMetrics(void);
307 extern PPD
*PSDRV_ParsePPD(char *fname
);
308 extern PRINTERINFO
*PSDRV_FindPrinterInfo(LPCSTR name
);
309 extern const AFM
*PSDRV_FindAFMinList(FONTFAMILY
*head
, LPCSTR name
);
310 extern BOOL
PSDRV_AddAFMtoList(FONTFAMILY
**head
, const AFM
*afm
,
312 extern void PSDRV_FreeAFMList( FONTFAMILY
*head
);
314 extern BOOL WINAPI
PSDRV_Init(HINSTANCE hinst
, DWORD reason
, LPVOID reserved
);
315 extern HFONT
PSDRV_FONT_SelectObject( DC
*dc
, HFONT hfont
);
316 extern HPEN
PSDRV_PEN_SelectObject( DC
* dc
, HPEN hpen
);
317 extern HBRUSH
PSDRV_BRUSH_SelectObject( DC
* dc
, HBRUSH hbrush
);
319 extern BOOL
PSDRV_Brush(DC
*dc
, BOOL EO
);
320 extern BOOL
PSDRV_SetFont( DC
*dc
);
321 extern BOOL
PSDRV_SetPen( DC
*dc
);
323 extern BOOL
PSDRV_CmpColor(PSCOLOR
*col1
, PSCOLOR
*col2
);
324 extern BOOL
PSDRV_CopyColor(PSCOLOR
*col1
, PSCOLOR
*col2
);
325 extern void PSDRV_CreateColor( PSDRV_PDEVICE
*physDev
, PSCOLOR
*pscolor
,
327 extern char PSDRV_UnicodeToANSI(int u
);
329 extern INT
PSDRV_WriteHeader( DC
*dc
, LPCSTR title
);
330 extern INT
PSDRV_WriteFooter( DC
*dc
);
331 extern INT
PSDRV_WriteNewPage( DC
*dc
);
332 extern INT
PSDRV_WriteEndPage( DC
*dc
);
333 extern BOOL
PSDRV_WriteMoveTo(DC
*dc
, INT x
, INT y
);
334 extern BOOL
PSDRV_WriteLineTo(DC
*dc
, INT x
, INT y
);
335 extern BOOL
PSDRV_WriteStroke(DC
*dc
);
336 extern BOOL
PSDRV_WriteRectangle(DC
*dc
, INT x
, INT y
, INT width
,
338 extern BOOL
PSDRV_WriteRRectangle(DC
*dc
, INT x
, INT y
, INT width
,
340 extern BOOL
PSDRV_WriteSetFont(DC
*dc
);
341 extern BOOL
PSDRV_WriteGlyphShow(DC
*dc
, LPCWSTR str
, INT count
);
342 extern BOOL
PSDRV_WriteSetPen(DC
*dc
);
343 extern BOOL
PSDRV_WriteArc(DC
*dc
, INT x
, INT y
, INT w
, INT h
,
344 double ang1
, double ang2
);
345 extern BOOL
PSDRV_WriteSetColor(DC
*dc
, PSCOLOR
*color
);
346 extern BOOL
PSDRV_WriteSetBrush(DC
*dc
);
347 extern BOOL
PSDRV_WriteFill(DC
*dc
);
348 extern BOOL
PSDRV_WriteEOFill(DC
*dc
);
349 extern BOOL
PSDRV_WriteGSave(DC
*dc
);
350 extern BOOL
PSDRV_WriteGRestore(DC
*dc
);
351 extern BOOL
PSDRV_WriteNewPath(DC
*dc
);
352 extern BOOL
PSDRV_WriteClosePath(DC
*dc
);
353 extern BOOL
PSDRV_WriteInitClip(DC
*dc
);
354 extern BOOL
PSDRV_WriteClip(DC
*dc
);
355 extern BOOL
PSDRV_WriteRectClip(DC
*dc
, INT x
, INT y
, INT w
, INT h
);
356 extern BOOL
PSDRV_WriteRectClip2(DC
*dc
, CHAR
*pszArrayName
);
357 extern BOOL
PSDRV_WriteEOClip(DC
*dc
);
358 extern BOOL
PSDRV_WriteHatch(DC
*dc
);
359 extern BOOL
PSDRV_WriteRotate(DC
*dc
, float ang
);
360 extern BOOL
PSDRV_WriteIndexColorSpaceBegin(DC
*dc
, int size
);
361 extern BOOL
PSDRV_WriteIndexColorSpaceEnd(DC
*dc
);
362 extern BOOL
PSDRV_WriteRGB(DC
*dc
, COLORREF
*map
, int number
);
363 extern BOOL
PSDRV_WriteImageDict(DC
*dc
, WORD depth
, INT xDst
, INT yDst
,
364 INT widthDst
, INT heightDst
, INT widthSrc
,
365 INT heightSrc
, char *bits
);
366 extern BOOL
PSDRV_WriteBytes(DC
*dc
, const BYTE
*bytes
, int number
);
367 extern BOOL
PSDRV_WriteDIBits16(DC
*dc
, const WORD
*words
, int number
);
368 extern BOOL
PSDRV_WriteDIBits24(DC
*dc
, const BYTE
*bits
, int number
);
369 extern BOOL
PSDRV_WriteDIBits32(DC
*dc
, const BYTE
*bits
, int number
);
370 extern int PSDRV_WriteSpool(DC
*dc
, LPSTR lpData
, WORD cch
);
371 extern BOOL
PSDRV_WritePatternDict(DC
*dc
, BITMAP
*bm
, BYTE
*bits
);
372 extern BOOL
PSDRV_WriteArrayPut(DC
*dc
, CHAR
*pszArrayName
, INT nIndex
, LONG lCoord
);
373 extern BOOL
PSDRV_WriteArrayDef(DC
*dc
, CHAR
*pszArrayName
, INT nSize
);
375 extern BOOL
PSDRV_Arc( DC
*dc
, INT left
, INT top
, INT right
,
376 INT bottom
, INT xstart
, INT ystart
,
377 INT xend
, INT yend
);
378 extern BOOL
PSDRV_Chord( DC
*dc
, INT left
, INT top
, INT right
,
379 INT bottom
, INT xstart
, INT ystart
,
380 INT xend
, INT yend
);
381 extern BOOL
PSDRV_Ellipse( DC
*dc
, INT left
, INT top
, INT right
,
383 extern INT
PSDRV_EndDoc( DC
*dc
);
384 extern INT
PSDRV_EndPage( DC
*dc
);
385 extern BOOL
PSDRV_EnumDeviceFonts( HDC hdc
, LPLOGFONTW plf
,
386 DEVICEFONTENUMPROC proc
, LPARAM lp
);
387 extern INT
PSDRV_Escape( DC
*dc
, INT nEscape
, INT cbInput
,
388 SEGPTR lpInData
, SEGPTR lpOutData
);
389 extern BOOL
PSDRV_ExtTextOut( DC
*dc
, INT x
, INT y
, UINT flags
,
390 const RECT
*lprect
, LPCWSTR str
, UINT count
,
392 extern BOOL
PSDRV_GetCharWidth( DC
*dc
, UINT firstChar
, UINT lastChar
,
394 extern BOOL
PSDRV_GetTextExtentPoint( DC
*dc
, LPCWSTR str
, INT count
,
396 extern BOOL
PSDRV_GetTextMetrics( DC
*dc
, TEXTMETRICW
*metrics
);
397 extern BOOL
PSDRV_LineTo( DC
*dc
, INT x
, INT y
);
398 extern BOOL
PSDRV_PatBlt( DC
*dc
, INT x
, INT y
, INT width
, INT height
, DWORD
400 extern BOOL
PSDRV_Pie( DC
*dc
, INT left
, INT top
, INT right
,
401 INT bottom
, INT xstart
, INT ystart
,
402 INT xend
, INT yend
);
403 extern BOOL
PSDRV_Polygon( DC
*dc
, const POINT
* pt
, INT count
);
404 extern BOOL
PSDRV_Polyline( DC
*dc
, const POINT
* pt
, INT count
);
405 extern BOOL
PSDRV_PolyPolygon( DC
*dc
, const POINT
* pts
, const INT
* counts
,
407 extern BOOL
PSDRV_PolyPolyline( DC
*dc
, const POINT
* pts
, const DWORD
* counts
,
409 extern BOOL
PSDRV_Rectangle( DC
*dc
, INT left
, INT top
, INT right
,
411 extern BOOL
PSDRV_RoundRect(DC
*dc
, INT left
, INT top
, INT right
,
412 INT bottom
, INT ell_width
, INT ell_height
);
413 extern HGDIOBJ
PSDRV_SelectObject( DC
*dc
, HGDIOBJ handle
);
414 extern COLORREF
PSDRV_SetBkColor( DC
*dc
, COLORREF color
);
415 extern VOID
PSDRV_SetDeviceClipping( DC
*dc
);
416 extern COLORREF
PSDRV_SetPixel( DC
*dc
, INT x
, INT y
, COLORREF color
);
417 extern COLORREF
PSDRV_SetTextColor( DC
*dc
, COLORREF color
);
418 extern INT
PSDRV_StartDoc( DC
*dc
, const DOCINFOA
*doc
);
419 extern INT
PSDRV_StartPage( DC
*dc
);
420 extern INT
PSDRV_StretchDIBits( DC
*dc
, INT xDst
, INT yDst
,
421 INT widthDst
, INT heightDst
, INT xSrc
,
422 INT ySrc
, INT widthSrc
, INT heightSrc
,
423 const void *bits
, const BITMAPINFO
*info
,
424 UINT wUsage
, DWORD dwRop
);
426 extern INT
PSDRV_ExtDeviceMode(LPSTR lpszDriver
, HWND hwnd
,
427 LPDEVMODEA lpdmOutput
,
428 LPSTR lpszDevice
, LPSTR lpszPort
,
429 LPDEVMODEA lpdmInput
, LPSTR lpszProfile
,
431 extern DWORD
PSDRV_DeviceCapabilities(LPSTR lpszDriver
, LPCSTR lpszDevice
,
433 WORD fwCapability
, LPSTR lpszOutput
,
435 VOID
PSDRV_DrawLine( DC
*dc
);
436 INT
PSDRV_GlyphListInit(void);
437 const GLYPHNAME
*PSDRV_GlyphName(LPCSTR szName
);
438 VOID
PSDRV_IndexGlyphList(void);
439 BOOL
PSDRV_GetTrueTypeMetrics(void);
440 BOOL
PSDRV_GetType1Metrics(void);
441 const AFMMETRICS
*PSDRV_UVMetrics(LONG UV
, const AFM
*afm
);
442 SHORT
PSDRV_CalcAvgCharWidth(const AFM
*afm
);