Don't return from overlapped ReadFile on EAGAIN and other non-fatal
[wine/gsoc_dplay.git] / include / x11font.h
blobcde280e4b3499f8ba7197cec0b4c42945bb9895d
1 /*
2 * X11 physical font definitions
4 * Copyright 1997 Alex Korobka
5 */
7 #ifndef __WINE_X11FONT_H
8 #define __WINE_X11FONT_H
10 #include "gdi.h"
11 #include "x11drv.h"
12 #include "pshpack1.h"
14 /* this is a part of the font resource header, should
15 * make it easier to implement dynamic softfont loading */
17 typedef struct
19 INT16 dfType;
20 INT16 dfPoints;
21 INT16 dfVertRes;
22 INT16 dfHorizRes;
23 INT16 dfAscent;
24 INT16 dfInternalLeading;
25 INT16 dfExternalLeading;
26 CHAR dfItalic;
27 CHAR dfUnderline;
28 CHAR dfStrikeOut;
29 INT16 dfWeight;
30 BYTE dfCharSet;
31 INT16 dfPixWidth;
32 INT16 dfPixHeight;
33 CHAR dfPitchAndFamily;
34 INT16 dfAvgWidth;
35 INT16 dfMaxWidth;
36 CHAR dfFirstChar;
37 CHAR dfLastChar;
38 CHAR dfDefaultChar;
39 CHAR dfBreakChar;
40 INT16 dfWidthBytes;
41 LPCSTR dfDevice;
42 LPCSTR dfFace;
43 } IFONTINFO16, *LPIFONTINFO16;
45 #include "poppack.h"
47 /* internal flags */
49 #define FI_POLYWEIGHT 0x0001
50 #define FI_POLYSLANT 0x0002
51 #define FI_OBLIQUE 0x0004
52 #define FI_SCALABLE 0x0008
53 #define FI_FW_BOOK 0x0010
54 #define FI_FW_DEMI 0x0020
55 #define FI_VARIABLEPITCH 0x0040
56 #define FI_FIXEDPITCH 0x0080
58 #define FI_FIXEDEX 0x1000
59 #define FI_NORMAL 0x2000
60 #define FI_SUBSET 0x4000
61 #define FI_TRUETYPE 0x8000
63 /* code pages */
65 #define FI_ENC_ANSI 0
66 #define FI_ENC_ISO8859 1
67 #define FI_ENC_ISO646 2
68 #define FI_ENC_MICROSOFT 3
69 #define FI_ENC_KOI8 4
70 #define FI_ENC_ASCII 5
71 #define FI_ENC_VISCII 6
72 #define FI_ENC_TCVN 7
73 #define FI_ENC_TIS620 8
75 enum X11DRV_CPTABLE
77 X11DRV_CPTABLE_SBCS,
78 X11DRV_CPTABLE_UNICODE,
79 X11DRV_CPTABLE_CP932,
80 X11DRV_CPTABLE_CP936,
81 X11DRV_CPTABLE_CP949,
82 X11DRV_CPTABLE_CP950,
83 X11DRV_CPTABLE_SYMBOL,
84 X11DRV_CPTABLE_COUNT
87 typedef struct tagFontInfo
89 struct tagFontInfo* next;
90 UINT16 fi_flags;
91 UINT16 fi_encoding;
92 UINT16 codepage;
93 UINT16 cptable;
94 WORD internal_charset;
96 /* LFD parameters can be quite different from the actual metrics */
98 UINT16 lfd_height;
99 UINT16 lfd_resolution;
100 IFONTINFO16 df;
101 } fontInfo;
103 /* Font resource list for EnumFont() purposes */
105 #define FR_SOFTFONT 0x1000 /* - .FON or .FOT file */
106 #define FR_SOFTRESOURCE 0x2000 /* - resource handle */
107 #define FR_REMOVED 0x4000 /* delayed remove */
108 #define FR_NAMESET 0x8000
110 #define LFD_FIELDS 14
111 typedef struct
113 const char* foundry;
114 const char* family;
115 const char* weight;
116 const char* slant;
117 const char* set_width;
118 const char* add_style;
119 const char* pixel_size;
120 const char* point_size;
121 const char* resolution_x;
122 const char* resolution_y;
123 const char* spacing;
124 const char* average_width;
125 const char* charset_registry;
126 const char* charset_encoding;
127 } LFD;
129 typedef struct tagFontResource
131 struct tagFontResource* next;
132 UINT16 fr_flags;
133 UINT16 fr_penalty;
134 UINT16 fi_count;
135 UINT16 fo_count;
136 fontInfo* fi;
137 LFD* resource;
138 HANDLE hOwner; /* For FR_SOFTFONT/FR_SOFTRESOURCE fonts */
139 CHAR lfFaceName[LF_FACESIZE];
140 } fontResource;
142 typedef struct {
143 float a,b,c,d; /* pixelsize matrix, FIXME: switch to MAT2 format */
144 unsigned long RAW_ASCENT;
145 unsigned long RAW_DESCENT;
146 float pixelsize;
147 float ascent;
148 float descent;
149 } XFONTTRANS;
151 #define FO_RESOURCE_MASK 0x000F
152 #define FO_SYSTEM 0x0001 /* resident in cache */
153 #define FO_SOFTFONT 0x0002 /* installed at runtime */
154 #define FO_SHARED 0x0004 /* MITSHM */
155 #define FO_REMOVED 0x0008 /* remove when count falls to 0 */
157 #define FO_MATCH_MASK 0x00F0
158 #define FO_MATCH_NORASTER 0x0010
159 #define FO_MATCH_PAF 0x0020
160 #define FO_MATCH_XYINDEP 0x0040
162 #define FO_SYNTH_MASK 0xFF00
163 #define FO_SYNTH_HEIGHT 0x2000
164 #define FO_SYNTH_WIDTH 0x4000
165 #define FO_SYNTH_ROTATE 0x8000
166 #define FO_SYNTH_BOLD 0x0100
167 #define FO_SYNTH_ITALIC 0x0200
168 #define FO_SYNTH_UNDERLINE 0x0400
169 #define FO_SYNTH_STRIKEOUT 0x0800
171 /* Realized screen font */
173 #define X11FONT_REFOBJS_MAX 4
175 typedef struct
177 XFontStruct* fs; /* text metrics */
178 fontResource* fr; /* font family */
179 fontInfo* fi; /* font instance info */
180 Pixmap* lpPixmap; /* optional character bitmasks for synth fonts */
181 X_PHYSFONT prefobjs[X11FONT_REFOBJS_MAX]; /* font objects for DBCS charsets */
183 XFONTTRANS *lpX11Trans; /* Info for X11R6 transform */
184 float rescale; /* Rescale for large fonts */
185 INT16 foInternalLeading;
186 INT16 foAvgCharWidth;
187 INT16 foMaxCharWidth;
188 UINT16 fo_flags;
190 /* font cache housekeeping */
192 UINT16 count;
193 UINT16 lru;
194 UINT16 lfchecksum;
195 LOGFONT16 lf;
196 } fontObject;
198 typedef struct
200 fontResource* pfr;
201 fontInfo* pfi;
202 UINT16 height;
203 UINT16 flags;
204 LPLOGFONT16 plf;
205 WORD internal_charset;
206 } fontMatch;
208 typedef struct
210 LPLOGFONT16 lpLogFontParam;
211 FONTENUMPROC16 lpEnumFunc;
212 LPARAM lpData;
214 LPNEWTEXTMETRICEX16 lpTextMetric;
215 LPENUMLOGFONTEX16 lpLogFont;
216 SEGPTR segTextMetric;
217 SEGPTR segLogFont;
218 } fontEnum16;
220 typedef struct
222 LPLOGFONTW lpLogFontParam;
223 FONTENUMPROCEXW lpEnumFunc;
224 LPARAM lpData;
226 LPNEWTEXTMETRICEXW lpTextMetric;
227 LPENUMLOGFONTEXW lpLogFont;
228 DWORD dwFlags;
229 } fontEnum32;
231 extern fontObject* XFONT_GetFontObject( X_PHYSFONT pFont );
232 extern XFontStruct* XFONT_GetFontStruct( X_PHYSFONT pFont );
233 extern LPIFONTINFO16 XFONT_GetFontInfo( X_PHYSFONT pFont );
235 /* internal charset(hibyte must be set) */
236 /* lobyte is DEFAULT_CHARSET(=0). */
237 #define X11FONT_JISX0201_CHARSET 0x100
238 #define X11FONT_JISX0212_CHARSET 0x200
240 typedef struct tagX11DRV_CP
242 WORD (*penum_subfont_charset)( UINT index );
243 XChar2b* (*punicode_to_char2b)( fontObject* pfo,
244 LPCWSTR lpwstr, UINT count );
245 void (*pDrawString)( fontObject* pfo, Display* pdisp, Drawable d, GC gc,
246 int x, int y, XChar2b* pstr, int count );
247 int (*pTextWidth)( fontObject* pfo, XChar2b* pstr, int count );
248 void (*pDrawText)( fontObject* pfo, Display* pdisp, Drawable d, GC gc,
249 int x, int y, XTextItem16* pitems, int count );
250 void (*pTextExtents)( fontObject* pfo, XChar2b* pstr, int count,
251 int* pdir, int* pascent, int* pdescent,
252 int* pwidth );
253 void (*pGetTextMetricsA)( fontObject* pfo, LPTEXTMETRICA pTM );
254 } X11DRV_CP;
256 extern const X11DRV_CP X11DRV_cptable[X11DRV_CPTABLE_COUNT];
258 #endif /* __WINE_X11FONT_H */