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

Last change on this file since 1982 was 1982, checked in by phaller, 26 years ago

Fix: CreateFontAW macros, so we can compile font.cpp as RELEASE

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