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

Last change on this file since 5655 was 5585, checked in by sandervl, 24 years ago

DBCS fix

File size: 25.1 KB
Line 
1/* $Id: font.cpp,v 1.18 2001-04-25 20:53:02 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/*****************************************************************************
22 * Includes *
23 *****************************************************************************/
24
25#include <odin.h>
26#include <odinwrap.h>
27#include <os2sel.h>
28
29#include <os2win.h>
30#include <stdlib.h>
31#include <stdarg.h>
32#include <ctype.h>
33#include <string.h>
34#include "misc.h"
35#include "unicode.h"
36#include <heapstring.h>
37#include <win\options.h>
38#include <wprocess.h>
39#include <odininst.h>
40
41#define DBG_LOCALLOG DBG_font
42#include "dbglocal.h"
43
44ODINDEBUGCHANNEL(GDI32-FONT)
45
46
47typedef struct {
48 DWORD userProc;
49 DWORD userData;
50 DWORD dwFlags;
51} ENUMUSERDATA;
52
53/*
54 * For TranslateCharsetInfo
55 */
56#define FS(x) {{0,0,0,0},{0x1<<(x),0}}
57#define MAXTCIINDEX 32
58static CHARSETINFO FONT_tci[MAXTCIINDEX] = {
59 /* ANSI */
60 { ANSI_CHARSET, 1252, FS(0)},
61 { EASTEUROPE_CHARSET, 1250, FS(1)},
62 { RUSSIAN_CHARSET, 1251, FS(2)},
63 { GREEK_CHARSET, 1253, FS(3)},
64 { TURKISH_CHARSET, 1254, FS(4)},
65 { HEBREW_CHARSET, 1255, FS(5)},
66 { ARABIC_CHARSET, 1256, FS(6)},
67 { BALTIC_CHARSET, 1257, FS(7)},
68 /* reserved by ANSI */
69 { DEFAULT_CHARSET, 0, FS(0)},
70 { DEFAULT_CHARSET, 0, FS(0)},
71 { DEFAULT_CHARSET, 0, FS(0)},
72 { DEFAULT_CHARSET, 0, FS(0)},
73 { DEFAULT_CHARSET, 0, FS(0)},
74 { DEFAULT_CHARSET, 0, FS(0)},
75 { DEFAULT_CHARSET, 0, FS(0)},
76 { DEFAULT_CHARSET, 0, FS(0)},
77 /* ANSI and OEM */
78 { THAI_CHARSET, 874, FS(16)},
79 { SHIFTJIS_CHARSET, 932, FS(17)},
80 { GB2312_CHARSET, 936, FS(18)},
81 { HANGEUL_CHARSET, 949, FS(19)},
82 { CHINESEBIG5_CHARSET, 950, FS(20)},
83 { JOHAB_CHARSET, 1361, FS(21)},
84 /* reserved for alternate ANSI and OEM */
85 { DEFAULT_CHARSET, 0, FS(0)},
86 { DEFAULT_CHARSET, 0, FS(0)},
87 { DEFAULT_CHARSET, 0, FS(0)},
88 { DEFAULT_CHARSET, 0, FS(0)},
89 { DEFAULT_CHARSET, 0, FS(0)},
90 { DEFAULT_CHARSET, 0, FS(0)},
91 { DEFAULT_CHARSET, 0, FS(0)},
92 { DEFAULT_CHARSET, 0, FS(0)},
93 /* reserved for system */
94 { DEFAULT_CHARSET, 0, FS(0)},
95 { DEFAULT_CHARSET, 0, FS(0)},
96};
97
98/*****************************************************************************
99 * Name : static void iFontRename
100 * Purpose : font remapping table to map win32 fonts to OS/2 pendants
101 * Parameters: LPSTR lpstrFaceOriginal - the win32 face name
102 * LPSTR lpstrFaceBuffer - [LF_FACESIZE] buffer to new name
103 * Variables :
104 * Result :
105 * Remark : remapped name is passed back in the buffer
106 * if no mapping pendant is available, return input parameter
107 * as default.
108 * Status :
109 *
110 * Author : Patrick Haller [Fri, 1998/06/12 03:44]
111 *****************************************************************************/
112
113static void iFontRename(LPCSTR lpstrFaceOriginal,
114 LPSTR lpstrFaceTemp)
115{
116 int iRet;
117
118 // NULL is a valid parameter
119 if (lpstrFaceOriginal == NULL)
120 return;
121
122 strncpy(lpstrFaceTemp, lpstrFaceOriginal, LF_FACESIZE);
123 lpstrFaceTemp[LF_FACESIZE-1] = 0;
124
125 {
126 char *y = lpstrFaceTemp;
127 while(*y) {
128 if(IsDBCSLeadByte( *y )) {
129 y += 2; // DBCS skip
130 } else {
131 *y = toupper( *y );
132 y++;
133 }
134 }
135 }
136
137 //lookup table
138 iRet = PROFILE_GetOdinIniString(ODINFONTSECTION,
139 lpstrFaceTemp,
140 lpstrFaceOriginal,
141 lpstrFaceTemp,
142 LF_FACESIZE);
143}
144
145
146//******************************************************************************
147//******************************************************************************
148ODINFUNCTIONNODBG14(HFONT, CreateFontA, int, nHeight,
149 int, nWidth,
150 int, nEscapement,
151 int, nOrientation,
152 int, fnWeight,
153 DWORD, fdwItalic,
154 DWORD, fdwUnderline,
155 DWORD, fdwStrikeOut,
156 DWORD, fdwCharSet,
157 DWORD, fdwOutputPrecision,
158 DWORD, fdwClipPrecision,
159 DWORD, fdwQuality,
160 DWORD, fdwPitchAndFamily,
161 LPCSTR, lpszFace)
162{
163 CHAR lpstrFaceNew[LF_FACESIZE];
164 HFONT hFont;
165
166 iFontRename(lpszFace, lpstrFaceNew);
167
168 dprintf(("lpszFace = %s -> %s\n", lpszFace, lpstrFaceNew));
169
170 hFont = O32_CreateFont(nHeight,
171 nWidth,
172 nEscapement,
173 nOrientation,
174 fnWeight,
175 fdwItalic,
176 fdwUnderline,
177 fdwStrikeOut,
178 fdwCharSet,
179 fdwOutputPrecision,
180 fdwClipPrecision,
181 fdwQuality,
182 fdwPitchAndFamily,
183 lpszFace != NULL ? lpstrFaceNew : NULL);
184 return hFont;
185}
186//******************************************************************************
187//******************************************************************************
188ODINFUNCTIONNODBG14(HFONT, CreateFontW,
189 int, nHeight,
190 int, nWidth,
191 int, nEscapement,
192 int, nOrientation,
193 int, fnWeight,
194 DWORD, fdwItalic,
195 DWORD, fdwUnderline,
196 DWORD, fdwStrikeOut,
197 DWORD, fdwCharSet,
198 DWORD, fdwOutputPrecision,
199 DWORD, fdwClipPrecision,
200 DWORD, fdwQuality,
201 DWORD, fdwPitchAndFamily,
202 LPCWSTR,lpszFace)
203{
204 char *astring;
205 HFONT hFont;
206
207 // NULL is valid for lpszFace
208 if(lpszFace != NULL)
209 astring = UnicodeToAsciiString((LPWSTR)lpszFace);
210 else
211 astring = NULL;
212
213 // @@@PH switch to ODIN_ later
214 hFont = CreateFontA(nHeight,
215 nWidth,
216 nEscapement,
217 nOrientation,
218 fnWeight,
219 fdwItalic,
220 fdwUnderline,
221 fdwStrikeOut,
222 fdwCharSet,
223 fdwOutputPrecision,
224 fdwClipPrecision,
225 fdwQuality,
226 fdwPitchAndFamily,
227 astring);
228 if (astring != NULL)
229 FreeAsciiString(astring);
230
231 return(hFont);
232}
233
234//******************************************************************************
235//******************************************************************************
236ODINFUNCTION1(HFONT,CreateFontIndirectA,const LOGFONTA*, lplf)
237{
238 HFONT hFont;
239 LOGFONTA afont;
240
241 // don't touch user buffer!
242 memcpy(&afont, lplf, sizeof(LOGFONTA));
243 iFontRename(lplf->lfFaceName, afont.lfFaceName);
244
245 dprintf(("lpszFace = (%x) %s -> %s\n", lplf->lfFaceName, lplf->lfFaceName, afont.lfFaceName));
246
247 dprintf(("GDI32: CreateFontIndirectA\n"));
248 dprintf(("GDI32: lfHeight = %d\n", lplf->lfHeight));
249 dprintf(("GDI32: lfWidth = %d\n", lplf->lfWidth));
250 dprintf(("GDI32: lfEscapement = %d\n", lplf->lfEscapement));
251 dprintf(("GDI32: lfOrientation = %d\n", lplf->lfOrientation));
252 dprintf(("GDI32: lfWeight = %d\n", lplf->lfWeight));
253 dprintf(("GDI32: lfItalic = %d\n", lplf->lfItalic));
254 dprintf(("GDI32: lfUnderline = %d\n", lplf->lfUnderline));
255 dprintf(("GDI32: lfStrikeOut = %d\n", lplf->lfStrikeOut));
256 dprintf(("GDI32: lfCharSet = %X\n", lplf->lfCharSet));
257 dprintf(("GDI32: lfOutPrecision = %X\n", lplf->lfOutPrecision));
258 dprintf(("GDI32: lfClipPrecision = %X\n", lplf->lfClipPrecision));
259 dprintf(("GDI32: lfQuality = %X\n", lplf->lfQuality));
260 dprintf(("GDI32: lfPitchAndFamily= %X\n", lplf->lfPitchAndFamily));
261 dprintf(("GDI32: lfFaceName = %s\n", lplf->lfFaceName));
262
263 hFont = O32_CreateFontIndirect(&afont);
264
265 return(hFont);
266}
267//******************************************************************************
268//******************************************************************************
269ODINFUNCTION1(HFONT, CreateFontIndirectW,const LOGFONTW *, lplf)
270{
271 LOGFONTA afont;
272 HFONT hfont;
273
274 //memcpy(&afont, lplf, ((ULONG)&afont.lfFaceName - (ULONG)&afont));
275 memcpy(&afont, lplf, sizeof(LOGFONTA));
276 memset(afont.lfFaceName, 0, LF_FACESIZE);
277 dprintf(("lpszFace = (%x)", lplf->lfFaceName));
278
279 UnicodeToAsciiN((WCHAR *)lplf->lfFaceName, afont.lfFaceName, LF_FACESIZE-1);
280 hfont = CreateFontIndirectA(&afont);
281 return(hfont);
282}
283//******************************************************************************
284//******************************************************************************
285int EXPENTRY_O32 EnumFontProcA(LPENUMLOGFONTA lpLogFont, LPNEWTEXTMETRICA
286 lpTextM, DWORD arg3, LPARAM arg4)
287{
288 ENUMUSERDATA *lpEnumData = (ENUMUSERDATA *)arg4;
289 FONTENUMPROCA proc = (FONTENUMPROCA)lpEnumData->userProc;
290 USHORT selTIB = SetWin32TIB(); // save current FS selector and set win32 sel
291
292 int rc = proc(lpLogFont, lpTextM, arg3, lpEnumData->userData);
293 SetFS(selTIB); // switch back to the saved FS selector
294 return rc;
295}
296//******************************************************************************
297//******************************************************************************
298int EXPENTRY_O32 EnumFontProcW(LPENUMLOGFONTA lpLogFont, LPNEWTEXTMETRICA lpTextM,
299 DWORD arg3, LPARAM arg4)
300{
301 ENUMUSERDATA *lpEnumData = (ENUMUSERDATA *)arg4;
302 FONTENUMPROCW proc = (FONTENUMPROCW)lpEnumData->userProc;
303 ENUMLOGFONTW LogFont;
304 NEWTEXTMETRICW textM;
305 USHORT selTIB = SetWin32TIB(); // save current FS selector and set win32 sel
306 int rc;
307
308 memcpy(&LogFont, lpLogFont, ((ULONG)&LogFont.elfLogFont.lfFaceName -
309 (ULONG)&LogFont));
310 AsciiToUnicodeN(lpLogFont->elfLogFont.lfFaceName, LogFont.elfLogFont.lfFaceName, LF_FACESIZE-1);
311 AsciiToUnicodeN((char *) lpLogFont->elfFullName, LogFont.elfFullName, LF_FULLFACESIZE-1);
312 AsciiToUnicodeN((char *) lpLogFont->elfStyle, LogFont.elfStyle, LF_FACESIZE-1);
313
314 textM.tmHeight = lpTextM->tmHeight;
315 textM.tmAscent = lpTextM->tmAscent;
316 textM.tmDescent = lpTextM->tmDescent;
317 textM.tmInternalLeading = lpTextM->tmInternalLeading;
318 textM.tmExternalLeading = lpTextM->tmExternalLeading;
319 textM.tmAveCharWidth = lpTextM->tmAveCharWidth;
320 textM.tmMaxCharWidth = lpTextM->tmMaxCharWidth;
321 textM.tmWeight = lpTextM->tmWeight;
322 textM.tmOverhang = lpTextM->tmOverhang;
323 textM.tmDigitizedAspectX = lpTextM->tmDigitizedAspectX;
324 textM.tmDigitizedAspectY = lpTextM->tmDigitizedAspectY;
325 textM.tmFirstChar = lpTextM->tmFirstChar;
326 textM.tmLastChar = lpTextM->tmLastChar;
327 textM.tmDefaultChar = lpTextM->tmDefaultChar;
328 textM.tmBreakChar = lpTextM->tmBreakChar;
329 textM.tmItalic = lpTextM->tmItalic;
330 textM.tmUnderlined = lpTextM->tmUnderlined;
331 textM.tmStruckOut = lpTextM->tmStruckOut;
332 textM.tmPitchAndFamily = lpTextM->tmPitchAndFamily;
333 textM.tmCharSet = lpTextM->tmCharSet;
334 textM.ntmFlags = 0;
335 textM.ntmSizeEM = 0;
336 textM.ntmCellHeight = 0;
337 textM.ntmAvgWidth = 0;
338
339 rc = proc(&LogFont, &textM, arg3, lpEnumData->userData);
340 SetFS(selTIB); // switch back to the saved FS selector
341 return rc;
342}
343//******************************************************************************
344//TODO: FontEnumdwFlagsEx, script, font signature & NEWTEXTMETRICEX (last part)
345//******************************************************************************
346int EXPENTRY_O32 EnumFontProcExA(LPENUMLOGFONTA lpLogFont, LPNEWTEXTMETRICA
347 lpTextM, DWORD arg3, LPARAM arg4)
348{
349 ENUMUSERDATA *lpEnumData = (ENUMUSERDATA *)arg4;
350 FONTENUMPROCEXA proc = (FONTENUMPROCEXA)lpEnumData->userProc;
351 ENUMLOGFONTEXA logFont;
352 NEWTEXTMETRICEXA textM;
353 USHORT selTIB = SetWin32TIB(); // save current FS selector and set win32 sel
354
355 memcpy(&logFont, lpLogFont, sizeof(ENUMLOGFONTA));
356 memset(logFont.elfScript, 0, sizeof(logFont.elfScript));
357 memcpy(&textM.ntmetm, lpTextM, sizeof(textM.ntmetm));
358 memset(&textM.ntmeFontSignature, 0, sizeof(textM.ntmeFontSignature));
359
360 dprintf(("EnumFontProcExA %s", logFont.elfLogFont.lfFaceName));
361
362 int rc = proc(&logFont, &textM, arg3, lpEnumData->userData);
363 SetFS(selTIB); // switch back to the saved FS selector
364 return rc;
365}
366//******************************************************************************
367//TODO: FontEnumdwFlagsEx, script, font signature & NEWTEXTMETRICEX (last part)
368//******************************************************************************
369int EXPENTRY_O32 EnumFontProcExW(LPENUMLOGFONTA lpLogFont, LPNEWTEXTMETRICA lpTextM,
370 DWORD arg3, LPARAM arg4)
371{
372 ENUMUSERDATA *lpEnumData = (ENUMUSERDATA *)arg4;
373 FONTENUMPROCEXW proc = (FONTENUMPROCEXW)lpEnumData->userProc;
374 ENUMLOGFONTEXW LogFont;
375 NEWTEXTMETRICEXW textM;
376 int rc;
377
378 memcpy(&LogFont, lpLogFont, ((ULONG)&LogFont.elfLogFont.lfFaceName - (ULONG)&LogFont));
379 memset(LogFont.elfScript, 0, sizeof(LogFont.elfScript));
380 AsciiToUnicodeN(lpLogFont->elfLogFont.lfFaceName, LogFont.elfLogFont.lfFaceName, LF_FACESIZE-1);
381 AsciiToUnicodeN((char *) lpLogFont->elfFullName, LogFont.elfFullName, LF_FULLFACESIZE-1);
382 AsciiToUnicodeN((char *) lpLogFont->elfStyle, LogFont.elfStyle, LF_FACESIZE-1);
383
384 textM.ntmetm.tmHeight = lpTextM->tmHeight;
385 textM.ntmetm.tmAscent = lpTextM->tmAscent;
386 textM.ntmetm.tmDescent = lpTextM->tmDescent;
387 textM.ntmetm.tmInternalLeading = lpTextM->tmInternalLeading;
388 textM.ntmetm.tmExternalLeading = lpTextM->tmExternalLeading;
389 textM.ntmetm.tmAveCharWidth = lpTextM->tmAveCharWidth;
390 textM.ntmetm.tmMaxCharWidth = lpTextM->tmMaxCharWidth;
391 textM.ntmetm.tmWeight = lpTextM->tmWeight;
392 textM.ntmetm.tmOverhang = lpTextM->tmOverhang;
393 textM.ntmetm.tmDigitizedAspectX = lpTextM->tmDigitizedAspectX;
394 textM.ntmetm.tmDigitizedAspectY = lpTextM->tmDigitizedAspectY;
395 textM.ntmetm.tmFirstChar = lpTextM->tmFirstChar;
396 textM.ntmetm.tmLastChar = lpTextM->tmLastChar;
397 textM.ntmetm.tmDefaultChar = lpTextM->tmDefaultChar;
398 textM.ntmetm.tmBreakChar = lpTextM->tmBreakChar;
399 textM.ntmetm.tmItalic = lpTextM->tmItalic;
400 textM.ntmetm.tmUnderlined = lpTextM->tmUnderlined;
401 textM.ntmetm.tmStruckOut = lpTextM->tmStruckOut;
402 textM.ntmetm.tmPitchAndFamily = lpTextM->tmPitchAndFamily;
403 textM.ntmetm.tmCharSet = lpTextM->tmCharSet;
404 textM.ntmetm.ntmFlags = 0;
405 textM.ntmetm.ntmSizeEM = 0;
406 textM.ntmetm.ntmCellHeight = 0;
407 textM.ntmetm.ntmAvgWidth = 0;
408 memset(&textM.ntmeFontSignature, 0, sizeof(textM.ntmeFontSignature));
409
410 dprintf(("EnumFontProcExW %s", lpLogFont->elfLogFont.lfFaceName));
411 return proc(&LogFont, &textM, arg3, lpEnumData->userData);
412}
413//******************************************************************************
414//******************************************************************************
415ODINFUNCTION4(int, EnumFontsA,
416 HDC, arg1,
417 LPCSTR, arg2,
418 FONTENUMPROCA, arg3,
419 LPARAM, arg4)
420{
421 //@@@PH shouldn't this rather be O32_EnumFonts ?
422 return EnumFontFamiliesA(arg1, arg2, arg3, arg4);
423}
424//******************************************************************************
425//******************************************************************************
426ODINFUNCTION4(int, EnumFontsW,
427 HDC, arg1,
428 LPCWSTR, arg2,
429 FONTENUMPROCW, arg3,
430 LPARAM, arg4)
431{
432 //@@@PH shouldn't this rather be O32_EnumFonts ?
433 return EnumFontFamiliesW(arg1, arg2, arg3, arg4);
434}
435//******************************************************************************
436//******************************************************************************
437ODINFUNCTION4(int, EnumFontFamiliesA,
438 HDC, arg1,
439 LPCSTR, arg2,
440 FONTENUMPROCA, arg3,
441 LPARAM, arg4)
442{
443 ENUMUSERDATA enumData;
444 int rc;
445
446 dprintf(("GDI32: EnumFontFamiliesA %s", arg2));
447
448 enumData.userProc = (DWORD)arg3;
449 enumData.userData = arg4;
450
451 rc = O32_EnumFontFamilies(arg1, arg2, &EnumFontProcA, (LPARAM)&enumData);
452
453 return rc;
454}
455//******************************************************************************
456//******************************************************************************
457ODINFUNCTION4(int, EnumFontFamiliesW,
458 HDC, arg1,
459 LPCWSTR, arg2,
460 FONTENUMPROCW, arg3,
461 LPARAM, arg4)
462{
463 ENUMUSERDATA enumData;
464 int rc;
465 char *astring = UnicodeToAsciiString((LPWSTR)arg2);
466
467 dprintf(("GDI32: EnumFontFamiliesW %s", astring));
468
469 enumData.userProc = (DWORD)arg3;
470 enumData.userData = arg4;
471
472 rc = O32_EnumFontFamilies(arg1, astring, &EnumFontProcW, (LPARAM)&enumData);
473
474 FreeAsciiString(astring);
475 return rc;
476}
477//******************************************************************************
478//******************************************************************************
479ODINFUNCTION5(INT, EnumFontFamiliesExA,
480 HDC, arg1,
481 LPLOGFONTA, arg2,
482 FONTENUMPROCEXA, arg3,
483 LPARAM, arg4,
484 DWORD, dwFlags)
485{
486 ENUMUSERDATA enumData;
487 int rc;
488
489 dprintf(("GDI32: EnumFontFamiliesExA not complete %s", arg2->lfFaceName));
490
491 enumData.userProc = (DWORD)arg3;
492 enumData.userData = arg4;
493 enumData.dwFlags = dwFlags;
494
495 rc = O32_EnumFontFamilies(arg1, arg2->lfFaceName, &EnumFontProcExA, (LPARAM)&enumData);
496
497 return rc;
498}
499//******************************************************************************
500//******************************************************************************
501ODINFUNCTION5(INT, EnumFontFamiliesExW,
502 HDC, arg1,
503 LPLOGFONTW, arg2,
504 FONTENUMPROCEXW, arg3,
505 LPARAM, arg4,
506 DWORD, dwFlags)
507{
508 ENUMUSERDATA enumData;
509 int rc;
510 char *astring = UnicodeToAsciiString((LPWSTR)arg2->lfFaceName);
511
512 dprintf(("GDI32: EnumFontFamiliesExW not complete %s", astring));
513
514 enumData.userProc = (DWORD)arg3;
515 enumData.userData = arg4;
516 enumData.dwFlags = dwFlags;
517
518 rc = O32_EnumFontFamilies(arg1, astring, &EnumFontProcExW, (LPARAM)&enumData);
519
520 FreeAsciiString(astring);
521 return rc;
522}
523//******************************************************************************
524//******************************************************************************
525ODINFUNCTION5(DWORD, GetFontData,
526 HDC, hdc,
527 DWORD, dwTable,
528 DWORD, dwOffset,
529 LPVOID, lpvBuffer,
530 DWORD, dbData)
531{
532 dprintf(("GDI32: GetFontData, not implemented (GDI_ERROR)\n"));
533 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
534
535 return(GDI_ERROR);
536}
537//******************************************************************************
538//******************************************************************************
539ODINFUNCTION1(int, AddFontResourceA,
540 LPCSTR, szFont)
541{
542 dprintf(("GDI32: AddFontResourceA %s", szFont));
543 return O32_AddFontResource(szFont);
544}
545//******************************************************************************
546//******************************************************************************
547ODINFUNCTION1(int, AddFontResourceW,
548 LPCWSTR, szFont)
549{
550 char *astring = UnicodeToAsciiString((LPWSTR)szFont);
551 BOOL rc;
552
553 dprintf(("GDI32: AddFontResourceW"));
554 // NOTE: This will not work as is (needs UNICODE support)
555 rc = AddFontResourceA(astring);
556 FreeAsciiString(astring);
557 return rc;
558}
559//******************************************************************************
560//******************************************************************************
561ODINFUNCTION1(BOOL, RemoveFontResourceA,
562 LPCSTR, arg1)
563{
564 dprintf(("GDI32: RemoveFontResourceA %s\n", arg1));
565 return O32_RemoveFontResource(arg1);
566}
567//******************************************************************************
568//******************************************************************************
569ODINFUNCTION1(BOOL, RemoveFontResourceW,
570 LPCWSTR, szFont)
571{
572 char *astring = UnicodeToAsciiString((LPWSTR)szFont);
573 BOOL rc;
574
575 dprintf(("GDI32: RemoveFontResourceW"));
576 rc = RemoveFontResourceA(astring);
577 FreeAsciiString(astring);
578 return(rc);
579}
580/*****************************************************************************
581 * Name : BOOL CreateScalableFontResourceA
582 * Purpose : The CreateScalableFontResourceA function creates a font resource
583 * file for a scalable font.
584 * Parameters: DWORD fdwHidden flag for read-only embedded font
585 * LPCSTR lpszFontRes address of filename for font resource
586 * LPCSTR lpszFontFile address of filename for scalable font
587 * LPCSTR lpszCurrentPath address of path to font file
588 * Variables :
589 * Result : TRUE / FALSE
590 * Remark :
591 * Status : UNTESTED STUB
592 *
593 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
594 *****************************************************************************/
595
596ODINFUNCTION4(BOOL, CreateScalableFontResourceA,
597 DWORD, fdwHidden,
598 LPCSTR, lpszFontRes,
599 LPCSTR, lpszFontFile,
600 LPCSTR, lpszCurrentPath)
601{
602 dprintf(("GDI32: CreateScalableFontResourceA not implemented.\n"));
603
604 return (FALSE);
605}
606
607
608/*****************************************************************************
609 * Name : BOOL CreateScalableFontResourceW
610 * Purpose : The CreateScalableFontResourceW function creates a font resource
611 * file for a scalable font.
612 * Parameters: DWORD fdwHidden flag for read-only embedded font
613 * LPCSTR lpszFontRes address of filename for font resource
614 * LPCSTR lpszFontFile address of filename for scalable font
615 * LPCSTR lpszCurrentPath address of path to font file
616 * Variables :
617 * Result : TRUE / FALSE
618 * Remark :
619 * Status : UNTESTED STUB
620 *
621 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
622 *****************************************************************************/
623
624ODINFUNCTION4(BOOL, CreateScalableFontResourceW,
625 DWORD, fdwHidden,
626 LPCWSTR, lpszFontRes,
627 LPCWSTR, lpszFontFile,
628 LPCWSTR, lpszCurrentPath)
629{
630 dprintf(("GDI32: CreateScalableFontResourceW not implemented.\n"));
631
632 return (FALSE);
633}
634
635
636/*****************************************************************************
637 * Name : DWORD GetFontLanguageInfo
638 * Purpose : The GetFontLanguageInfo function returns information about the
639 * currently selected font for the specified display context.
640 * Applications typically use this information and the
641 * GetCharacterPlacement function to prepare a character string for display.
642 * Parameters: HDC hdc handle to device context
643 * Variables :
644 * Result :
645 * Remark :
646 * Status : UNTESTED STUB
647 *
648 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
649 *****************************************************************************/
650
651ODINFUNCTION1(DWORD, GetFontLanguageInfo,
652 HDC, hdc)
653{
654 dprintf(("GDI32: GetFontLanguageInfo(%08xh) not implemented.\n",
655 hdc));
656
657 return (0);
658}
659
660
661/*************************************************************************
662 * TranslateCharsetInfo [GDI32.382]
663 *
664 * Fills a CHARSETINFO structure for a character set, code page, or
665 * font. This allows making the correspondance between different labelings
666 * (character set, Windows, ANSI, and OEM codepages, and Unicode ranges)
667 * of the same encoding.
668 *
669 * Only one codepage will be set in lpCs->fs. If TCI_SRCFONTSIG is used,
670 * only one codepage should be set in *lpSrc.
671 *
672 * RETURNS
673 * TRUE on success, FALSE on failure.
674 *
675 *
676 * LPDWORD lpSrc, if flags == TCI_SRCFONTSIG: pointer to fsCsb of a FONTSIGNATURE
677 * if flags == TCI_SRCCHARSET: a character set value
678 * if flags == TCI_SRCCODEPAGE: a code page value
679 * LPCHARSETINFO lpCs, structure to receive charset information
680 * DWORD flags determines interpretation of lpSrc
681 */
682ODINFUNCTION3(BOOL, TranslateCharsetInfo,
683 LPDWORD, lpSrc,
684 LPCHARSETINFO, lpCs,
685 DWORD, flags)
686{
687 int index = 0;
688 switch (flags) {
689 case TCI_SRCFONTSIG:
690 while (!(*lpSrc>>index & 0x0001) && index<MAXTCIINDEX) index++;
691 break;
692 case TCI_SRCCODEPAGE:
693 while ((UINT) (lpSrc) != FONT_tci[index].ciACP && index < MAXTCIINDEX) index++;
694 break;
695 case TCI_SRCCHARSET:
696 while ((UINT) (lpSrc) != FONT_tci[index].ciCharset && index < MAXTCIINDEX) index++;
697 break;
698 default:
699 return FALSE;
700 }
701 if (index >= MAXTCIINDEX || FONT_tci[index].ciCharset == DEFAULT_CHARSET) return FALSE;
702 memcpy(lpCs, &FONT_tci[index], sizeof(CHARSETINFO));
703 return TRUE;
704}
705//******************************************************************************
706//******************************************************************************
Note: See TracBrowser for help on using the repository browser.