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

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

strncpy call changes

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