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

Last change on this file since 2802 was 2802, checked in by sandervl, 26 years ago

Added new logging feature

File size: 23.8 KB
Line 
1/* $Id: font.cpp,v 1.9 2000-02-16 14:18:09 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 = %s -> %s\n", 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 UnicodeToAsciiN((WCHAR *)lplf->lfFaceName, afont.lfFaceName, LF_FACESIZE-1);
260 hfont = CreateFontIndirectA(&afont);
261 return(hfont);
262}
263//******************************************************************************
264//******************************************************************************
265int EXPENTRY_O32 EnumFontProcA(LPENUMLOGFONTA lpLogFont, LPNEWTEXTMETRICA
266 lpTextM, DWORD arg3, LPARAM arg4)
267{
268 ENUMUSERDATA *lpEnumData = (ENUMUSERDATA *)arg4;
269 FONTENUMPROCA proc = (FONTENUMPROCA)lpEnumData->userProc;
270
271 return proc(lpLogFont, lpTextM, arg3, lpEnumData->userData);
272}
273//******************************************************************************
274//******************************************************************************
275int EXPENTRY_O32 EnumFontProcW(LPENUMLOGFONTA lpLogFont, LPNEWTEXTMETRICA lpTextM,
276 DWORD arg3, LPARAM arg4)
277{
278 ENUMUSERDATA *lpEnumData = (ENUMUSERDATA *)arg4;
279 FONTENUMPROCW proc = (FONTENUMPROCW)lpEnumData->userProc;
280 ENUMLOGFONTW LogFont;
281 NEWTEXTMETRICW textM;
282 int rc;
283
284 memcpy(&LogFont, lpLogFont, ((ULONG)&LogFont.elfLogFont.lfFaceName -
285 (ULONG)&LogFont));
286 AsciiToUnicodeN(lpLogFont->elfLogFont.lfFaceName, LogFont.elfLogFont.lfFaceName, LF_FACESIZE-1);
287 AsciiToUnicodeN((char *) lpLogFont->elfFullName, LogFont.elfFullName, LF_FULLFACESIZE-1);
288 AsciiToUnicodeN((char *) lpLogFont->elfStyle, LogFont.elfStyle, LF_FACESIZE-1);
289
290 textM.tmHeight = lpTextM->tmHeight;
291 textM.tmAscent = lpTextM->tmAscent;
292 textM.tmDescent = lpTextM->tmDescent;
293 textM.tmInternalLeading = lpTextM->tmInternalLeading;
294 textM.tmExternalLeading = lpTextM->tmExternalLeading;
295 textM.tmAveCharWidth = lpTextM->tmAveCharWidth;
296 textM.tmMaxCharWidth = lpTextM->tmMaxCharWidth;
297 textM.tmWeight = lpTextM->tmWeight;
298 textM.tmOverhang = lpTextM->tmOverhang;
299 textM.tmDigitizedAspectX = lpTextM->tmDigitizedAspectX;
300 textM.tmDigitizedAspectY = lpTextM->tmDigitizedAspectY;
301 textM.tmFirstChar = lpTextM->tmFirstChar;
302 textM.tmLastChar = lpTextM->tmLastChar;
303 textM.tmDefaultChar = lpTextM->tmDefaultChar;
304 textM.tmBreakChar = lpTextM->tmBreakChar;
305 textM.tmItalic = lpTextM->tmItalic;
306 textM.tmUnderlined = lpTextM->tmUnderlined;
307 textM.tmStruckOut = lpTextM->tmStruckOut;
308 textM.tmPitchAndFamily = lpTextM->tmPitchAndFamily;
309 textM.tmCharSet = lpTextM->tmCharSet;
310 textM.ntmFlags = 0;
311 textM.ntmSizeEM = 0;
312 textM.ntmCellHeight = 0;
313 textM.ntmAvgWidth = 0;
314
315 return proc(&LogFont, &textM, arg3, lpEnumData->userData);
316}
317//******************************************************************************
318//TODO: FontEnumdwFlagsEx, script, font signature & NEWTEXTMETRICEX (last part)
319//******************************************************************************
320int EXPENTRY_O32 EnumFontProcExA(LPENUMLOGFONTA lpLogFont, LPNEWTEXTMETRICA
321 lpTextM, DWORD arg3, LPARAM arg4)
322{
323 ENUMUSERDATA *lpEnumData = (ENUMUSERDATA *)arg4;
324 FONTENUMPROCEXA proc = (FONTENUMPROCEXA)lpEnumData->userProc;
325 ENUMLOGFONTEXA logFont;
326 NEWTEXTMETRICEXA textM;
327
328 memcpy(&logFont, lpLogFont, sizeof(ENUMLOGFONTA));
329 memset(logFont.elfScript, 0, sizeof(logFont.elfScript));
330 memcpy(&textM.ntmetm, lpTextM, sizeof(textM.ntmetm));
331 memset(&textM.ntmeFontSignature, 0, sizeof(textM.ntmeFontSignature));
332
333 dprintf(("EnumFontProcExA %s", logFont.elfLogFont.lfFaceName));
334 return proc(&logFont, &textM, arg3, lpEnumData->userData);
335}
336//******************************************************************************
337//TODO: FontEnumdwFlagsEx, script, font signature & NEWTEXTMETRICEX (last part)
338//******************************************************************************
339int EXPENTRY_O32 EnumFontProcExW(LPENUMLOGFONTA lpLogFont, LPNEWTEXTMETRICA lpTextM,
340 DWORD arg3, LPARAM arg4)
341{
342 ENUMUSERDATA *lpEnumData = (ENUMUSERDATA *)arg4;
343 FONTENUMPROCEXW proc = (FONTENUMPROCEXW)lpEnumData->userProc;
344 ENUMLOGFONTEXW LogFont;
345 NEWTEXTMETRICEXW textM;
346 int rc;
347
348 memcpy(&LogFont, lpLogFont, ((ULONG)&LogFont.elfLogFont.lfFaceName - (ULONG)&LogFont));
349 memset(LogFont.elfScript, 0, sizeof(LogFont.elfScript));
350 AsciiToUnicodeN(lpLogFont->elfLogFont.lfFaceName, LogFont.elfLogFont.lfFaceName, LF_FACESIZE-1);
351 AsciiToUnicodeN((char *) lpLogFont->elfFullName, LogFont.elfFullName, LF_FULLFACESIZE-1);
352 AsciiToUnicodeN((char *) lpLogFont->elfStyle, LogFont.elfStyle, LF_FACESIZE-1);
353
354 textM.ntmetm.tmHeight = lpTextM->tmHeight;
355 textM.ntmetm.tmAscent = lpTextM->tmAscent;
356 textM.ntmetm.tmDescent = lpTextM->tmDescent;
357 textM.ntmetm.tmInternalLeading = lpTextM->tmInternalLeading;
358 textM.ntmetm.tmExternalLeading = lpTextM->tmExternalLeading;
359 textM.ntmetm.tmAveCharWidth = lpTextM->tmAveCharWidth;
360 textM.ntmetm.tmMaxCharWidth = lpTextM->tmMaxCharWidth;
361 textM.ntmetm.tmWeight = lpTextM->tmWeight;
362 textM.ntmetm.tmOverhang = lpTextM->tmOverhang;
363 textM.ntmetm.tmDigitizedAspectX = lpTextM->tmDigitizedAspectX;
364 textM.ntmetm.tmDigitizedAspectY = lpTextM->tmDigitizedAspectY;
365 textM.ntmetm.tmFirstChar = lpTextM->tmFirstChar;
366 textM.ntmetm.tmLastChar = lpTextM->tmLastChar;
367 textM.ntmetm.tmDefaultChar = lpTextM->tmDefaultChar;
368 textM.ntmetm.tmBreakChar = lpTextM->tmBreakChar;
369 textM.ntmetm.tmItalic = lpTextM->tmItalic;
370 textM.ntmetm.tmUnderlined = lpTextM->tmUnderlined;
371 textM.ntmetm.tmStruckOut = lpTextM->tmStruckOut;
372 textM.ntmetm.tmPitchAndFamily = lpTextM->tmPitchAndFamily;
373 textM.ntmetm.tmCharSet = lpTextM->tmCharSet;
374 textM.ntmetm.ntmFlags = 0;
375 textM.ntmetm.ntmSizeEM = 0;
376 textM.ntmetm.ntmCellHeight = 0;
377 textM.ntmetm.ntmAvgWidth = 0;
378 memset(&textM.ntmeFontSignature, 0, sizeof(textM.ntmeFontSignature));
379
380 dprintf(("EnumFontProcExW %s", lpLogFont->elfLogFont.lfFaceName));
381 return proc(&LogFont, &textM, arg3, lpEnumData->userData);
382}
383//******************************************************************************
384//******************************************************************************
385int WIN32API EnumFontsA( HDC arg1, LPCSTR arg2, FONTENUMPROCA arg3, LPARAM arg4)
386{
387 return EnumFontFamiliesA(arg1, arg2, arg3, arg4);
388}
389//******************************************************************************
390//******************************************************************************
391int WIN32API EnumFontsW( HDC arg1, LPCWSTR arg2, FONTENUMPROCW arg3, LPARAM arg4)
392{
393 return EnumFontFamiliesW(arg1, arg2, arg3, arg4);
394}
395//******************************************************************************
396//******************************************************************************
397int WIN32API EnumFontFamiliesA(HDC arg1,
398 LPCSTR arg2,
399 FONTENUMPROCA arg3,
400 LPARAM arg4)
401{
402 ENUMUSERDATA enumData;
403 int rc;
404
405 dprintf(("GDI32: EnumFontFamiliesA %s", arg2));
406
407 enumData.userProc = (DWORD)arg3;
408 enumData.userData = arg4;
409
410 rc = O32_EnumFontFamilies(arg1, arg2, &EnumFontProcA, (LPARAM)&enumData);
411
412 return rc;
413}
414//******************************************************************************
415//******************************************************************************
416int WIN32API EnumFontFamiliesW(HDC arg1,
417 LPCWSTR arg2,
418 FONTENUMPROCW arg3,
419 LPARAM arg4)
420{
421 ENUMUSERDATA enumData;
422 int rc;
423 char *astring = UnicodeToAsciiString((LPWSTR)arg2);
424
425 dprintf(("GDI32: EnumFontFamiliesW %s", astring));
426
427 enumData.userProc = (DWORD)arg3;
428 enumData.userData = arg4;
429
430 rc = O32_EnumFontFamilies(arg1, astring, &EnumFontProcW, (LPARAM)&enumData);
431
432 FreeAsciiString(astring);
433 return rc;
434}
435//******************************************************************************
436//******************************************************************************
437INT WIN32API EnumFontFamiliesExA( HDC arg1, LPLOGFONTA arg2, FONTENUMPROCEXA arg3, LPARAM arg4, DWORD dwFlags)
438{
439 ENUMUSERDATA enumData;
440 int rc;
441
442 dprintf(("GDI32: EnumFontFamiliesExA not complete %s", arg2->lfFaceName));
443
444 enumData.userProc = (DWORD)arg3;
445 enumData.userData = arg4;
446 enumData.dwFlags = dwFlags;
447
448 rc = O32_EnumFontFamilies(arg1, arg2->lfFaceName, &EnumFontProcExA, (LPARAM)&enumData);
449
450 return rc;
451}
452//******************************************************************************
453//******************************************************************************
454INT WIN32API EnumFontFamiliesExW( HDC arg1, LPLOGFONTW arg2, FONTENUMPROCEXW arg3, LPARAM arg4, DWORD dwFlags)
455{
456 ENUMUSERDATA enumData;
457 int rc;
458 char *astring = UnicodeToAsciiString((LPWSTR)arg2->lfFaceName);
459
460 dprintf(("GDI32: EnumFontFamiliesExW not complete %s", astring));
461
462 enumData.userProc = (DWORD)arg3;
463 enumData.userData = arg4;
464 enumData.dwFlags = dwFlags;
465
466 rc = O32_EnumFontFamilies(arg1, astring, &EnumFontProcExW, (LPARAM)&enumData);
467
468 FreeAsciiString(astring);
469 return rc;
470}
471//******************************************************************************
472//******************************************************************************
473DWORD WIN32API GetFontData(HDC hdc, DWORD dwTable, DWORD dwOffset, LPVOID lpvBuffer,
474 DWORD dbData)
475{
476 dprintf(("GDI32: GetFontData, not implemented (GDI_ERROR)\n"));
477 return(GDI_ERROR);
478}
479//******************************************************************************
480//******************************************************************************
481int WIN32API AddFontResourceA( LPCSTR arg1)
482{
483 dprintf(("GDI32: AddFontResourceA"));
484 return O32_AddFontResource(arg1);
485}
486//******************************************************************************
487//******************************************************************************
488int WIN32API AddFontResourceW( LPCWSTR arg1)
489{
490 dprintf(("GDI32: AddFontResourceW STUB"));
491 // NOTE: This will not work as is (needs UNICODE support)
492// return O32_AddFontResource(arg1);
493 return 0;
494}
495//******************************************************************************
496//******************************************************************************
497BOOL WIN32API RemoveFontResourceA( LPCSTR arg1)
498{
499 dprintf(("GDI32: RemoveFontResourceA %s\n", arg1));
500 return O32_RemoveFontResource(arg1);
501}
502//******************************************************************************
503//******************************************************************************
504BOOL WIN32API RemoveFontResourceW(LPCWSTR arg1)
505{
506 char *astring = UnicodeToAsciiString((LPWSTR)arg1);
507 BOOL rc;
508
509 dprintf(("GDI32: RemoveFontResourceW\n"));
510 rc = O32_RemoveFontResource(astring);
511 FreeAsciiString(astring);
512 return(rc);
513}
514/*****************************************************************************
515 * Name : BOOL CreateScalableFontResourceA
516 * Purpose : The CreateScalableFontResourceA function creates a font resource
517 * file for a scalable font.
518 * Parameters: DWORD fdwHidden flag for read-only embedded font
519 * LPCSTR lpszFontRes address of filename for font resource
520 * LPCSTR lpszFontFile address of filename for scalable font
521 * LPCSTR lpszCurrentPath address of path to font file
522 * Variables :
523 * Result : TRUE / FALSE
524 * Remark :
525 * Status : UNTESTED STUB
526 *
527 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
528 *****************************************************************************/
529
530BOOL WIN32API CreateScalableFontResourceA(DWORD fdwHidden,
531 LPCSTR lpszFontRes,
532 LPCSTR lpszFontFile,
533 LPCSTR lpszCurrentPath)
534{
535 dprintf(("GDI32: CreateScalableFontResourceA(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
536 fdwHidden,
537 lpszFontRes,
538 lpszFontFile,
539 lpszCurrentPath));
540
541 return (FALSE);
542}
543
544
545/*****************************************************************************
546 * Name : BOOL CreateScalableFontResourceW
547 * Purpose : The CreateScalableFontResourceW function creates a font resource
548 * file for a scalable font.
549 * Parameters: DWORD fdwHidden flag for read-only embedded font
550 * LPCSTR lpszFontRes address of filename for font resource
551 * LPCSTR lpszFontFile address of filename for scalable font
552 * LPCSTR lpszCurrentPath address of path to font file
553 * Variables :
554 * Result : TRUE / FALSE
555 * Remark :
556 * Status : UNTESTED STUB
557 *
558 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
559 *****************************************************************************/
560
561BOOL WIN32API CreateScalableFontResourceW(DWORD fdwHidden,
562 LPCWSTR lpszFontRes,
563 LPCWSTR lpszFontFile,
564 LPCWSTR lpszCurrentPath)
565{
566 dprintf(("GDI32: CreateScalableFontResourceW(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
567 fdwHidden,
568 lpszFontRes,
569 lpszFontFile,
570 lpszCurrentPath));
571
572 return (FALSE);
573}
574/*****************************************************************************
575 * Name : DWORD GetFontLanguageInfo
576 * Purpose : The GetFontLanguageInfo function returns information about the
577 * currently selected font for the specified display context.
578 * Applications typically use this information and the
579 * GetCharacterPlacement function to prepare a character string for display.
580 * Parameters: HDC hdc handle to device context
581 * Variables :
582 * Result :
583 * Remark :
584 * Status : UNTESTED STUB
585 *
586 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
587 *****************************************************************************/
588
589DWORD WIN32API GetFontLanguageInfo(HDC hdc)
590{
591 dprintf(("GDI32: GetFontLanguageInfo(%08xh) not implemented.\n",
592 hdc));
593
594 return (0);
595}
596/*************************************************************************
597 * TranslateCharsetInfo [GDI32.382]
598 *
599 * Fills a CHARSETINFO structure for a character set, code page, or
600 * font. This allows making the correspondance between different labelings
601 * (character set, Windows, ANSI, and OEM codepages, and Unicode ranges)
602 * of the same encoding.
603 *
604 * Only one codepage will be set in lpCs->fs. If TCI_SRCFONTSIG is used,
605 * only one codepage should be set in *lpSrc.
606 *
607 * RETURNS
608 * TRUE on success, FALSE on failure.
609 *
610 */
611BOOL WIN32API TranslateCharsetInfo(
612 LPDWORD lpSrc, /*
613 if flags == TCI_SRCFONTSIG: pointer to fsCsb of a FONTSIGNATURE
614 if flags == TCI_SRCCHARSET: a character set value
615 if flags == TCI_SRCCODEPAGE: a code page value
616 */
617 LPCHARSETINFO lpCs, /* structure to receive charset information */
618 DWORD flags /* determines interpretation of lpSrc */
619) {
620 int index = 0;
621 switch (flags) {
622 case TCI_SRCFONTSIG:
623 while (!(*lpSrc>>index & 0x0001) && index<MAXTCIINDEX) index++;
624 break;
625 case TCI_SRCCODEPAGE:
626 while ((UINT) (lpSrc) != FONT_tci[index].ciACP && index < MAXTCIINDEX) index++;
627 break;
628 case TCI_SRCCHARSET:
629 while ((UINT) (lpSrc) != FONT_tci[index].ciCharset && index < MAXTCIINDEX) index++;
630 break;
631 default:
632 return FALSE;
633 }
634 if (index >= MAXTCIINDEX || FONT_tci[index].ciCharset == DEFAULT_CHARSET) return FALSE;
635 memcpy(lpCs, &FONT_tci[index], sizeof(CHARSETINFO));
636 return TRUE;
637}
638//******************************************************************************
639//******************************************************************************
Note: See TracBrowser for help on using the repository browser.