Added tracking support and fixed loading of resource strings.
[wine] / include / psdrv.h
1
2 /*
3  *      PostScript driver definitions
4  *
5  *      Copyright 1998  Huw D M Davies
6  */
7 #include "windows.h"
8 #include "font.h"
9 #include "pen.h"
10 #include "brush.h"
11
12 typedef struct {
13     float       llx, lly, urx, ury;
14 } AFMBBOX;
15
16 typedef struct _tagAFMLIGS {
17     char                *successor;
18     char                *ligature;
19     struct _tagAFMLIGS  *next;
20 } AFMLIGS;
21
22 typedef struct _tagAFMMETRICS {
23     int                         C;                      /* character */  
24     float                       WX;
25     char                        *N;                     /* name */
26     AFMBBOX                     B;
27     AFMLIGS                     *L;                     /* Ligatures */
28     struct _tagAFMMETRICS       *next;
29 } AFMMETRICS;
30
31 typedef struct _tagAFM {
32     char                *FontName;
33     char                *FullName;
34     char                *FamilyName;
35     char                *EncodingScheme;
36     int                 Weight;                 /* FW_NORMAL etc. */
37     float               ItalicAngle;
38     BOOL32              IsFixedPitch;
39     float               UnderlinePosition;
40     float               UnderlineThickness;
41     AFMBBOX             FontBBox;
42     float               CapHeight;
43     float               XHeight;
44     float               Ascender;
45     float               Descender;
46     float               FullAscender;           /* Ascent of Aring character */
47     float               CharWidths[256];
48     int                 NumofMetrics;
49     AFMMETRICS          *Metrics;
50 } AFM; /* CharWidths is a shortcut to the WX values of numbered glyphs */
51
52 /* Note no 'next' in AFM. Use AFMLISTENTRY as a container. This allow more than
53    one list to exist without having to reallocate the entire AFM structure. We
54    keep a global list of all afms (PSDRV_AFMFontList) plus a list of available
55    fonts for each DC (dc->physDev->Fonts) */
56
57 typedef struct _tagAFMLISTENTRY {
58     AFM                         *afm;
59     struct _tagAFMLISTENTRY     *next;
60 } AFMLISTENTRY;
61
62 typedef struct _tagFONTFAMILY {
63     char                        *FamilyName; /* family name */
64     AFMLISTENTRY                *afmlist;    /* list of afms for this family */
65     struct _tagFONTFAMILY       *next;       /* next family */
66 } FONTFAMILY;
67
68 extern FONTFAMILY *PSDRV_AFMFontList;
69
70 typedef struct _tagFONTNAME {
71     char                *Name;
72     struct _tagFONTNAME *next;
73 } FONTNAME;
74
75 typedef struct {
76     float       llx, lly, urx, ury;
77 } IMAGEABLEAREA;
78
79 typedef struct {
80     float       x, y;
81 } PAPERDIMENSION;
82
83 typedef struct _tagPAGESIZE {
84     char                *Name;
85     char                *FullName;
86     char                *InvocationString;
87     IMAGEABLEAREA       *ImageableArea;
88     PAPERDIMENSION      *PaperDimension;
89     WORD                WinPage; /*eg DMPAPER_A4. Doesn't really belong here */
90     struct _tagPAGESIZE *next;
91 } PAGESIZE;
92
93
94 typedef struct _tagOPTIONENTRY {
95     char                        *Name;          /* eg "True" */
96     char                        *FullName;      /* eg "Installed" */
97     char                        *InvocationString; /* Often NULL */
98     struct _tagOPTIONENTRY      *next;
99 } OPTIONENTRY;
100
101 typedef struct _tagOPTION { /* Treat bool as a special case of pickone */
102     char                        *OptionName;    /* eg "*Option1" */
103     char                        *FullName;      /* eg "Envelope Feeder" */
104     char                        *DefaultOption; /* eg "False" */
105     OPTIONENTRY                 *Options;
106     struct _tagOPTION           *next;
107 } OPTION;
108
109 typedef struct _tagCONSTRAINT {
110     char                        *Feature1;
111     char                        *Value1;
112     char                        *Feature2;
113     char                        *Value2;
114     struct _tagCONSTRAINT       *next;
115 } CONSTRAINT;
116
117 typedef struct _tagINPUTSLOT {
118     char                        *Name;
119     char                        *FullName;
120     char                        *InvocationString;
121     WORD                        WinBin; /* eg DMBIN_LOWER */
122     struct _tagINPUTSLOT        *next;
123 } INPUTSLOT;
124
125 typedef struct {
126     char                *NickName;
127     int                 LanguageLevel;
128     BOOL32              ColorDevice;
129     int                 DefaultResolution;
130     signed int          LandscapeOrientation;
131     char                *JCLBegin;
132     char                *JCLToPSInterpreter;
133     char                *JCLEnd;
134     char                *DefaultFont;
135     FONTNAME            *InstalledFonts; /* ptr to a list of FontNames */
136     PAGESIZE            *PageSizes;
137     OPTION              *InstalledOptions;
138     CONSTRAINT          *Constraints;
139     INPUTSLOT           *InputSlots;
140 } PPD;
141
142 typedef struct {
143     DEVMODE16                   dmPublic;
144     struct _tagdocprivate {
145     }                           dmDocPrivate;
146     struct _tagdrvprivate {
147       char      ppdFileName[100]; /* Hack */
148       UINT32    numInstalledOptions; /* Options at end of struct */
149     }                           dmDrvPrivate;
150
151 /* Now comes:
152
153 numInstalledOptions of OPTIONs
154
155 */
156
157 } PSDRV_DEVMODE16;
158
159 typedef struct _tagPI {
160     char                *FriendlyName;
161     PPD                 *ppd;
162     PSDRV_DEVMODE16     *Devmode;
163     FONTFAMILY          *Fonts;
164     struct _tagPI       *next;
165 } PRINTERINFO;
166
167 typedef struct {
168     float               r, g, b;
169 } PSRGB;
170
171 typedef struct {
172     float               i;
173 } PSGRAY;
174
175
176 /* def's for PSCOLOR.type */
177 #define PSCOLOR_GRAY    0
178 #define PSCOLOR_RGB     1
179
180 typedef struct {
181     int                 type;
182     union {
183         PSRGB  rgb;
184         PSGRAY gray;
185     }                   value;
186 } PSCOLOR;
187
188 typedef struct {
189     AFM                 *afm;
190     TEXTMETRIC32A       tm;
191     INT32               size;
192     float               scale;
193     INT32               escapement;
194     PSCOLOR             color;
195     BOOL32              set;            /* Have we done a setfont yet */
196 } PSFONT;
197
198 typedef struct {
199     PSCOLOR             color;
200     UINT32              style;
201     BOOL32              set;
202 } PSBRUSH;
203
204 typedef struct {
205     INT32               width;
206     char                *dash;
207     PSCOLOR             color;
208     BOOL32              set;
209 } PSPEN;
210
211 typedef struct {
212     HANDLE16            hJob;
213     LPSTR               output;         /* Output file/port */
214     BOOL32              banding;        /* Have we received a NEXTBAND */
215     BOOL32              NeedPageHeader; /* Page header not sent yet */
216     INT32               PageNo;
217 } JOB;
218
219 typedef struct {
220     PSFONT              font;           /* Current PS font */
221     PSPEN               pen;
222     PSBRUSH             brush;
223     PSCOLOR             bkColor;
224     PSCOLOR             inkColor;       /* Last colour set */
225     JOB                 job;
226     PSDRV_DEVMODE16     *Devmode;
227     PRINTERINFO         *pi;
228 } PSDRV_PDEVICE;
229
230 extern HANDLE32 PSDRV_Heap;
231 extern char *PSDRV_ANSIVector[256];
232
233 extern void PSDRV_MergeDevmodes(PSDRV_DEVMODE16 *dm1, PSDRV_DEVMODE16 *dm2,
234                          PRINTERINFO *pi);
235 extern BOOL32 PSDRV_GetFontMetrics(void);
236 extern PPD *PSDRV_ParsePPD(char *fname);
237 extern PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name);
238 extern AFM *PSDRV_FindAFMinList(FONTFAMILY *head, char *name);
239 extern void PSDRV_AddAFMtoList(FONTFAMILY **head, AFM *afm);
240 extern void PSDRV_FreeAFMList( FONTFAMILY *head );
241
242 extern BOOL32 PSDRV_Init(void);
243 extern HFONT16 PSDRV_FONT_SelectObject( DC *dc, HFONT16 hfont, FONTOBJ *font);
244 extern HPEN32 PSDRV_PEN_SelectObject( DC * dc, HPEN32 hpen, PENOBJ * pen );
245 extern HBRUSH32 PSDRV_BRUSH_SelectObject( DC * dc, HBRUSH32 hbrush,
246                                           BRUSHOBJ * brush );
247
248 extern BOOL32 PSDRV_SetBrush(DC *dc);
249 extern BOOL32 PSDRV_SetFont( DC *dc );
250 extern BOOL32 PSDRV_SetPen( DC *dc );
251
252 extern BOOL32 PSDRV_CmpColor(PSCOLOR *col1, PSCOLOR *col2);
253 extern BOOL32 PSDRV_CopyColor(PSCOLOR *col1, PSCOLOR *col2);
254 extern void PSDRV_CreateColor( PSDRV_PDEVICE *physDev, PSCOLOR *pscolor,
255                      COLORREF wincolor );
256
257
258 extern INT32 PSDRV_WriteHeader( DC *dc, char *title, int len );
259 extern INT32 PSDRV_WriteFooter( DC *dc );
260 extern INT32 PSDRV_WriteNewPage( DC *dc );
261 extern INT32 PSDRV_WriteEndPage( DC *dc );
262 extern BOOL32 PSDRV_WriteMoveTo(DC *dc, INT32 x, INT32 y);
263 extern BOOL32 PSDRV_WriteLineTo(DC *dc, INT32 x, INT32 y);
264 extern BOOL32 PSDRV_WriteStroke(DC *dc);
265 extern BOOL32 PSDRV_WriteRectangle(DC *dc, INT32 x, INT32 y, INT32 width, 
266                         INT32 height);
267 extern BOOL32 PSDRV_WriteSetFont(DC *dc, BOOL32 UseANSI);
268 extern BOOL32 PSDRV_WriteShow(DC *dc, char *str, INT32 count);
269 extern BOOL32 PSDRV_WriteReencodeFont(DC *dc);
270 extern BOOL32 PSDRV_WriteSetPen(DC *dc);
271 extern BOOL32 PSDRV_WriteEllispe(DC *dc, INT32 x, INT32 y, INT32 a, INT32 b);
272 extern BOOL32 PSDRV_WriteSetColor(DC *dc, PSCOLOR *color);
273 extern BOOL32 PSDRV_WriteSetBrush(DC *dc);
274 extern BOOL32 PSDRV_WriteFill(DC *dc);
275 extern BOOL32 PSDRV_Writegsave(DC *dc);
276 extern BOOL32 PSDRV_Writegrestore(DC *dc);
277
278
279
280
281
282
283 extern BOOL32 PSDRV_Ellipse(DC *dc, INT32 left, INT32 top, INT32 right,
284                        INT32 bottom);
285 extern BOOL32 PSDRV_EnumDeviceFonts( DC* dc, LPLOGFONT16 plf, 
286                                         DEVICEFONTENUMPROC proc, LPARAM lp );
287 extern INT32 PSDRV_Escape( DC *dc, INT32 nEscape, INT32 cbInput, 
288                               SEGPTR lpInData, SEGPTR lpOutData );
289 extern BOOL32 PSDRV_ExtTextOut( DC *dc, INT32 x, INT32 y, UINT32 flags,
290                    const RECT32 *lprect, LPCSTR str, UINT32 count,
291                    const INT32 *lpDx );
292 extern BOOL32 PSDRV_GetTextExtentPoint( DC *dc, LPCSTR str, INT32 count,
293                                   LPSIZE32 size );
294 extern BOOL32 PSDRV_GetTextMetrics( DC *dc, TEXTMETRIC32A *metrics );
295 extern BOOL32 PSDRV_LineTo( DC *dc, INT32 x, INT32 y );
296 extern BOOL32 PSDRV_MoveToEx( DC *dc, INT32 x, INT32 y, LPPOINT32 pt );
297 extern BOOL32 PSDRV_Polygon( DC *dc, LPPOINT32 pt, INT32 count );
298 extern BOOL32 PSDRV_Polyline( DC *dc, const LPPOINT32 pt, INT32 count );
299 extern BOOL32 PSDRV_Rectangle(DC *dc, INT32 left, INT32 top, INT32 right,
300                        INT32 bottom);
301 extern HGDIOBJ32 PSDRV_SelectObject( DC *dc, HGDIOBJ32 handle );
302 extern COLORREF PSDRV_SetBkColor( DC *dc, COLORREF color );
303 extern COLORREF PSDRV_SetTextColor( DC *dc, COLORREF color );
304
305
306