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

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

AddFontResourceW implemented

File size: 24.0 KB
Line 
1/* $Id: font.cpp,v 1.13 2000-10-01 12:06:32 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 szFont)
485{
486 dprintf(("GDI32: AddFontResourceA %s", szFont));
487 return O32_AddFontResource(szFont);
488}
489//******************************************************************************
490//******************************************************************************
491int WIN32API AddFontResourceW( LPCWSTR szFont)
492{
493 char *astring = UnicodeToAsciiString((LPWSTR)szFont);
494 BOOL rc;
495
496 dprintf(("GDI32: AddFontResourceW"));
497 // NOTE: This will not work as is (needs UNICODE support)
498 rc = AddFontResourceA(astring);
499 FreeAsciiString(astring);
500 return rc;
501}
502//******************************************************************************
503//******************************************************************************
504BOOL WIN32API RemoveFontResourceA( LPCSTR arg1)
505{
506 dprintf(("GDI32: RemoveFontResourceA %s\n", arg1));
507 return O32_RemoveFontResource(arg1);
508}
509//******************************************************************************
510//******************************************************************************
511BOOL WIN32API RemoveFontResourceW(LPCWSTR szFont)
512{
513 char *astring = UnicodeToAsciiString((LPWSTR)szFont);
514 BOOL rc;
515
516 dprintf(("GDI32: RemoveFontResourceW"));
517 rc = RemoveFontResourceA(astring);
518 FreeAsciiString(astring);
519 return(rc);
520}
521/*****************************************************************************
522 * Name : BOOL CreateScalableFontResourceA
523 * Purpose : The CreateScalableFontResourceA function creates a font resource
524 * file for a scalable font.
525 * Parameters: DWORD fdwHidden flag for read-only embedded font
526 * LPCSTR lpszFontRes address of filename for font resource
527 * LPCSTR lpszFontFile address of filename for scalable font
528 * LPCSTR lpszCurrentPath address of path to font file
529 * Variables :
530 * Result : TRUE / FALSE
531 * Remark :
532 * Status : UNTESTED STUB
533 *
534 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
535 *****************************************************************************/
536
537BOOL WIN32API CreateScalableFontResourceA(DWORD fdwHidden,
538 LPCSTR lpszFontRes,
539 LPCSTR lpszFontFile,
540 LPCSTR lpszCurrentPath)
541{
542 dprintf(("GDI32: CreateScalableFontResourceA(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
543 fdwHidden,
544 lpszFontRes,
545 lpszFontFile,
546 lpszCurrentPath));
547
548 return (FALSE);
549}
550
551
552/*****************************************************************************
553 * Name : BOOL CreateScalableFontResourceW
554 * Purpose : The CreateScalableFontResourceW function creates a font resource
555 * file for a scalable font.
556 * Parameters: DWORD fdwHidden flag for read-only embedded font
557 * LPCSTR lpszFontRes address of filename for font resource
558 * LPCSTR lpszFontFile address of filename for scalable font
559 * LPCSTR lpszCurrentPath address of path to font file
560 * Variables :
561 * Result : TRUE / FALSE
562 * Remark :
563 * Status : UNTESTED STUB
564 *
565 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
566 *****************************************************************************/
567
568BOOL WIN32API CreateScalableFontResourceW(DWORD fdwHidden,
569 LPCWSTR lpszFontRes,
570 LPCWSTR lpszFontFile,
571 LPCWSTR lpszCurrentPath)
572{
573 dprintf(("GDI32: CreateScalableFontResourceW(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
574 fdwHidden,
575 lpszFontRes,
576 lpszFontFile,
577 lpszCurrentPath));
578
579 return (FALSE);
580}
581/*****************************************************************************
582 * Name : DWORD GetFontLanguageInfo
583 * Purpose : The GetFontLanguageInfo function returns information about the
584 * currently selected font for the specified display context.
585 * Applications typically use this information and the
586 * GetCharacterPlacement function to prepare a character string for display.
587 * Parameters: HDC hdc handle to device context
588 * Variables :
589 * Result :
590 * Remark :
591 * Status : UNTESTED STUB
592 *
593 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
594 *****************************************************************************/
595
596DWORD WIN32API GetFontLanguageInfo(HDC hdc)
597{
598 dprintf(("GDI32: GetFontLanguageInfo(%08xh) not implemented.\n",
599 hdc));
600
601 return (0);
602}
603/*************************************************************************
604 * TranslateCharsetInfo [GDI32.382]
605 *
606 * Fills a CHARSETINFO structure for a character set, code page, or
607 * font. This allows making the correspondance between different labelings
608 * (character set, Windows, ANSI, and OEM codepages, and Unicode ranges)
609 * of the same encoding.
610 *
611 * Only one codepage will be set in lpCs->fs. If TCI_SRCFONTSIG is used,
612 * only one codepage should be set in *lpSrc.
613 *
614 * RETURNS
615 * TRUE on success, FALSE on failure.
616 *
617 */
618BOOL WIN32API TranslateCharsetInfo(
619 LPDWORD lpSrc, /*
620 if flags == TCI_SRCFONTSIG: pointer to fsCsb of a FONTSIGNATURE
621 if flags == TCI_SRCCHARSET: a character set value
622 if flags == TCI_SRCCODEPAGE: a code page value
623 */
624 LPCHARSETINFO lpCs, /* structure to receive charset information */
625 DWORD flags /* determines interpretation of lpSrc */
626) {
627 int index = 0;
628 switch (flags) {
629 case TCI_SRCFONTSIG:
630 while (!(*lpSrc>>index & 0x0001) && index<MAXTCIINDEX) index++;
631 break;
632 case TCI_SRCCODEPAGE:
633 while ((UINT) (lpSrc) != FONT_tci[index].ciACP && index < MAXTCIINDEX) index++;
634 break;
635 case TCI_SRCCHARSET:
636 while ((UINT) (lpSrc) != FONT_tci[index].ciCharset && index < MAXTCIINDEX) index++;
637 break;
638 default:
639 return FALSE;
640 }
641 if (index >= MAXTCIINDEX || FONT_tci[index].ciCharset == DEFAULT_CHARSET) return FALSE;
642 memcpy(lpCs, &FONT_tci[index], sizeof(CHARSETINFO));
643 return TRUE;
644}
645//******************************************************************************
646//******************************************************************************
Note: See TracBrowser for help on using the repository browser.