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