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

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

font changes + fixes

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