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