source: trunk/src/gdi32/font.cpp@ 3481

Last change on this file since 3481 was 3481, checked in by sandervl, 25 years ago

added extra logging

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