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