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