Handle dmScale.
[wine/multimedia.git] / dlls / wineps / psdrv.h
blobefa4fe923a018c47d4ab54d5860b54bc2ab1595e
1 /*
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
24 #include "windef.h"
25 #include "wingdi.h"
26 #include "wine/wingdi16.h"
27 #include "winspool.h"
29 typedef struct {
30 INT index;
31 LPCSTR sz;
32 } GLYPHNAME;
34 typedef struct {
35 LONG UV;
36 const GLYPHNAME *name;
37 } UNICODEGLYPH;
39 typedef struct {
40 float llx, lly, urx, ury;
41 } AFMBBOX;
43 typedef struct _tagAFMLIGS {
44 char *successor;
45 char *ligature;
46 struct _tagAFMLIGS *next;
47 } AFMLIGS;
49 typedef struct {
50 int C; /* character */
51 LONG UV;
52 float WX;
53 const GLYPHNAME *N; /* name */
54 AFMBBOX B;
55 const AFMLIGS *L; /* Ligatures */
56 } OLD_AFMMETRICS;
58 typedef struct {
59 INT C; /* AFM encoding (or -1) */
60 LONG UV; /* Unicode value */
61 FLOAT WX; /* Advance width */
62 const GLYPHNAME *N; /* Glyph name */
63 } AFMMETRICS;
65 typedef struct {
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 */
76 } WINMETRICS;
78 typedef struct _tagAFM {
79 LPCSTR FontName;
80 LPCSTR FullName;
81 LPCSTR FamilyName;
82 LPCSTR EncodingScheme;
83 LONG Weight; /* FW_NORMAL etc. */
84 float ItalicAngle;
85 BOOL IsFixedPitch;
86 float UnderlinePosition;
87 float UnderlineThickness;
88 AFMBBOX FontBBox;
89 float Ascender;
90 float Descender;
91 WINMETRICS WinMetrics;
92 int NumofMetrics;
93 const AFMMETRICS *Metrics;
94 } AFM;
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 {
102 const AFM *afm;
103 struct _tagAFMLISTENTRY *next;
104 } AFMLISTENTRY;
106 typedef struct _tagFONTFAMILY {
107 char *FamilyName; /* family name */
108 AFMLISTENTRY *afmlist; /* list of afms for this family */
109 struct _tagFONTFAMILY *next; /* next family */
110 } FONTFAMILY;
112 extern FONTFAMILY *PSDRV_AFMFontList;
113 extern const AFM *const PSDRV_BuiltinAFMs[]; /* last element is NULL */
115 typedef struct _tagFONTNAME {
116 char *Name;
117 struct _tagFONTNAME *next;
118 } FONTNAME;
120 typedef struct {
121 float llx, lly, urx, ury;
122 } IMAGEABLEAREA;
124 typedef struct {
125 float x, y;
126 } PAPERDIMENSION;
128 /* Solaris kludge */
129 #undef PAGESIZE
130 typedef struct _tagPAGESIZE {
131 char *Name;
132 char *FullName;
133 char *InvocationString;
134 IMAGEABLEAREA *ImageableArea;
135 PAPERDIMENSION *PaperDimension;
136 WORD WinPage; /*eg DMPAPER_A4. Doesn't really belong here */
137 struct _tagPAGESIZE *next;
138 } PAGESIZE;
141 typedef struct _tagOPTIONENTRY {
142 char *Name; /* eg "True" */
143 char *FullName; /* eg "Installed" */
144 char *InvocationString; /* Often NULL */
145 struct _tagOPTIONENTRY *next;
146 } OPTIONENTRY;
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;
154 } OPTION;
156 typedef struct _tagCONSTRAINT {
157 char *Feature1;
158 char *Value1;
159 char *Feature2;
160 char *Value2;
161 struct _tagCONSTRAINT *next;
162 } CONSTRAINT;
164 typedef struct _tagINPUTSLOT {
165 char *Name;
166 char *FullName;
167 char *InvocationString;
168 WORD WinBin; /* eg DMBIN_LOWER */
169 struct _tagINPUTSLOT *next;
170 } INPUTSLOT;
172 typedef struct {
173 char *NickName;
174 int LanguageLevel;
175 BOOL ColorDevice;
176 int DefaultResolution;
177 signed int LandscapeOrientation;
178 char *JCLBegin;
179 char *JCLToPSInterpreter;
180 char *JCLEnd;
181 char *DefaultFont;
182 FONTNAME *InstalledFonts; /* ptr to a list of FontNames */
183 PAGESIZE *PageSizes;
184 OPTION *InstalledOptions;
185 CONSTRAINT *Constraints;
186 INPUTSLOT *InputSlots;
187 } PPD;
189 typedef struct {
190 DEVMODEA dmPublic;
191 struct _tagdocprivate {
192 int dummy;
193 } dmDocPrivate;
194 struct _tagdrvprivate {
195 UINT numInstalledOptions; /* Options at end of struct */
196 } dmDrvPrivate;
198 /* Now comes:
200 numInstalledOptions of OPTIONs
204 } PSDRV_DEVMODEA;
206 typedef struct _tagPI {
207 char *FriendlyName;
208 PPD *ppd;
209 PSDRV_DEVMODEA *Devmode;
210 FONTFAMILY *Fonts;
211 PPRINTER_ENUM_VALUESA FontSubTable;
212 DWORD FontSubTableSize;
213 struct _tagPI *next;
214 } PRINTERINFO;
216 typedef struct {
217 float r, g, b;
218 } PSRGB;
220 typedef struct {
221 float i;
222 } PSGRAY;
225 /* def's for PSCOLOR.type */
226 #define PSCOLOR_GRAY 0
227 #define PSCOLOR_RGB 1
229 typedef struct {
230 int type;
231 union {
232 PSRGB rgb;
233 PSGRAY gray;
234 } value;
235 } PSCOLOR;
237 typedef struct {
238 const AFM *afm;
239 TEXTMETRICW tm;
240 INT size;
241 float scale;
242 INT escapement;
243 PSCOLOR color;
244 BOOL set; /* Have we done a setfont yet */
245 } PSFONT;
247 typedef struct {
248 PSCOLOR color;
249 BOOL set;
250 } PSBRUSH;
252 typedef struct {
253 INT style;
254 INT width;
255 char *dash;
256 PSCOLOR color;
257 BOOL set;
258 } PSPEN;
260 typedef struct {
261 HANDLE16 hJob;
262 LPSTR output; /* Output file/port */
263 BOOL banding; /* Have we received a NEXTBAND */
264 BOOL OutOfPage; /* Page header not sent yet */
265 INT PageNo;
266 } JOB;
268 typedef struct {
269 HDC hdc;
270 struct tagDC *dc;
271 PSFONT font; /* Current PS font */
272 PSPEN pen;
273 PSBRUSH brush;
274 PSCOLOR bkColor;
275 PSCOLOR inkColor; /* Last colour set */
276 JOB job;
277 PSDRV_DEVMODEA *Devmode;
278 PRINTERINFO *pi;
279 SIZE PageSize; /* Physical page size in device units */
280 RECT ImageableArea; /* Imageable area in device units */
281 /* NB both PageSize and ImageableArea
282 are not rotated in landscape mode,
283 so PageSize.cx is generally
284 < PageSize.cy */
285 int horzRes; /* device caps */
286 int vertRes;
287 int horzSize;
288 int vertSize;
289 int logPixelsX;
290 int logPixelsY;
291 } PSDRV_PDEVICE;
293 typedef struct {
294 PRINTERINFO *pi;
295 PSDRV_DEVMODEA *dlgdm;
296 } PSDRV_DLGINFO;
300 * Every glyph name in the Adobe Glyph List and the 35 core PostScript fonts
303 extern const INT PSDRV_AGLGlyphNamesSize;
304 extern GLYPHNAME PSDRV_AGLGlyphNames[];
308 * The AGL encoding vector
311 extern const INT PSDRV_AGLbyNameSize; /* sorted by name - */
312 extern const UNICODEGLYPH PSDRV_AGLbyName[]; /* duplicates omitted */
314 extern const INT PSDRV_AGLbyUVSize; /* sorted by UV - */
315 extern const UNICODEGLYPH PSDRV_AGLbyUV[]; /* duplicates included */
318 extern INT16 WINAPI PSDRV_ExtDeviceMode16(HWND16 hwnd, HANDLE16 hDriver,
319 LPDEVMODEA lpdmOutput, LPSTR lpszDevice, LPSTR lpszPort,
320 LPDEVMODEA lpdmInput, LPSTR lpszProfile, WORD fwMode);
322 extern HANDLE PSDRV_Heap;
323 extern char *PSDRV_ANSIVector[256];
325 extern void PSDRV_MergeDevmodes(PSDRV_DEVMODEA *dm1, PSDRV_DEVMODEA *dm2,
326 PRINTERINFO *pi);
327 extern BOOL PSDRV_GetFontMetrics(void);
328 extern PPD *PSDRV_ParsePPD(char *fname);
329 extern PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name);
330 extern const AFM *PSDRV_FindAFMinList(FONTFAMILY *head, LPCSTR name);
331 extern BOOL PSDRV_AddAFMtoList(FONTFAMILY **head, const AFM *afm,
332 BOOL *p_added);
333 extern void PSDRV_FreeAFMList( FONTFAMILY *head );
335 extern BOOL WINAPI PSDRV_Init(HINSTANCE hinst, DWORD reason, LPVOID reserved);
337 extern BOOL PSDRV_Brush(PSDRV_PDEVICE *physDev, BOOL EO);
338 extern BOOL PSDRV_SetFont( PSDRV_PDEVICE *physDev );
339 extern BOOL PSDRV_SetPen( PSDRV_PDEVICE *physDev );
341 extern BOOL PSDRV_CmpColor(PSCOLOR *col1, PSCOLOR *col2);
342 extern BOOL PSDRV_CopyColor(PSCOLOR *col1, PSCOLOR *col2);
343 extern void PSDRV_CreateColor( PSDRV_PDEVICE *physDev, PSCOLOR *pscolor,
344 COLORREF wincolor );
345 extern char PSDRV_UnicodeToANSI(int u);
347 extern INT PSDRV_WriteHeader( PSDRV_PDEVICE *physDev, LPCSTR title );
348 extern INT PSDRV_WriteFooter( PSDRV_PDEVICE *physDev );
349 extern INT PSDRV_WriteNewPage( PSDRV_PDEVICE *physDev );
350 extern INT PSDRV_WriteEndPage( PSDRV_PDEVICE *physDev );
351 extern BOOL PSDRV_WriteMoveTo(PSDRV_PDEVICE *physDev, INT x, INT y);
352 extern BOOL PSDRV_WriteLineTo(PSDRV_PDEVICE *physDev, INT x, INT y);
353 extern BOOL PSDRV_WriteStroke(PSDRV_PDEVICE *physDev);
354 extern BOOL PSDRV_WriteRectangle(PSDRV_PDEVICE *physDev, INT x, INT y, INT width,
355 INT height);
356 extern BOOL PSDRV_WriteRRectangle(PSDRV_PDEVICE *physDev, INT x, INT y, INT width,
357 INT height);
358 extern BOOL PSDRV_WriteSetFont(PSDRV_PDEVICE *physDev);
359 extern BOOL PSDRV_WriteGlyphShow(PSDRV_PDEVICE *physDev, LPCWSTR str, INT count);
360 extern BOOL PSDRV_WriteSetPen(PSDRV_PDEVICE *physDev);
361 extern BOOL PSDRV_WriteArc(PSDRV_PDEVICE *physDev, INT x, INT y, INT w, INT h,
362 double ang1, double ang2);
363 extern BOOL PSDRV_WriteSetColor(PSDRV_PDEVICE *physDev, PSCOLOR *color);
364 extern BOOL PSDRV_WriteSetBrush(PSDRV_PDEVICE *physDev);
365 extern BOOL PSDRV_WriteFill(PSDRV_PDEVICE *physDev);
366 extern BOOL PSDRV_WriteEOFill(PSDRV_PDEVICE *physDev);
367 extern BOOL PSDRV_WriteGSave(PSDRV_PDEVICE *physDev);
368 extern BOOL PSDRV_WriteGRestore(PSDRV_PDEVICE *physDev);
369 extern BOOL PSDRV_WriteNewPath(PSDRV_PDEVICE *physDev);
370 extern BOOL PSDRV_WriteClosePath(PSDRV_PDEVICE *physDev);
371 extern BOOL PSDRV_WriteInitClip(PSDRV_PDEVICE *physDev);
372 extern BOOL PSDRV_WriteClip(PSDRV_PDEVICE *physDev);
373 extern BOOL PSDRV_WriteRectClip(PSDRV_PDEVICE *physDev, INT x, INT y, INT w, INT h);
374 extern BOOL PSDRV_WriteRectClip2(PSDRV_PDEVICE *physDev, CHAR *pszArrayName);
375 extern BOOL PSDRV_WriteEOClip(PSDRV_PDEVICE *physDev);
376 extern BOOL PSDRV_WriteHatch(PSDRV_PDEVICE *physDev);
377 extern BOOL PSDRV_WriteRotate(PSDRV_PDEVICE *physDev, float ang);
378 extern BOOL PSDRV_WriteIndexColorSpaceBegin(PSDRV_PDEVICE *physDev, int size);
379 extern BOOL PSDRV_WriteIndexColorSpaceEnd(PSDRV_PDEVICE *physDev);
380 extern BOOL PSDRV_WriteRGB(PSDRV_PDEVICE *physDev, COLORREF *map, int number);
381 extern BOOL PSDRV_WriteImageDict(PSDRV_PDEVICE *physDev, WORD depth, INT xDst, INT yDst,
382 INT widthDst, INT heightDst, INT widthSrc,
383 INT heightSrc, char *bits);
384 extern BOOL PSDRV_WriteBytes(PSDRV_PDEVICE *physDev, const BYTE *bytes, int number);
385 extern BOOL PSDRV_WriteDIBits16(PSDRV_PDEVICE *physDev, const WORD *words, int number);
386 extern BOOL PSDRV_WriteDIBits24(PSDRV_PDEVICE *physDev, const BYTE *bits, int number);
387 extern BOOL PSDRV_WriteDIBits32(PSDRV_PDEVICE *physDev, const BYTE *bits, int number);
388 extern int PSDRV_WriteSpool(PSDRV_PDEVICE *physDev, LPSTR lpData, WORD cch);
389 extern BOOL PSDRV_WritePatternDict(PSDRV_PDEVICE *physDev, BITMAP *bm, BYTE *bits);
390 extern BOOL PSDRV_WriteArrayPut(PSDRV_PDEVICE *physDev, CHAR *pszArrayName, INT nIndex, LONG lCoord);
391 extern BOOL PSDRV_WriteArrayDef(PSDRV_PDEVICE *physDev, CHAR *pszArrayName, INT nSize);
393 extern BOOL PSDRV_Arc( PSDRV_PDEVICE *physDev, INT left, INT top, INT right,
394 INT bottom, INT xstart, INT ystart,
395 INT xend, INT yend );
396 extern BOOL PSDRV_Chord( PSDRV_PDEVICE *physDev, INT left, INT top, INT right,
397 INT bottom, INT xstart, INT ystart,
398 INT xend, INT yend );
399 extern BOOL PSDRV_Ellipse( PSDRV_PDEVICE *physDev, INT left, INT top, INT right,
400 INT bottom );
401 extern INT PSDRV_EndDoc( PSDRV_PDEVICE *physDev );
402 extern INT PSDRV_EndPage( PSDRV_PDEVICE *physDev );
403 extern BOOL PSDRV_ExtTextOut( PSDRV_PDEVICE *physDev, INT x, INT y, UINT flags,
404 const RECT *lprect, LPCWSTR str, UINT count,
405 const INT *lpDx );
406 extern BOOL PSDRV_GetCharWidth( PSDRV_PDEVICE *physDev, UINT firstChar, UINT lastChar,
407 LPINT buffer );
408 extern BOOL PSDRV_GetTextExtentPoint( PSDRV_PDEVICE *physDev, LPCWSTR str, INT count,
409 LPSIZE size );
410 extern BOOL PSDRV_GetTextMetrics( PSDRV_PDEVICE *physDev, TEXTMETRICW *metrics );
411 extern BOOL PSDRV_LineTo( PSDRV_PDEVICE *physDev, INT x, INT y );
412 extern BOOL PSDRV_PatBlt( PSDRV_PDEVICE *physDev, INT x, INT y, INT width, INT height, DWORD
413 dwRop);
414 extern BOOL PSDRV_Pie( PSDRV_PDEVICE *physDev, INT left, INT top, INT right,
415 INT bottom, INT xstart, INT ystart,
416 INT xend, INT yend );
417 extern BOOL PSDRV_Polygon( PSDRV_PDEVICE *physDev, const POINT* pt, INT count );
418 extern BOOL PSDRV_Polyline( PSDRV_PDEVICE *physDev, const POINT* pt, INT count );
419 extern BOOL PSDRV_PolyPolygon( PSDRV_PDEVICE *physDev, const POINT* pts, const INT* counts,
420 UINT polygons );
421 extern BOOL PSDRV_PolyPolyline( PSDRV_PDEVICE *physDev, const POINT* pts, const DWORD* counts,
422 DWORD polylines );
423 extern BOOL PSDRV_Rectangle( PSDRV_PDEVICE *physDev, INT left, INT top, INT right,
424 INT bottom );
425 extern BOOL PSDRV_RoundRect(PSDRV_PDEVICE *physDev, INT left, INT top, INT right,
426 INT bottom, INT ell_width, INT ell_height);
427 extern COLORREF PSDRV_SetBkColor( PSDRV_PDEVICE *physDev, COLORREF color );
428 extern COLORREF PSDRV_SetPixel( PSDRV_PDEVICE *physDev, INT x, INT y, COLORREF color );
429 extern COLORREF PSDRV_SetTextColor( PSDRV_PDEVICE *physDev, COLORREF color );
430 extern INT PSDRV_StartDoc( PSDRV_PDEVICE *physDev, const DOCINFOA *doc );
431 extern INT PSDRV_StartPage( PSDRV_PDEVICE *physDev );
432 extern INT PSDRV_StretchDIBits( PSDRV_PDEVICE *physDev, INT xDst, INT yDst,
433 INT widthDst, INT heightDst, INT xSrc,
434 INT ySrc, INT widthSrc, INT heightSrc,
435 const void *bits, const BITMAPINFO *info,
436 UINT wUsage, DWORD dwRop );
438 extern INT PSDRV_ExtDeviceMode(LPSTR lpszDriver, HWND hwnd,
439 LPDEVMODEA lpdmOutput,
440 LPSTR lpszDevice, LPSTR lpszPort,
441 LPDEVMODEA lpdmInput, LPSTR lpszProfile,
442 DWORD dwMode);
443 extern DWORD PSDRV_DeviceCapabilities(LPSTR lpszDriver, LPCSTR lpszDevice,
444 LPCSTR lpszPort,
445 WORD fwCapability, LPSTR lpszOutput,
446 LPDEVMODEA lpdm);
447 VOID PSDRV_DrawLine( PSDRV_PDEVICE *physDev );
448 INT PSDRV_GlyphListInit(void);
449 const GLYPHNAME *PSDRV_GlyphName(LPCSTR szName);
450 VOID PSDRV_IndexGlyphList(void);
451 BOOL PSDRV_GetTrueTypeMetrics(void);
452 BOOL PSDRV_GetType1Metrics(void);
453 const AFMMETRICS *PSDRV_UVMetrics(LONG UV, const AFM *afm);
454 SHORT PSDRV_CalcAvgCharWidth(const AFM *afm);
456 #endif