1 | /* $Id: font.cpp,v 1.14 2000-10-16 22:26:53 sandervl Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * GDI32 font apis
|
---|
5 | *
|
---|
6 | * Copyright 1999 Edgar Buerkle (Edgar.Buerkle@gmx.ne)
|
---|
7 | * Copyright 1999 Sander van Leeuwen (sandervl@xs4all.nl)
|
---|
8 | * Copyright 1998 Patrick Haller
|
---|
9 | *
|
---|
10 | * TODO: EnumFontsA/W, EnumFontFamiliesExA/W not complete
|
---|
11 | *
|
---|
12 | * Parts based on Wine code (991031)
|
---|
13 | *
|
---|
14 | * Copyright 1993 Alexandre Julliard
|
---|
15 | * 1997 Alex Korobka
|
---|
16 | *
|
---|
17 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
18 | *
|
---|
19 | */
|
---|
20 |
|
---|
21 | #include <odin.h>
|
---|
22 | #include <odinwrap.h>
|
---|
23 | #include <os2sel.h>
|
---|
24 |
|
---|
25 | #include <os2win.h>
|
---|
26 | #include <stdlib.h>
|
---|
27 | #include <stdarg.h>
|
---|
28 | #include <string.h>
|
---|
29 | #include "misc.h"
|
---|
30 | #include "unicode.h"
|
---|
31 | #include <heapstring.h>
|
---|
32 | #include <win\options.h>
|
---|
33 | #include <wprocess.h>
|
---|
34 |
|
---|
35 | #define DBG_LOCALLOG DBG_font
|
---|
36 | #include "dbglocal.h"
|
---|
37 |
|
---|
38 | ODINDEBUGCHANNEL(GDI32-FONT)
|
---|
39 |
|
---|
40 |
|
---|
41 | typedef struct {
|
---|
42 | DWORD userProc;
|
---|
43 | DWORD userData;
|
---|
44 | DWORD dwFlags;
|
---|
45 | } ENUMUSERDATA;
|
---|
46 |
|
---|
47 | /*
|
---|
48 | * For TranslateCharsetInfo
|
---|
49 | */
|
---|
50 | #define FS(x) {{0,0,0,0},{0x1<<(x),0}}
|
---|
51 | #define MAXTCIINDEX 32
|
---|
52 | static CHARSETINFO FONT_tci[MAXTCIINDEX] = {
|
---|
53 | /* ANSI */
|
---|
54 | { ANSI_CHARSET, 1252, FS(0)},
|
---|
55 | { EASTEUROPE_CHARSET, 1250, FS(1)},
|
---|
56 | { RUSSIAN_CHARSET, 1251, FS(2)},
|
---|
57 | { GREEK_CHARSET, 1253, FS(3)},
|
---|
58 | { TURKISH_CHARSET, 1254, FS(4)},
|
---|
59 | { HEBREW_CHARSET, 1255, FS(5)},
|
---|
60 | { ARABIC_CHARSET, 1256, FS(6)},
|
---|
61 | { BALTIC_CHARSET, 1257, FS(7)},
|
---|
62 | /* reserved by ANSI */
|
---|
63 | { DEFAULT_CHARSET, 0, FS(0)},
|
---|
64 | { DEFAULT_CHARSET, 0, FS(0)},
|
---|
65 | { DEFAULT_CHARSET, 0, FS(0)},
|
---|
66 | { DEFAULT_CHARSET, 0, FS(0)},
|
---|
67 | { DEFAULT_CHARSET, 0, FS(0)},
|
---|
68 | { DEFAULT_CHARSET, 0, FS(0)},
|
---|
69 | { DEFAULT_CHARSET, 0, FS(0)},
|
---|
70 | { DEFAULT_CHARSET, 0, FS(0)},
|
---|
71 | /* ANSI and OEM */
|
---|
72 | { THAI_CHARSET, 874, FS(16)},
|
---|
73 | { SHIFTJIS_CHARSET, 932, FS(17)},
|
---|
74 | { GB2312_CHARSET, 936, FS(18)},
|
---|
75 | { HANGEUL_CHARSET, 949, FS(19)},
|
---|
76 | { CHINESEBIG5_CHARSET, 950, FS(20)},
|
---|
77 | { JOHAB_CHARSET, 1361, FS(21)},
|
---|
78 | /* reserved for alternate ANSI and OEM */
|
---|
79 | { DEFAULT_CHARSET, 0, FS(0)},
|
---|
80 | { DEFAULT_CHARSET, 0, FS(0)},
|
---|
81 | { DEFAULT_CHARSET, 0, FS(0)},
|
---|
82 | { DEFAULT_CHARSET, 0, FS(0)},
|
---|
83 | { DEFAULT_CHARSET, 0, FS(0)},
|
---|
84 | { DEFAULT_CHARSET, 0, FS(0)},
|
---|
85 | { DEFAULT_CHARSET, 0, FS(0)},
|
---|
86 | { DEFAULT_CHARSET, 0, FS(0)},
|
---|
87 | /* reserved for system */
|
---|
88 | { DEFAULT_CHARSET, 0, FS(0)},
|
---|
89 | { DEFAULT_CHARSET, 0, FS(0)},
|
---|
90 | };
|
---|
91 |
|
---|
92 | /*****************************************************************************
|
---|
93 | * Name : static void iFontRename
|
---|
94 | * Purpose : font remapping table to map win32 fonts to OS/2 pendants
|
---|
95 | * Parameters: LPSTR lpstrFaceOriginal - the win32 face name
|
---|
96 | * LPSTR lpstrFaceBuffer - [LF_FACESIZE] buffer to new name
|
---|
97 | * Variables :
|
---|
98 | * Result :
|
---|
99 | * Remark : remapped name is passed back in the buffer
|
---|
100 | * if no mapping pendant is available, return input parameter
|
---|
101 | * as default.
|
---|
102 | * Status :
|
---|
103 | *
|
---|
104 | * Author : Patrick Haller [Fri, 1998/06/12 03:44]
|
---|
105 | *****************************************************************************/
|
---|
106 |
|
---|
107 | #define ODINFONTSECTION "Font Mapping"
|
---|
108 | static void iFontRename(LPCSTR lpstrFaceOriginal,
|
---|
109 | LPSTR lpstrFaceTemp)
|
---|
110 | {
|
---|
111 | int iRet;
|
---|
112 |
|
---|
113 | // NULL is a valid parameter
|
---|
114 | if (lpstrFaceOriginal == NULL)
|
---|
115 | return;
|
---|
116 |
|
---|
117 | strncpy(lpstrFaceTemp, lpstrFaceOriginal, LF_FACESIZE);
|
---|
118 | lpstrFaceTemp[LF_FACESIZE-1] = 0;
|
---|
119 | strupr(lpstrFaceTemp);
|
---|
120 |
|
---|
121 | //lookup table
|
---|
122 | iRet = PROFILE_GetOdinIniString(ODINFONTSECTION,
|
---|
123 | lpstrFaceTemp,
|
---|
124 | lpstrFaceOriginal,
|
---|
125 | lpstrFaceTemp,
|
---|
126 | LF_FACESIZE);
|
---|
127 | }
|
---|
128 |
|
---|
129 |
|
---|
130 | //******************************************************************************
|
---|
131 | //******************************************************************************
|
---|
132 | ODINFUNCTIONNODBG14(HFONT, CreateFontA, int, nHeight,
|
---|
133 | int, nWidth,
|
---|
134 | int, nEscapement,
|
---|
135 | int, nOrientation,
|
---|
136 | int, fnWeight,
|
---|
137 | DWORD, fdwItalic,
|
---|
138 | DWORD, fdwUnderline,
|
---|
139 | DWORD, fdwStrikeOut,
|
---|
140 | DWORD, fdwCharSet,
|
---|
141 | DWORD, fdwOutputPrecision,
|
---|
142 | DWORD, fdwClipPrecision,
|
---|
143 | DWORD, fdwQuality,
|
---|
144 | DWORD, fdwPitchAndFamily,
|
---|
145 | LPCSTR, lpszFace)
|
---|
146 | {
|
---|
147 | CHAR lpstrFaceNew[LF_FACESIZE];
|
---|
148 | HFONT hFont;
|
---|
149 |
|
---|
150 | iFontRename(lpszFace, lpstrFaceNew);
|
---|
151 |
|
---|
152 | dprintf(("lpszFace = %s -> %s\n", lpszFace, lpstrFaceNew));
|
---|
153 |
|
---|
154 | hFont = O32_CreateFont(nHeight,
|
---|
155 | nWidth,
|
---|
156 | nEscapement,
|
---|
157 | nOrientation,
|
---|
158 | fnWeight,
|
---|
159 | fdwItalic,
|
---|
160 | fdwUnderline,
|
---|
161 | fdwStrikeOut,
|
---|
162 | fdwCharSet,
|
---|
163 | fdwOutputPrecision,
|
---|
164 | fdwClipPrecision,
|
---|
165 | fdwQuality,
|
---|
166 | fdwPitchAndFamily,
|
---|
167 | lpszFace != NULL ? lpstrFaceNew : NULL);
|
---|
168 | return hFont;
|
---|
169 | }
|
---|
170 | //******************************************************************************
|
---|
171 | //******************************************************************************
|
---|
172 | ODINFUNCTIONNODBG14(HFONT, CreateFontW,
|
---|
173 | int, nHeight,
|
---|
174 | int, nWidth,
|
---|
175 | int, nEscapement,
|
---|
176 | int, nOrientation,
|
---|
177 | int, fnWeight,
|
---|
178 | DWORD, fdwItalic,
|
---|
179 | DWORD, fdwUnderline,
|
---|
180 | DWORD, fdwStrikeOut,
|
---|
181 | DWORD, fdwCharSet,
|
---|
182 | DWORD, fdwOutputPrecision,
|
---|
183 | DWORD, fdwClipPrecision,
|
---|
184 | DWORD, fdwQuality,
|
---|
185 | DWORD, fdwPitchAndFamily,
|
---|
186 | LPCWSTR,lpszFace)
|
---|
187 | {
|
---|
188 | char *astring;
|
---|
189 | HFONT hFont;
|
---|
190 |
|
---|
191 | // NULL is valid for lpszFace
|
---|
192 | if(lpszFace != NULL)
|
---|
193 | astring = UnicodeToAsciiString((LPWSTR)lpszFace);
|
---|
194 | else
|
---|
195 | astring = NULL;
|
---|
196 |
|
---|
197 | // @@@PH switch to ODIN_ later
|
---|
198 | hFont = CreateFontA(nHeight,
|
---|
199 | nWidth,
|
---|
200 | nEscapement,
|
---|
201 | nOrientation,
|
---|
202 | fnWeight,
|
---|
203 | fdwItalic,
|
---|
204 | fdwUnderline,
|
---|
205 | fdwStrikeOut,
|
---|
206 | fdwCharSet,
|
---|
207 | fdwOutputPrecision,
|
---|
208 | fdwClipPrecision,
|
---|
209 | fdwQuality,
|
---|
210 | fdwPitchAndFamily,
|
---|
211 | astring);
|
---|
212 | if (astring != NULL)
|
---|
213 | FreeAsciiString(astring);
|
---|
214 |
|
---|
215 | return(hFont);
|
---|
216 | }
|
---|
217 |
|
---|
218 | //******************************************************************************
|
---|
219 | //******************************************************************************
|
---|
220 | ODINFUNCTION1(HFONT,CreateFontIndirectA,const LOGFONTA*, lplf)
|
---|
221 | {
|
---|
222 | HFONT hFont;
|
---|
223 | LOGFONTA afont;
|
---|
224 |
|
---|
225 | // don't touch user buffer!
|
---|
226 | memcpy(&afont, lplf, sizeof(LOGFONTA));
|
---|
227 | iFontRename(lplf->lfFaceName, afont.lfFaceName);
|
---|
228 |
|
---|
229 | dprintf(("lpszFace = (%x) %s -> %s\n", lplf->lfFaceName, lplf->lfFaceName, afont.lfFaceName));
|
---|
230 |
|
---|
231 | dprintf(("GDI32: CreateFontIndirectA\n"));
|
---|
232 | dprintf(("GDI32: lfHeight = %d\n", lplf->lfHeight));
|
---|
233 | dprintf(("GDI32: lfWidth = %d\n", lplf->lfWidth));
|
---|
234 | dprintf(("GDI32: lfEscapement = %d\n", lplf->lfEscapement));
|
---|
235 | dprintf(("GDI32: lfOrientation = %d\n", lplf->lfOrientation));
|
---|
236 | dprintf(("GDI32: lfWeight = %d\n", lplf->lfWeight));
|
---|
237 | dprintf(("GDI32: lfItalic = %d\n", lplf->lfItalic));
|
---|
238 | dprintf(("GDI32: lfUnderline = %d\n", lplf->lfUnderline));
|
---|
239 | dprintf(("GDI32: lfStrikeOut = %d\n", lplf->lfStrikeOut));
|
---|
240 | dprintf(("GDI32: lfCharSet = %X\n", lplf->lfCharSet));
|
---|
241 | dprintf(("GDI32: lfOutPrecision = %X\n", lplf->lfOutPrecision));
|
---|
242 | dprintf(("GDI32: lfClipPrecision = %X\n", lplf->lfClipPrecision));
|
---|
243 | dprintf(("GDI32: lfQuality = %X\n", lplf->lfQuality));
|
---|
244 | dprintf(("GDI32: lfPitchAndFamily= %X\n", lplf->lfPitchAndFamily));
|
---|
245 | dprintf(("GDI32: lfFaceName = %s\n", lplf->lfFaceName));
|
---|
246 |
|
---|
247 | hFont = O32_CreateFontIndirect(&afont);
|
---|
248 |
|
---|
249 | return(hFont);
|
---|
250 | }
|
---|
251 | //******************************************************************************
|
---|
252 | //******************************************************************************
|
---|
253 | ODINFUNCTION1(HFONT, CreateFontIndirectW,const LOGFONTW *, lplf)
|
---|
254 | {
|
---|
255 | LOGFONTA afont;
|
---|
256 | HFONT hfont;
|
---|
257 |
|
---|
258 | //memcpy(&afont, lplf, ((ULONG)&afont.lfFaceName - (ULONG)&afont));
|
---|
259 | memcpy(&afont, lplf, sizeof(LOGFONTA));
|
---|
260 | memset(afont.lfFaceName, 0, LF_FACESIZE);
|
---|
261 | dprintf(("lpszFace = (%x)", lplf->lfFaceName));
|
---|
262 |
|
---|
263 | UnicodeToAsciiN((WCHAR *)lplf->lfFaceName, afont.lfFaceName, LF_FACESIZE-1);
|
---|
264 | hfont = CreateFontIndirectA(&afont);
|
---|
265 | return(hfont);
|
---|
266 | }
|
---|
267 | //******************************************************************************
|
---|
268 | //******************************************************************************
|
---|
269 | int EXPENTRY_O32 EnumFontProcA(LPENUMLOGFONTA lpLogFont, LPNEWTEXTMETRICA
|
---|
270 | lpTextM, DWORD arg3, LPARAM arg4)
|
---|
271 | {
|
---|
272 | ENUMUSERDATA *lpEnumData = (ENUMUSERDATA *)arg4;
|
---|
273 | FONTENUMPROCA proc = (FONTENUMPROCA)lpEnumData->userProc;
|
---|
274 | USHORT selTIB = SetWin32TIB(); // save current FS selector and set win32 sel
|
---|
275 |
|
---|
276 | int rc = proc(lpLogFont, lpTextM, arg3, lpEnumData->userData);
|
---|
277 | SetFS(selTIB); // switch back to the saved FS selector
|
---|
278 | return rc;
|
---|
279 | }
|
---|
280 | //******************************************************************************
|
---|
281 | //******************************************************************************
|
---|
282 | int EXPENTRY_O32 EnumFontProcW(LPENUMLOGFONTA lpLogFont, LPNEWTEXTMETRICA lpTextM,
|
---|
283 | DWORD arg3, LPARAM arg4)
|
---|
284 | {
|
---|
285 | ENUMUSERDATA *lpEnumData = (ENUMUSERDATA *)arg4;
|
---|
286 | FONTENUMPROCW proc = (FONTENUMPROCW)lpEnumData->userProc;
|
---|
287 | ENUMLOGFONTW LogFont;
|
---|
288 | NEWTEXTMETRICW textM;
|
---|
289 | USHORT selTIB = SetWin32TIB(); // save current FS selector and set win32 sel
|
---|
290 | int rc;
|
---|
291 |
|
---|
292 | memcpy(&LogFont, lpLogFont, ((ULONG)&LogFont.elfLogFont.lfFaceName -
|
---|
293 | (ULONG)&LogFont));
|
---|
294 | AsciiToUnicodeN(lpLogFont->elfLogFont.lfFaceName, LogFont.elfLogFont.lfFaceName, LF_FACESIZE-1);
|
---|
295 | AsciiToUnicodeN((char *) lpLogFont->elfFullName, LogFont.elfFullName, LF_FULLFACESIZE-1);
|
---|
296 | AsciiToUnicodeN((char *) lpLogFont->elfStyle, LogFont.elfStyle, LF_FACESIZE-1);
|
---|
297 |
|
---|
298 | textM.tmHeight = lpTextM->tmHeight;
|
---|
299 | textM.tmAscent = lpTextM->tmAscent;
|
---|
300 | textM.tmDescent = lpTextM->tmDescent;
|
---|
301 | textM.tmInternalLeading = lpTextM->tmInternalLeading;
|
---|
302 | textM.tmExternalLeading = lpTextM->tmExternalLeading;
|
---|
303 | textM.tmAveCharWidth = lpTextM->tmAveCharWidth;
|
---|
304 | textM.tmMaxCharWidth = lpTextM->tmMaxCharWidth;
|
---|
305 | textM.tmWeight = lpTextM->tmWeight;
|
---|
306 | textM.tmOverhang = lpTextM->tmOverhang;
|
---|
307 | textM.tmDigitizedAspectX = lpTextM->tmDigitizedAspectX;
|
---|
308 | textM.tmDigitizedAspectY = lpTextM->tmDigitizedAspectY;
|
---|
309 | textM.tmFirstChar = lpTextM->tmFirstChar;
|
---|
310 | textM.tmLastChar = lpTextM->tmLastChar;
|
---|
311 | textM.tmDefaultChar = lpTextM->tmDefaultChar;
|
---|
312 | textM.tmBreakChar = lpTextM->tmBreakChar;
|
---|
313 | textM.tmItalic = lpTextM->tmItalic;
|
---|
314 | textM.tmUnderlined = lpTextM->tmUnderlined;
|
---|
315 | textM.tmStruckOut = lpTextM->tmStruckOut;
|
---|
316 | textM.tmPitchAndFamily = lpTextM->tmPitchAndFamily;
|
---|
317 | textM.tmCharSet = lpTextM->tmCharSet;
|
---|
318 | textM.ntmFlags = 0;
|
---|
319 | textM.ntmSizeEM = 0;
|
---|
320 | textM.ntmCellHeight = 0;
|
---|
321 | textM.ntmAvgWidth = 0;
|
---|
322 |
|
---|
323 | rc = proc(&LogFont, &textM, arg3, lpEnumData->userData);
|
---|
324 | SetFS(selTIB); // switch back to the saved FS selector
|
---|
325 | return rc;
|
---|
326 | }
|
---|
327 | //******************************************************************************
|
---|
328 | //TODO: FontEnumdwFlagsEx, script, font signature & NEWTEXTMETRICEX (last part)
|
---|
329 | //******************************************************************************
|
---|
330 | int EXPENTRY_O32 EnumFontProcExA(LPENUMLOGFONTA lpLogFont, LPNEWTEXTMETRICA
|
---|
331 | lpTextM, DWORD arg3, LPARAM arg4)
|
---|
332 | {
|
---|
333 | ENUMUSERDATA *lpEnumData = (ENUMUSERDATA *)arg4;
|
---|
334 | FONTENUMPROCEXA proc = (FONTENUMPROCEXA)lpEnumData->userProc;
|
---|
335 | ENUMLOGFONTEXA logFont;
|
---|
336 | NEWTEXTMETRICEXA textM;
|
---|
337 | USHORT selTIB = SetWin32TIB(); // save current FS selector and set win32 sel
|
---|
338 |
|
---|
339 | memcpy(&logFont, lpLogFont, sizeof(ENUMLOGFONTA));
|
---|
340 | memset(logFont.elfScript, 0, sizeof(logFont.elfScript));
|
---|
341 | memcpy(&textM.ntmetm, lpTextM, sizeof(textM.ntmetm));
|
---|
342 | memset(&textM.ntmeFontSignature, 0, sizeof(textM.ntmeFontSignature));
|
---|
343 |
|
---|
344 | dprintf(("EnumFontProcExA %s", logFont.elfLogFont.lfFaceName));
|
---|
345 |
|
---|
346 | int rc = proc(&logFont, &textM, arg3, lpEnumData->userData);
|
---|
347 | SetFS(selTIB); // switch back to the saved FS selector
|
---|
348 | return rc;
|
---|
349 | }
|
---|
350 | //******************************************************************************
|
---|
351 | //TODO: FontEnumdwFlagsEx, script, font signature & NEWTEXTMETRICEX (last part)
|
---|
352 | //******************************************************************************
|
---|
353 | int EXPENTRY_O32 EnumFontProcExW(LPENUMLOGFONTA lpLogFont, LPNEWTEXTMETRICA lpTextM,
|
---|
354 | DWORD arg3, LPARAM arg4)
|
---|
355 | {
|
---|
356 | ENUMUSERDATA *lpEnumData = (ENUMUSERDATA *)arg4;
|
---|
357 | FONTENUMPROCEXW proc = (FONTENUMPROCEXW)lpEnumData->userProc;
|
---|
358 | ENUMLOGFONTEXW LogFont;
|
---|
359 | NEWTEXTMETRICEXW textM;
|
---|
360 | int rc;
|
---|
361 |
|
---|
362 | memcpy(&LogFont, lpLogFont, ((ULONG)&LogFont.elfLogFont.lfFaceName - (ULONG)&LogFont));
|
---|
363 | memset(LogFont.elfScript, 0, sizeof(LogFont.elfScript));
|
---|
364 | AsciiToUnicodeN(lpLogFont->elfLogFont.lfFaceName, LogFont.elfLogFont.lfFaceName, LF_FACESIZE-1);
|
---|
365 | AsciiToUnicodeN((char *) lpLogFont->elfFullName, LogFont.elfFullName, LF_FULLFACESIZE-1);
|
---|
366 | AsciiToUnicodeN((char *) lpLogFont->elfStyle, LogFont.elfStyle, LF_FACESIZE-1);
|
---|
367 |
|
---|
368 | textM.ntmetm.tmHeight = lpTextM->tmHeight;
|
---|
369 | textM.ntmetm.tmAscent = lpTextM->tmAscent;
|
---|
370 | textM.ntmetm.tmDescent = lpTextM->tmDescent;
|
---|
371 | textM.ntmetm.tmInternalLeading = lpTextM->tmInternalLeading;
|
---|
372 | textM.ntmetm.tmExternalLeading = lpTextM->tmExternalLeading;
|
---|
373 | textM.ntmetm.tmAveCharWidth = lpTextM->tmAveCharWidth;
|
---|
374 | textM.ntmetm.tmMaxCharWidth = lpTextM->tmMaxCharWidth;
|
---|
375 | textM.ntmetm.tmWeight = lpTextM->tmWeight;
|
---|
376 | textM.ntmetm.tmOverhang = lpTextM->tmOverhang;
|
---|
377 | textM.ntmetm.tmDigitizedAspectX = lpTextM->tmDigitizedAspectX;
|
---|
378 | textM.ntmetm.tmDigitizedAspectY = lpTextM->tmDigitizedAspectY;
|
---|
379 | textM.ntmetm.tmFirstChar = lpTextM->tmFirstChar;
|
---|
380 | textM.ntmetm.tmLastChar = lpTextM->tmLastChar;
|
---|
381 | textM.ntmetm.tmDefaultChar = lpTextM->tmDefaultChar;
|
---|
382 | textM.ntmetm.tmBreakChar = lpTextM->tmBreakChar;
|
---|
383 | textM.ntmetm.tmItalic = lpTextM->tmItalic;
|
---|
384 | textM.ntmetm.tmUnderlined = lpTextM->tmUnderlined;
|
---|
385 | textM.ntmetm.tmStruckOut = lpTextM->tmStruckOut;
|
---|
386 | textM.ntmetm.tmPitchAndFamily = lpTextM->tmPitchAndFamily;
|
---|
387 | textM.ntmetm.tmCharSet = lpTextM->tmCharSet;
|
---|
388 | textM.ntmetm.ntmFlags = 0;
|
---|
389 | textM.ntmetm.ntmSizeEM = 0;
|
---|
390 | textM.ntmetm.ntmCellHeight = 0;
|
---|
391 | textM.ntmetm.ntmAvgWidth = 0;
|
---|
392 | memset(&textM.ntmeFontSignature, 0, sizeof(textM.ntmeFontSignature));
|
---|
393 |
|
---|
394 | dprintf(("EnumFontProcExW %s", lpLogFont->elfLogFont.lfFaceName));
|
---|
395 | return proc(&LogFont, &textM, arg3, lpEnumData->userData);
|
---|
396 | }
|
---|
397 | //******************************************************************************
|
---|
398 | //******************************************************************************
|
---|
399 | int WIN32API EnumFontsA( HDC arg1, LPCSTR arg2, FONTENUMPROCA arg3, LPARAM arg4)
|
---|
400 | {
|
---|
401 | return EnumFontFamiliesA(arg1, arg2, arg3, arg4);
|
---|
402 | }
|
---|
403 | //******************************************************************************
|
---|
404 | //******************************************************************************
|
---|
405 | int WIN32API EnumFontsW( HDC arg1, LPCWSTR arg2, FONTENUMPROCW arg3, LPARAM arg4)
|
---|
406 | {
|
---|
407 | return EnumFontFamiliesW(arg1, arg2, arg3, arg4);
|
---|
408 | }
|
---|
409 | //******************************************************************************
|
---|
410 | //******************************************************************************
|
---|
411 | int WIN32API EnumFontFamiliesA(HDC arg1,
|
---|
412 | LPCSTR arg2,
|
---|
413 | FONTENUMPROCA arg3,
|
---|
414 | LPARAM arg4)
|
---|
415 | {
|
---|
416 | ENUMUSERDATA enumData;
|
---|
417 | int rc;
|
---|
418 |
|
---|
419 | dprintf(("GDI32: EnumFontFamiliesA %s", arg2));
|
---|
420 |
|
---|
421 | enumData.userProc = (DWORD)arg3;
|
---|
422 | enumData.userData = arg4;
|
---|
423 |
|
---|
424 | rc = O32_EnumFontFamilies(arg1, arg2, &EnumFontProcA, (LPARAM)&enumData);
|
---|
425 |
|
---|
426 | return rc;
|
---|
427 | }
|
---|
428 | //******************************************************************************
|
---|
429 | //******************************************************************************
|
---|
430 | int WIN32API EnumFontFamiliesW(HDC arg1,
|
---|
431 | LPCWSTR arg2,
|
---|
432 | FONTENUMPROCW arg3,
|
---|
433 | LPARAM arg4)
|
---|
434 | {
|
---|
435 | ENUMUSERDATA enumData;
|
---|
436 | int rc;
|
---|
437 | char *astring = UnicodeToAsciiString((LPWSTR)arg2);
|
---|
438 |
|
---|
439 | dprintf(("GDI32: EnumFontFamiliesW %s", astring));
|
---|
440 |
|
---|
441 | enumData.userProc = (DWORD)arg3;
|
---|
442 | enumData.userData = arg4;
|
---|
443 |
|
---|
444 | rc = O32_EnumFontFamilies(arg1, astring, &EnumFontProcW, (LPARAM)&enumData);
|
---|
445 |
|
---|
446 | FreeAsciiString(astring);
|
---|
447 | return rc;
|
---|
448 | }
|
---|
449 | //******************************************************************************
|
---|
450 | //******************************************************************************
|
---|
451 | INT WIN32API EnumFontFamiliesExA( HDC arg1, LPLOGFONTA arg2, FONTENUMPROCEXA arg3, LPARAM arg4, DWORD dwFlags)
|
---|
452 | {
|
---|
453 | ENUMUSERDATA enumData;
|
---|
454 | int rc;
|
---|
455 |
|
---|
456 | dprintf(("GDI32: EnumFontFamiliesExA not complete %s", arg2->lfFaceName));
|
---|
457 |
|
---|
458 | enumData.userProc = (DWORD)arg3;
|
---|
459 | enumData.userData = arg4;
|
---|
460 | enumData.dwFlags = dwFlags;
|
---|
461 |
|
---|
462 | rc = O32_EnumFontFamilies(arg1, arg2->lfFaceName, &EnumFontProcExA, (LPARAM)&enumData);
|
---|
463 |
|
---|
464 | return rc;
|
---|
465 | }
|
---|
466 | //******************************************************************************
|
---|
467 | //******************************************************************************
|
---|
468 | INT WIN32API EnumFontFamiliesExW( HDC arg1, LPLOGFONTW arg2, FONTENUMPROCEXW arg3, LPARAM arg4, DWORD dwFlags)
|
---|
469 | {
|
---|
470 | ENUMUSERDATA enumData;
|
---|
471 | int rc;
|
---|
472 | char *astring = UnicodeToAsciiString((LPWSTR)arg2->lfFaceName);
|
---|
473 |
|
---|
474 | dprintf(("GDI32: EnumFontFamiliesExW not complete %s", astring));
|
---|
475 |
|
---|
476 | enumData.userProc = (DWORD)arg3;
|
---|
477 | enumData.userData = arg4;
|
---|
478 | enumData.dwFlags = dwFlags;
|
---|
479 |
|
---|
480 | rc = O32_EnumFontFamilies(arg1, astring, &EnumFontProcExW, (LPARAM)&enumData);
|
---|
481 |
|
---|
482 | FreeAsciiString(astring);
|
---|
483 | return rc;
|
---|
484 | }
|
---|
485 | //******************************************************************************
|
---|
486 | //******************************************************************************
|
---|
487 | DWORD WIN32API GetFontData(HDC hdc, DWORD dwTable, DWORD dwOffset, LPVOID lpvBuffer,
|
---|
488 | DWORD dbData)
|
---|
489 | {
|
---|
490 | dprintf(("GDI32: GetFontData, not implemented (GDI_ERROR)\n"));
|
---|
491 | return(GDI_ERROR);
|
---|
492 | }
|
---|
493 | //******************************************************************************
|
---|
494 | //******************************************************************************
|
---|
495 | int WIN32API AddFontResourceA( LPCSTR szFont)
|
---|
496 | {
|
---|
497 | dprintf(("GDI32: AddFontResourceA %s", szFont));
|
---|
498 | return O32_AddFontResource(szFont);
|
---|
499 | }
|
---|
500 | //******************************************************************************
|
---|
501 | //******************************************************************************
|
---|
502 | int WIN32API AddFontResourceW( LPCWSTR szFont)
|
---|
503 | {
|
---|
504 | char *astring = UnicodeToAsciiString((LPWSTR)szFont);
|
---|
505 | BOOL rc;
|
---|
506 |
|
---|
507 | dprintf(("GDI32: AddFontResourceW"));
|
---|
508 | // NOTE: This will not work as is (needs UNICODE support)
|
---|
509 | rc = AddFontResourceA(astring);
|
---|
510 | FreeAsciiString(astring);
|
---|
511 | return rc;
|
---|
512 | }
|
---|
513 | //******************************************************************************
|
---|
514 | //******************************************************************************
|
---|
515 | BOOL WIN32API RemoveFontResourceA( LPCSTR arg1)
|
---|
516 | {
|
---|
517 | dprintf(("GDI32: RemoveFontResourceA %s\n", arg1));
|
---|
518 | return O32_RemoveFontResource(arg1);
|
---|
519 | }
|
---|
520 | //******************************************************************************
|
---|
521 | //******************************************************************************
|
---|
522 | BOOL WIN32API RemoveFontResourceW(LPCWSTR szFont)
|
---|
523 | {
|
---|
524 | char *astring = UnicodeToAsciiString((LPWSTR)szFont);
|
---|
525 | BOOL rc;
|
---|
526 |
|
---|
527 | dprintf(("GDI32: RemoveFontResourceW"));
|
---|
528 | rc = RemoveFontResourceA(astring);
|
---|
529 | FreeAsciiString(astring);
|
---|
530 | return(rc);
|
---|
531 | }
|
---|
532 | /*****************************************************************************
|
---|
533 | * Name : BOOL CreateScalableFontResourceA
|
---|
534 | * Purpose : The CreateScalableFontResourceA function creates a font resource
|
---|
535 | * file for a scalable font.
|
---|
536 | * Parameters: DWORD fdwHidden flag for read-only embedded font
|
---|
537 | * LPCSTR lpszFontRes address of filename for font resource
|
---|
538 | * LPCSTR lpszFontFile address of filename for scalable font
|
---|
539 | * LPCSTR lpszCurrentPath address of path to font file
|
---|
540 | * Variables :
|
---|
541 | * Result : TRUE / FALSE
|
---|
542 | * Remark :
|
---|
543 | * Status : UNTESTED STUB
|
---|
544 | *
|
---|
545 | * Author : Patrick Haller [Mon, 1998/06/15 08:00]
|
---|
546 | *****************************************************************************/
|
---|
547 |
|
---|
548 | BOOL WIN32API CreateScalableFontResourceA(DWORD fdwHidden,
|
---|
549 | LPCSTR lpszFontRes,
|
---|
550 | LPCSTR lpszFontFile,
|
---|
551 | LPCSTR lpszCurrentPath)
|
---|
552 | {
|
---|
553 | dprintf(("GDI32: CreateScalableFontResourceA(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
554 | fdwHidden,
|
---|
555 | lpszFontRes,
|
---|
556 | lpszFontFile,
|
---|
557 | lpszCurrentPath));
|
---|
558 |
|
---|
559 | return (FALSE);
|
---|
560 | }
|
---|
561 |
|
---|
562 |
|
---|
563 | /*****************************************************************************
|
---|
564 | * Name : BOOL CreateScalableFontResourceW
|
---|
565 | * Purpose : The CreateScalableFontResourceW function creates a font resource
|
---|
566 | * file for a scalable font.
|
---|
567 | * Parameters: DWORD fdwHidden flag for read-only embedded font
|
---|
568 | * LPCSTR lpszFontRes address of filename for font resource
|
---|
569 | * LPCSTR lpszFontFile address of filename for scalable font
|
---|
570 | * LPCSTR lpszCurrentPath address of path to font file
|
---|
571 | * Variables :
|
---|
572 | * Result : TRUE / FALSE
|
---|
573 | * Remark :
|
---|
574 | * Status : UNTESTED STUB
|
---|
575 | *
|
---|
576 | * Author : Patrick Haller [Mon, 1998/06/15 08:00]
|
---|
577 | *****************************************************************************/
|
---|
578 |
|
---|
579 | BOOL WIN32API CreateScalableFontResourceW(DWORD fdwHidden,
|
---|
580 | LPCWSTR lpszFontRes,
|
---|
581 | LPCWSTR lpszFontFile,
|
---|
582 | LPCWSTR lpszCurrentPath)
|
---|
583 | {
|
---|
584 | dprintf(("GDI32: CreateScalableFontResourceW(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
585 | fdwHidden,
|
---|
586 | lpszFontRes,
|
---|
587 | lpszFontFile,
|
---|
588 | lpszCurrentPath));
|
---|
589 |
|
---|
590 | return (FALSE);
|
---|
591 | }
|
---|
592 | /*****************************************************************************
|
---|
593 | * Name : DWORD GetFontLanguageInfo
|
---|
594 | * Purpose : The GetFontLanguageInfo function returns information about the
|
---|
595 | * currently selected font for the specified display context.
|
---|
596 | * Applications typically use this information and the
|
---|
597 | * GetCharacterPlacement function to prepare a character string for display.
|
---|
598 | * Parameters: HDC hdc handle to device context
|
---|
599 | * Variables :
|
---|
600 | * Result :
|
---|
601 | * Remark :
|
---|
602 | * Status : UNTESTED STUB
|
---|
603 | *
|
---|
604 | * Author : Patrick Haller [Mon, 1998/06/15 08:00]
|
---|
605 | *****************************************************************************/
|
---|
606 |
|
---|
607 | DWORD WIN32API GetFontLanguageInfo(HDC hdc)
|
---|
608 | {
|
---|
609 | dprintf(("GDI32: GetFontLanguageInfo(%08xh) not implemented.\n",
|
---|
610 | hdc));
|
---|
611 |
|
---|
612 | return (0);
|
---|
613 | }
|
---|
614 | /*************************************************************************
|
---|
615 | * TranslateCharsetInfo [GDI32.382]
|
---|
616 | *
|
---|
617 | * Fills a CHARSETINFO structure for a character set, code page, or
|
---|
618 | * font. This allows making the correspondance between different labelings
|
---|
619 | * (character set, Windows, ANSI, and OEM codepages, and Unicode ranges)
|
---|
620 | * of the same encoding.
|
---|
621 | *
|
---|
622 | * Only one codepage will be set in lpCs->fs. If TCI_SRCFONTSIG is used,
|
---|
623 | * only one codepage should be set in *lpSrc.
|
---|
624 | *
|
---|
625 | * RETURNS
|
---|
626 | * TRUE on success, FALSE on failure.
|
---|
627 | *
|
---|
628 | */
|
---|
629 | BOOL WIN32API TranslateCharsetInfo(
|
---|
630 | LPDWORD lpSrc, /*
|
---|
631 | if flags == TCI_SRCFONTSIG: pointer to fsCsb of a FONTSIGNATURE
|
---|
632 | if flags == TCI_SRCCHARSET: a character set value
|
---|
633 | if flags == TCI_SRCCODEPAGE: a code page value
|
---|
634 | */
|
---|
635 | LPCHARSETINFO lpCs, /* structure to receive charset information */
|
---|
636 | DWORD flags /* determines interpretation of lpSrc */
|
---|
637 | ) {
|
---|
638 | int index = 0;
|
---|
639 | switch (flags) {
|
---|
640 | case TCI_SRCFONTSIG:
|
---|
641 | while (!(*lpSrc>>index & 0x0001) && index<MAXTCIINDEX) index++;
|
---|
642 | break;
|
---|
643 | case TCI_SRCCODEPAGE:
|
---|
644 | while ((UINT) (lpSrc) != FONT_tci[index].ciACP && index < MAXTCIINDEX) index++;
|
---|
645 | break;
|
---|
646 | case TCI_SRCCHARSET:
|
---|
647 | while ((UINT) (lpSrc) != FONT_tci[index].ciCharset && index < MAXTCIINDEX) index++;
|
---|
648 | break;
|
---|
649 | default:
|
---|
650 | return FALSE;
|
---|
651 | }
|
---|
652 | if (index >= MAXTCIINDEX || FONT_tci[index].ciCharset == DEFAULT_CHARSET) return FALSE;
|
---|
653 | memcpy(lpCs, &FONT_tci[index], sizeof(CHARSETINFO));
|
---|
654 | return TRUE;
|
---|
655 | }
|
---|
656 | //******************************************************************************
|
---|
657 | //******************************************************************************
|
---|