Release 980315
[wine] / objects / font.c
1 /*
2  * GDI font objects
3  *
4  * Copyright 1993 Alexandre Julliard
5  *           1997 Alex Korobka
6  */
7
8 #include <stdio.h>
9 #include <stdlib.h>
10 #include <string.h>
11 #include "font.h"
12 #include "heap.h"
13 #include "metafile.h"
14 #include "options.h"
15 #include "debug.h"
16 #include "debugstr.h"
17
18 #define ENUM_UNICODE    0x00000001
19
20 typedef struct
21 {
22   LPLOGFONT16           lpLogFontParam;
23   FONTENUMPROCEX16      lpEnumFunc;
24   LPARAM                lpData;
25
26   LPNEWTEXTMETRICEX16   lpTextMetric;
27   LPENUMLOGFONTEX16     lpLogFont;
28   SEGPTR                segTextMetric;
29   SEGPTR                segLogFont;
30 } fontEnum16;
31
32 typedef struct
33 {
34   LPLOGFONT32W          lpLogFontParam;
35   FONTENUMPROC32W       lpEnumFunc;
36   LPARAM                lpData;
37
38   LPNEWTEXTMETRICEX32W  lpTextMetric;
39   LPENUMLOGFONTEX32W    lpLogFont;
40   DWORD                 dwFlags;
41 } fontEnum32;
42  
43 /***********************************************************************
44  *              LOGFONT conversion functions.
45  */
46 static void __logfont32to16( INT16* plf16, const INT32* plf32 )
47 {
48     int  i;
49     for( i = 0; i < 5; i++ ) *plf16++ = *plf32++;
50    *((INT32*)plf16)++ = *plf32++;
51    *((INT32*)plf16)   = *plf32;
52 }
53
54 static void __logfont16to32( INT32* plf32, const INT16* plf16 )
55 {
56     int i;
57     for( i = 0; i < 5; i++ ) *plf32++ = *plf16++;
58    *plf32++ = *((INT32*)plf16)++;
59    *plf32   = *((INT32*)plf16);
60 }
61
62 void FONT_LogFont32ATo16( const LOGFONT32A* font32, LPLOGFONT16 font16 )
63 {
64   __logfont32to16( (INT16*)font16, (const INT32*)font32 );
65     lstrcpyn32A( font16->lfFaceName, font32->lfFaceName, LF_FACESIZE );
66 }
67
68 void FONT_LogFont32WTo16( const LOGFONT32W* font32, LPLOGFONT16 font16 )
69 {
70   __logfont32to16( (INT16*)font16, (const INT32*)font32 );
71     lstrcpynWtoA( font16->lfFaceName, font32->lfFaceName, LF_FACESIZE );
72 }
73
74 void FONT_LogFont16To32A( const LPLOGFONT16 font16, LPLOGFONT32A font32 )
75 {
76   __logfont16to32( (INT32*)font32, (const INT16*)font16 );
77     lstrcpyn32A( font32->lfFaceName, font16->lfFaceName, LF_FACESIZE );
78 }
79
80 void FONT_LogFont16To32W( const LPLOGFONT16 font16, LPLOGFONT32W font32 )
81 {
82   __logfont16to32( (INT32*)font32, (const INT16*)font16 );
83     lstrcpynAtoW( font32->lfFaceName, font16->lfFaceName, LF_FACESIZE );
84 }
85
86 /***********************************************************************
87  *              TEXTMETRIC conversion functions.
88  */
89 void FONT_TextMetric32Ato16(const LPTEXTMETRIC32A ptm32, LPTEXTMETRIC16 ptm16 )
90 {
91     ptm16->tmHeight = ptm32->tmHeight;
92     ptm16->tmAscent = ptm32->tmAscent;
93     ptm16->tmDescent = ptm32->tmDescent;
94     ptm16->tmInternalLeading = ptm32->tmInternalLeading;
95     ptm16->tmExternalLeading = ptm32->tmExternalLeading;
96     ptm16->tmAveCharWidth = ptm32->tmAveCharWidth;
97     ptm16->tmMaxCharWidth = ptm32->tmMaxCharWidth;
98     ptm16->tmWeight = ptm32->tmWeight;
99     ptm16->tmOverhang = ptm32->tmOverhang;
100     ptm16->tmDigitizedAspectX = ptm32->tmDigitizedAspectX;
101     ptm16->tmDigitizedAspectY = ptm32->tmDigitizedAspectY;
102     ptm16->tmFirstChar = ptm32->tmFirstChar;
103     ptm16->tmLastChar = ptm32->tmLastChar;
104     ptm16->tmDefaultChar = ptm32->tmDefaultChar;
105     ptm16->tmBreakChar = ptm32->tmBreakChar;
106     ptm16->tmItalic = ptm32->tmItalic;
107     ptm16->tmUnderlined = ptm32->tmUnderlined;
108     ptm16->tmStruckOut = ptm32->tmStruckOut;
109     ptm16->tmPitchAndFamily = ptm32->tmPitchAndFamily;
110     ptm16->tmCharSet = ptm32->tmCharSet;
111 }
112
113 void FONT_TextMetric32Wto16(const LPTEXTMETRIC32W ptm32, LPTEXTMETRIC16 ptm16 )
114 {
115     ptm16->tmHeight = ptm32->tmHeight;
116     ptm16->tmAscent = ptm32->tmAscent;
117     ptm16->tmDescent = ptm32->tmDescent;
118     ptm16->tmInternalLeading = ptm32->tmInternalLeading;
119     ptm16->tmExternalLeading = ptm32->tmExternalLeading;
120     ptm16->tmAveCharWidth = ptm32->tmAveCharWidth;
121     ptm16->tmMaxCharWidth = ptm32->tmMaxCharWidth;
122     ptm16->tmWeight = ptm32->tmWeight;
123     ptm16->tmOverhang = ptm32->tmOverhang;
124     ptm16->tmDigitizedAspectX = ptm32->tmDigitizedAspectX;
125     ptm16->tmDigitizedAspectY = ptm32->tmDigitizedAspectY;
126     ptm16->tmFirstChar = ptm32->tmFirstChar;
127     ptm16->tmLastChar = ptm32->tmLastChar;
128     ptm16->tmDefaultChar = ptm32->tmDefaultChar;
129     ptm16->tmBreakChar = ptm32->tmBreakChar;
130     ptm16->tmItalic = ptm32->tmItalic;
131     ptm16->tmUnderlined = ptm32->tmUnderlined;
132     ptm16->tmStruckOut = ptm32->tmStruckOut;
133     ptm16->tmPitchAndFamily = ptm32->tmPitchAndFamily;
134     ptm16->tmCharSet = ptm32->tmCharSet;
135 }
136
137 void FONT_TextMetric16to32A(const LPTEXTMETRIC16 ptm16, LPTEXTMETRIC32A ptm32 )
138 {
139     ptm32->tmHeight = ptm16->tmHeight;
140     ptm32->tmAscent = ptm16->tmAscent;
141     ptm32->tmDescent = ptm16->tmDescent;
142     ptm32->tmInternalLeading = ptm16->tmInternalLeading;
143     ptm32->tmExternalLeading = ptm16->tmExternalLeading;
144     ptm32->tmAveCharWidth = ptm16->tmAveCharWidth;
145     ptm32->tmMaxCharWidth = ptm16->tmMaxCharWidth;
146     ptm32->tmWeight = ptm16->tmWeight;
147     ptm32->tmOverhang = ptm16->tmOverhang;
148     ptm32->tmDigitizedAspectX = ptm16->tmDigitizedAspectX;
149     ptm32->tmDigitizedAspectY = ptm16->tmDigitizedAspectY;
150     ptm32->tmFirstChar = ptm16->tmFirstChar;
151     ptm32->tmLastChar = ptm16->tmLastChar;
152     ptm32->tmDefaultChar = ptm16->tmDefaultChar;
153     ptm32->tmBreakChar = ptm16->tmBreakChar;
154     ptm32->tmItalic = ptm16->tmItalic;
155     ptm32->tmUnderlined = ptm16->tmUnderlined;
156     ptm32->tmStruckOut = ptm16->tmStruckOut;
157     ptm32->tmPitchAndFamily = ptm16->tmPitchAndFamily;
158     ptm32->tmCharSet = ptm16->tmCharSet;
159 }
160
161 void FONT_TextMetric16to32W(const LPTEXTMETRIC16 ptm16, LPTEXTMETRIC32W ptm32 )
162 {
163     ptm32->tmHeight = ptm16->tmHeight;
164     ptm32->tmAscent = ptm16->tmAscent;
165     ptm32->tmDescent = ptm16->tmDescent;
166     ptm32->tmInternalLeading = ptm16->tmInternalLeading;
167     ptm32->tmExternalLeading = ptm16->tmExternalLeading;
168     ptm32->tmAveCharWidth = ptm16->tmAveCharWidth;
169     ptm32->tmMaxCharWidth = ptm16->tmMaxCharWidth;
170     ptm32->tmWeight = ptm16->tmWeight;
171     ptm32->tmOverhang = ptm16->tmOverhang;
172     ptm32->tmDigitizedAspectX = ptm16->tmDigitizedAspectX;
173     ptm32->tmDigitizedAspectY = ptm16->tmDigitizedAspectY;
174     ptm32->tmFirstChar = ptm16->tmFirstChar;
175     ptm32->tmLastChar = ptm16->tmLastChar;
176     ptm32->tmDefaultChar = ptm16->tmDefaultChar;
177     ptm32->tmBreakChar = ptm16->tmBreakChar;
178     ptm32->tmItalic = ptm16->tmItalic;
179     ptm32->tmUnderlined = ptm16->tmUnderlined;
180     ptm32->tmStruckOut = ptm16->tmStruckOut;
181     ptm32->tmPitchAndFamily = ptm16->tmPitchAndFamily;
182     ptm32->tmCharSet = ptm16->tmCharSet;
183 }
184
185 void FONT_TextMetric32Ato32W(const LPTEXTMETRIC32A ptm32A, LPTEXTMETRIC32W ptm32W )
186 {
187     ptm32W->tmHeight = ptm32A->tmHeight;
188     ptm32W->tmAscent = ptm32A->tmAscent;
189     ptm32W->tmDescent = ptm32A->tmDescent;
190     ptm32W->tmInternalLeading = ptm32A->tmInternalLeading;
191     ptm32W->tmExternalLeading = ptm32A->tmExternalLeading;
192     ptm32W->tmAveCharWidth = ptm32A->tmAveCharWidth;
193     ptm32W->tmMaxCharWidth = ptm32A->tmMaxCharWidth;
194     ptm32W->tmWeight = ptm32A->tmWeight;
195     ptm32W->tmOverhang = ptm32A->tmOverhang;
196     ptm32W->tmDigitizedAspectX = ptm32A->tmDigitizedAspectX;
197     ptm32W->tmDigitizedAspectY = ptm32A->tmDigitizedAspectY;
198     ptm32W->tmFirstChar = ptm32A->tmFirstChar;
199     ptm32W->tmLastChar = ptm32A->tmLastChar;
200     ptm32W->tmDefaultChar = ptm32A->tmDefaultChar;
201     ptm32W->tmBreakChar = ptm32A->tmBreakChar;
202     ptm32W->tmItalic = ptm32A->tmItalic;
203     ptm32W->tmUnderlined = ptm32A->tmUnderlined;
204     ptm32W->tmStruckOut = ptm32A->tmStruckOut;
205     ptm32W->tmPitchAndFamily = ptm32A->tmPitchAndFamily;
206     ptm32W->tmCharSet = ptm32A->tmCharSet;
207 }
208
209 /***********************************************************************
210  *           CreateFontIndirect16   (GDI.57)
211  */
212 HFONT16 WINAPI CreateFontIndirect16( const LOGFONT16 *font )
213 {
214     HFONT16 hFont = 0;
215
216     if (font)
217     {
218         hFont = GDI_AllocObject( sizeof(FONTOBJ), FONT_MAGIC );
219         if( hFont )
220         {
221             FONTOBJ* fontPtr;
222             fontPtr = (FONTOBJ *) GDI_HEAP_LOCK( hFont );
223             memcpy( &fontPtr->logfont, font, sizeof(LOGFONT16) );
224
225             TRACE(font,"(%i %i) '%s' %s %s => %04x\n",
226                                  font->lfHeight, font->lfWidth, 
227                                  font->lfFaceName ? font->lfFaceName : "NULL",
228                                  font->lfWeight > 400 ? "Bold" : "",
229                                  font->lfItalic ? "Italic" : "",
230                                  hFont);
231             GDI_HEAP_UNLOCK( hFont );
232         }
233     }
234     else fprintf(stderr,"CreateFontIndirect(NULL) => NULL\n");
235
236     return hFont;
237 }
238
239 /***********************************************************************
240  *           CreateFontIndirect32A   (GDI32.44)
241  */
242 HFONT32 WINAPI CreateFontIndirect32A( const LOGFONT32A *font )
243 {
244     LOGFONT16 font16;
245
246     FONT_LogFont32ATo16( font, &font16 );
247     return CreateFontIndirect16( &font16 );
248 }
249
250 /***********************************************************************
251  *           CreateFontIndirect32W   (GDI32.45)
252  */
253 HFONT32 WINAPI CreateFontIndirect32W( const LOGFONT32W *font )
254 {
255     LOGFONT16 font16;
256
257     FONT_LogFont32WTo16( font, &font16 );
258     return CreateFontIndirect16( &font16 );
259 }
260
261 /***********************************************************************
262  *           CreateFont16    (GDI.56)
263  */
264 HFONT16 WINAPI CreateFont16(INT16 height, INT16 width, INT16 esc, INT16 orient,
265                             INT16 weight, BYTE italic, BYTE underline,
266                             BYTE strikeout, BYTE charset, BYTE outpres,
267                             BYTE clippres, BYTE quality, BYTE pitch,
268                             LPCSTR name )
269 {
270     LOGFONT16 logfont = { height, width, esc, orient, weight, italic, underline,
271                           strikeout, charset, outpres, clippres, quality, pitch, };
272
273     TRACE(font,"('%s',%d,%d)\n",
274                  (name ? name : "(null)") , height, width);
275     if (name) 
276         lstrcpyn32A(logfont.lfFaceName,name,sizeof(logfont.lfFaceName));
277     else 
278         logfont.lfFaceName[0] = '\0';
279     return CreateFontIndirect16( &logfont );
280 }
281
282 /*************************************************************************
283  *           CreateFont32A    (GDI32.43)
284  */
285 HFONT32 WINAPI CreateFont32A( INT32 height, INT32 width, INT32 esc,
286                               INT32 orient, INT32 weight, DWORD italic,
287                               DWORD underline, DWORD strikeout, DWORD charset,
288                               DWORD outpres, DWORD clippres, DWORD quality,
289                               DWORD pitch, LPCSTR name )
290 {
291     return (HFONT32)CreateFont16( height, width, esc, orient, weight, italic,
292                                   underline, strikeout, charset, outpres,
293                                   clippres, quality, pitch, name );
294 }
295
296 /*************************************************************************
297  *           CreateFont32W    (GDI32.46)
298  */
299 HFONT32 WINAPI CreateFont32W( INT32 height, INT32 width, INT32 esc,
300                               INT32 orient, INT32 weight, DWORD italic,
301                               DWORD underline, DWORD strikeout, DWORD charset,
302                               DWORD outpres, DWORD clippres, DWORD quality,
303                               DWORD pitch, LPCWSTR name )
304 {
305     LPSTR namea = HEAP_strdupWtoA( GetProcessHeap(), 0, name );
306     HFONT32 ret = (HFONT32)CreateFont16( height, width, esc, orient, weight,
307                                          italic, underline, strikeout, charset,
308                                          outpres, clippres, quality, pitch,
309                                          namea );
310     if (namea) HeapFree( GetProcessHeap(), 0, namea );
311     return ret;
312 }
313
314
315 /***********************************************************************
316  *           FONT_GetObject16
317  */
318 INT16 FONT_GetObject16( FONTOBJ * font, INT16 count, LPSTR buffer )
319 {
320     if (count > sizeof(LOGFONT16)) count = sizeof(LOGFONT16);
321     memcpy( buffer, &font->logfont, count );
322     return count;
323 }
324
325 /***********************************************************************
326  *           FONT_GetObject32A
327  */
328 INT32 FONT_GetObject32A( FONTOBJ *font, INT32 count, LPSTR buffer )
329 {
330     LOGFONT32A fnt32;
331
332     FONT_LogFont16To32A( &font->logfont, &fnt32 );
333
334     if (count > sizeof(fnt32)) count = sizeof(fnt32);
335     memcpy( buffer, &fnt32, count );
336     return count;
337 }
338
339
340 /***********************************************************************
341  *              FONT_EnumInstance16
342  *
343  * Called by the device driver layer to pass font info
344  * down to the application.
345  */
346 static INT32 FONT_EnumInstance16( LPENUMLOGFONT16 plf, 
347                                   LPNEWTEXTMETRIC16 ptm, UINT16 fType, LPARAM lp )
348 {
349 #define pfe ((fontEnum16*)lp)
350     if( pfe->lpLogFontParam->lfCharSet == DEFAULT_CHARSET || 
351         pfe->lpLogFontParam->lfCharSet == plf->elfLogFont.lfCharSet )
352     {
353         memcpy( pfe->lpLogFont, plf, sizeof(ENUMLOGFONT16) );
354         memcpy( pfe->lpTextMetric, ptm, sizeof(NEWTEXTMETRIC16) );
355
356         return pfe->lpEnumFunc( pfe->segLogFont, pfe->segTextMetric, fType, (LPARAM)(pfe->lpData) );
357     }
358 #undef pfe
359     return 1;
360 }
361
362 /***********************************************************************
363  *              FONT_EnumInstance32
364  */
365 static INT32 FONT_EnumInstance32( LPENUMLOGFONT16 plf,
366                                   LPNEWTEXTMETRIC16 ptm, UINT16 fType, LPARAM lp )
367 {
368     /* lfCharSet is at the same offset in both LOGFONT32A and LOGFONT32W */
369
370 #define pfe ((fontEnum32*)lp)
371     if( pfe->lpLogFontParam->lfCharSet == DEFAULT_CHARSET || 
372         pfe->lpLogFontParam->lfCharSet == plf->elfLogFont.lfCharSet )
373     {
374         /* convert font metrics */
375
376         if( pfe->dwFlags & ENUM_UNICODE )
377         {
378             FONT_LogFont16To32W( &plf->elfLogFont, (LPLOGFONT32W)(pfe->lpLogFont) );
379             FONT_TextMetric16to32W( (LPTEXTMETRIC16)ptm, (LPTEXTMETRIC32W)(pfe->lpTextMetric) );
380         }
381         else
382         {
383             FONT_LogFont16To32A( &plf->elfLogFont, (LPLOGFONT32A)pfe->lpLogFont );
384             FONT_TextMetric16to32A( (LPTEXTMETRIC16)ptm, (LPTEXTMETRIC32A)pfe->lpTextMetric );
385         }
386
387         return pfe->lpEnumFunc( (LPENUMLOGFONT32W)pfe->lpLogFont, 
388                                 (LPNEWTEXTMETRIC32W)pfe->lpTextMetric, fType, pfe->lpData );
389     }
390 #undef pfe
391     return 1;
392 }
393
394 /***********************************************************************
395  *              EnumFontFamiliesEx16    (GDI.613)
396  */
397 INT16 WINAPI EnumFontFamiliesEx16( HDC16 hDC, LPLOGFONT16 plf,
398                                    FONTENUMPROCEX16 efproc, LPARAM lParam,
399                                    DWORD dwFlags)
400 {
401     INT16       retVal = 0;
402     DC*         dc = (DC*) GDI_GetObjPtr( hDC, DC_MAGIC );
403
404     if( dc && dc->funcs->pEnumDeviceFonts )
405     {
406         LPNEWTEXTMETRICEX16     lptm16 = SEGPTR_ALLOC( sizeof(NEWTEXTMETRICEX16) );
407         if( lptm16 )
408         {
409             LPENUMLOGFONTEX16   lplf16 = SEGPTR_ALLOC( sizeof(ENUMLOGFONTEX16) );
410             if( lplf16 )
411             {
412                 fontEnum16      fe16 = { plf, efproc, lParam, lptm16, lplf16, 
413                                          SEGPTR_GET(lptm16), SEGPTR_GET(lplf16) };
414
415                 retVal = dc->funcs->pEnumDeviceFonts( dc, plf, FONT_EnumInstance16, (LPARAM)&fe16 );
416
417                 SEGPTR_FREE(lplf16);
418             }
419             SEGPTR_FREE(lptm16);
420         }
421     }
422     return retVal;
423 }
424
425 /***********************************************************************
426  *              FONT_EnumFontFamiliesEx32
427  */
428 static INT32 FONT_EnumFontFamiliesEx32( HDC32 hDC, LPLOGFONT32W plf, FONTENUMPROC32W efproc, 
429                                                    LPARAM lParam, DWORD dwUnicode)
430 {
431     DC*         dc = (DC*) GDI_GetObjPtr( hDC, DC_MAGIC );
432
433     if( dc && dc->funcs->pEnumDeviceFonts )
434     {
435         LOGFONT16               lf16;
436         NEWTEXTMETRICEX32W      tm32w;
437         ENUMLOGFONTEX32W        lf32w;
438         fontEnum32              fe32 = { plf, efproc, lParam, &tm32w, &lf32w, dwUnicode }; 
439
440         /* the only difference between LOGFONT32A and LOGFONT32W is in the lfFaceName */
441
442         if( plf->lfFaceName[0] )
443         {
444             if( dwUnicode )
445                 lstrcpynWtoA( lf16.lfFaceName, plf->lfFaceName, LF_FACESIZE );
446             else
447                 lstrcpyn32A( lf16.lfFaceName, (LPCSTR)plf->lfFaceName, LF_FACESIZE );
448         }
449         else lf16.lfFaceName[0] = '\0';
450         lf16.lfCharSet = plf->lfCharSet;
451
452         return dc->funcs->pEnumDeviceFonts( dc, &lf16, FONT_EnumInstance32, (LPARAM)&fe32 );
453     }
454     return 0;
455 }
456
457 /***********************************************************************
458  *              EnumFontFamiliesEx32W   (GDI32.82)
459  */
460 INT32 WINAPI EnumFontFamiliesEx32W( HDC32 hDC, LPLOGFONT32W plf,
461                                     FONTENUMPROCEX32W efproc, 
462                                     LPARAM lParam, DWORD dwFlags )
463 {
464     return  FONT_EnumFontFamiliesEx32( hDC, plf, (FONTENUMPROC32W)efproc, 
465                                                   lParam, ENUM_UNICODE );
466 }
467
468 /***********************************************************************
469  *              EnumFontFamiliesEx32A   (GDI32.81)
470  */
471 INT32 WINAPI EnumFontFamiliesEx32A( HDC32 hDC, LPLOGFONT32A plf,
472                                     FONTENUMPROCEX32A efproc, 
473                                     LPARAM lParam, DWORD dwFlags)
474 {
475     return  FONT_EnumFontFamiliesEx32( hDC, (LPLOGFONT32W)plf, 
476                                       (FONTENUMPROC32W)efproc, lParam, 0);
477 }
478
479 /***********************************************************************
480  *              EnumFontFamilies16      (GDI.330)
481  */
482 INT16 WINAPI EnumFontFamilies16( HDC16 hDC, LPCSTR lpFamily,
483                                  FONTENUMPROC16 efproc, LPARAM lpData )
484 {
485     LOGFONT16   lf;
486
487     lf.lfCharSet = DEFAULT_CHARSET;
488     if( lpFamily ) lstrcpyn32A( lf.lfFaceName, lpFamily, LF_FACESIZE );
489     else lf.lfFaceName[0] = '\0';
490
491     return EnumFontFamiliesEx16( hDC, &lf, (FONTENUMPROCEX16)efproc, lpData, 0 );
492 }
493
494 /***********************************************************************
495  *              EnumFontFamilies32A     (GDI32.80)
496  */
497 INT32 WINAPI EnumFontFamilies32A( HDC32 hDC, LPCSTR lpFamily,
498                                   FONTENUMPROC32A efproc, LPARAM lpData )
499 {
500     LOGFONT32A  lf;
501
502     lf.lfCharSet = DEFAULT_CHARSET;
503     if( lpFamily ) lstrcpyn32A( lf.lfFaceName, lpFamily, LF_FACESIZE );
504     else lf.lfFaceName[0] = lf.lfFaceName[1] = '\0';
505
506     return FONT_EnumFontFamiliesEx32( hDC, (LPLOGFONT32W)&lf, 
507                                            (FONTENUMPROC32W)efproc, lpData, 0 );
508 }
509
510 /***********************************************************************
511  *              EnumFontFamilies32W     (GDI32.83)
512  */
513 INT32 WINAPI EnumFontFamilies32W( HDC32 hDC, LPCWSTR lpFamily,
514                                   FONTENUMPROC32W efproc, LPARAM lpData )
515 {
516     LOGFONT32W  lf;
517
518     lf.lfCharSet = DEFAULT_CHARSET;
519     if( lpFamily ) lstrcpyn32W( lf.lfFaceName, lpFamily, LF_FACESIZE );
520     else lf.lfFaceName[0] = 0;
521
522     return FONT_EnumFontFamiliesEx32( hDC, &lf, efproc, lpData, ENUM_UNICODE );
523 }
524
525 /***********************************************************************
526  *              EnumFonts16             (GDI.70)
527  */
528 INT16 WINAPI EnumFonts16( HDC16 hDC, LPCSTR lpName, FONTENUMPROC16 efproc,
529                           LPARAM lpData )
530 {
531     return EnumFontFamilies16( hDC, lpName, (FONTENUMPROCEX16)efproc, lpData );
532 }
533
534 /***********************************************************************
535  *              EnumFonts32A            (GDI32.84)
536  */
537 INT32 WINAPI EnumFonts32A( HDC32 hDC, LPCSTR lpName, FONTENUMPROC32A efproc,
538                            LPARAM lpData )
539 {
540     return EnumFontFamilies32A( hDC, lpName, efproc, lpData );
541 }
542
543 /***********************************************************************
544  *              EnumFonts32W            (GDI32.85)
545  */
546 INT32 WINAPI EnumFonts32W( HDC32 hDC, LPCWSTR lpName, FONTENUMPROC32W efproc,
547                            LPARAM lpData )
548 {
549     return EnumFontFamilies32W( hDC, lpName, efproc, lpData );
550 }
551
552
553 /***********************************************************************
554  *           GetTextCharacterExtra16    (GDI.89)
555  */
556 INT16 WINAPI GetTextCharacterExtra16( HDC16 hdc )
557 {
558     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
559     if (!dc) return 0;
560     return abs( (dc->w.charExtra * dc->wndExtX + dc->vportExtX / 2)
561                  / dc->vportExtX );
562 }
563
564
565 /***********************************************************************
566  *           GetTextCharacterExtra32    (GDI32.225)
567  */
568 INT32 WINAPI GetTextCharacterExtra32( HDC32 hdc )
569 {
570     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
571     if (!dc) return 0;
572     return abs( (dc->w.charExtra * dc->wndExtX + dc->vportExtX / 2)
573                  / dc->vportExtX );
574 }
575
576
577 /***********************************************************************
578  *           SetTextCharacterExtra16    (GDI.8)
579  */
580 INT16 WINAPI SetTextCharacterExtra16( HDC16 hdc, INT16 extra )
581 {
582     return (INT16)SetTextCharacterExtra32( hdc, extra );
583 }
584
585
586 /***********************************************************************
587  *           SetTextCharacterExtra32    (GDI32.337)
588  */
589 INT32 WINAPI SetTextCharacterExtra32( HDC32 hdc, INT32 extra )
590 {
591     INT32 prev;
592     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
593     if (!dc) return 0;
594     extra = (extra * dc->vportExtX + dc->wndExtX / 2) / dc->wndExtX;
595     prev = dc->w.charExtra;
596     dc->w.charExtra = abs(extra);
597     return (prev * dc->wndExtX + dc->vportExtX / 2) / dc->vportExtX;
598 }
599
600
601 /***********************************************************************
602  *           SetTextJustification16    (GDI.10)
603  */
604 INT16 WINAPI SetTextJustification16( HDC16 hdc, INT16 extra, INT16 breaks )
605 {
606     return SetTextJustification32( hdc, extra, breaks );
607 }
608
609
610 /***********************************************************************
611  *           SetTextJustification32    (GDI32.339)
612  */
613 BOOL32 WINAPI SetTextJustification32( HDC32 hdc, INT32 extra, INT32 breaks )
614 {
615     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
616     if (!dc) return 0;
617
618     extra = abs((extra * dc->vportExtX + dc->wndExtX / 2) / dc->wndExtX);
619     if (!extra) breaks = 0;
620     dc->w.breakTotalExtra = extra;
621     dc->w.breakCount = breaks;
622     if (breaks)
623     {
624         dc->w.breakExtra = extra / breaks;
625         dc->w.breakRem   = extra - (dc->w.breakCount * dc->w.breakExtra);
626     }
627     else
628     {
629         dc->w.breakExtra = 0;
630         dc->w.breakRem   = 0;
631     }
632     return 1;
633 }
634
635
636 /***********************************************************************
637  *           GetTextFace16    (GDI.92)
638  */
639 INT16 WINAPI GetTextFace16( HDC16 hdc, INT16 count, LPSTR name )
640 {
641         return GetTextFace32A(hdc,count,name);
642 }
643
644 /***********************************************************************
645  *           GetTextFace32A    (GDI32.234)
646  */
647 INT32 WINAPI GetTextFace32A( HDC32 hdc, INT32 count, LPSTR name )
648 {
649     FONTOBJ *font;
650
651     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
652     if (!dc) return 0;
653     if (!(font = (FONTOBJ *) GDI_GetObjPtr( dc->w.hFont, FONT_MAGIC )))
654         return 0;
655     lstrcpyn32A( name, font->logfont.lfFaceName, count );
656     GDI_HEAP_UNLOCK( dc->w.hFont );
657     return strlen(name);
658 }
659
660 /***********************************************************************
661  *           GetTextFace32W    (GDI32.235)
662  */
663 INT32 WINAPI GetTextFace32W( HDC32 hdc, INT32 count, LPWSTR name )
664 {
665     LPSTR nameA = HeapAlloc( GetProcessHeap(), 0, count );
666     INT32 res = GetTextFace32A(hdc,count,nameA);
667     lstrcpyAtoW( name, nameA );
668     HeapFree( GetProcessHeap(), 0, nameA );
669     return res;
670 }
671
672
673 /***********************************************************************
674  *           GetTextExtent    (GDI.91)
675  */
676 DWORD WINAPI GetTextExtent( HDC16 hdc, LPCSTR str, INT16 count )
677 {
678     SIZE16 size;
679     if (!GetTextExtentPoint16( hdc, str, count, &size )) return 0;
680     return MAKELONG( size.cx, size.cy );
681 }
682
683
684 /***********************************************************************
685  *           GetTextExtentPoint16    (GDI.471)
686  *
687  * FIXME: Should this have a bug for compatibility?
688  * Original Windows versions of GetTextExtentPoint{A,W} have documented
689  * bugs.
690  */
691 BOOL16 WINAPI GetTextExtentPoint16( HDC16 hdc, LPCSTR str, INT16 count,
692                                     LPSIZE16 size )
693 {
694     SIZE32 size32;
695     BOOL32 ret = GetTextExtentPoint32A( hdc, str, count, &size32 );
696     CONV_SIZE32TO16( &size32, size );
697     return (BOOL16)ret;
698 }
699
700
701 /***********************************************************************
702  *           GetTextExtentPoint32A    (GDI32.230)
703  */
704 BOOL32 WINAPI GetTextExtentPoint32A( HDC32 hdc, LPCSTR str, INT32 count,
705                                      LPSIZE32 size )
706 {
707     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
708     if (!dc)
709     {
710         if (!(dc = (DC *)GDI_GetObjPtr( hdc, METAFILE_DC_MAGIC )))
711             return FALSE;
712     }
713
714     if (!dc->funcs->pGetTextExtentPoint ||
715         !dc->funcs->pGetTextExtentPoint( dc, str, count, size ))
716         return FALSE;
717
718     TRACE(font,"(%08x %s %d %p): returning %d,%d\n",
719                  hdc, debugstr_an (str, count), count,
720                  size, size->cx, size->cy );
721     return TRUE;
722 }
723
724
725 /***********************************************************************
726  *           GetTextExtentPoint32W    (GDI32.231)
727  */
728 BOOL32 WINAPI GetTextExtentPoint32W( HDC32 hdc, LPCWSTR str, INT32 count,
729                                      LPSIZE32 size )
730 {
731     LPSTR p = HEAP_strdupWtoA( GetProcessHeap(), 0, str );
732     BOOL32 ret = GetTextExtentPoint32A( hdc, p, count, size );
733     HeapFree( GetProcessHeap(), 0, p );
734     return ret;
735 }
736
737
738 /***********************************************************************
739  *           GetTextExtentPoint32ABuggy    (GDI32.232)
740  */
741 BOOL32 WINAPI GetTextExtentPoint32ABuggy( HDC32 hdc, LPCSTR str, INT32 count,
742                                           LPSIZE32 size )
743 {
744     TRACE(font, "not bug compatible.\n");
745     return GetTextExtentPoint32A( hdc, str, count, size );
746 }
747
748 /***********************************************************************
749  *           GetTextExtentPoint32WBuggy    (GDI32.233)
750  */
751 BOOL32 WINAPI GetTextExtentPoint32WBuggy( HDC32 hdc, LPCWSTR str, INT32 count,
752                                           LPSIZE32 size )
753 {
754     TRACE(font, "not bug compatible.\n");
755     return GetTextExtentPoint32W( hdc, str, count, size );
756 }
757
758
759 /***********************************************************************
760  *           GetTextExtentExPoint32A    (GDI32.228)
761  */
762 BOOL32 WINAPI GetTextExtentExPoint32A( HDC32 hdc, LPCSTR str, INT32 count,
763                                        INT32 maxExt, LPINT32 lpnFit,
764                                        LPINT32 alpDx, LPSIZE32 size )
765 {
766     int index, nFit, extent;
767     SIZE32 tSize;
768     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
769
770     if (!dc)
771     {
772         if (!(dc = (DC *)GDI_GetObjPtr( hdc, METAFILE_DC_MAGIC )))
773             return FALSE;
774     }
775     if (!dc->funcs->pGetTextExtentPoint) return FALSE;
776
777     size->cx = size->cy = nFit = extent = 0;
778     for(index = 0; index < count; index++)
779     {
780         if(!dc->funcs->pGetTextExtentPoint( dc, str, 1, &tSize )) return FALSE;
781         if( extent+tSize.cx < maxExt )
782         {
783             extent+=tSize.cx;
784             nFit++;
785             str++;
786             if( alpDx ) alpDx[index] = extent;
787             if( tSize.cy > size->cy ) size->cy = tSize.cy;
788         }
789         else break;
790     }
791     size->cx = extent;
792    *lpnFit = nFit;
793
794     TRACE(font,"(%08x '%.*s' %d) returning %d %d %d\n",
795                hdc,count,str,maxExt,nFit, size->cx,size->cy);
796     return TRUE;
797 }
798
799
800 /***********************************************************************
801  *           GetTextExtentExPoint32W    (GDI32.229)
802  */
803
804 BOOL32 WINAPI GetTextExtentExPoint32W( HDC32 hdc, LPCWSTR str, INT32 count,
805                                        INT32 maxExt, LPINT32 lpnFit,
806                                        LPINT32 alpDx, LPSIZE32 size )
807 {
808     LPSTR p = HEAP_strdupWtoA( GetProcessHeap(), 0, str );
809     BOOL32 ret = GetTextExtentExPoint32A( hdc, p, count, maxExt,
810                                         lpnFit, alpDx, size);
811     HeapFree( GetProcessHeap(), 0, p );
812     return ret;
813 }
814
815 /***********************************************************************
816  *           GetTextMetrics16    (GDI.93)
817  */
818 BOOL16 WINAPI GetTextMetrics16( HDC16 hdc, TEXTMETRIC16 *metrics )
819 {
820     TEXTMETRIC32A tm32;
821
822     if (!GetTextMetrics32A( (HDC32)hdc, &tm32 )) return FALSE;
823     FONT_TextMetric32Ato16( &tm32, metrics );
824     return TRUE;
825 }
826
827
828 /***********************************************************************
829  *           GetTextMetrics32A    (GDI32.236)
830  */
831 BOOL32 WINAPI GetTextMetrics32A( HDC32 hdc, TEXTMETRIC32A *metrics )
832 {
833     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
834     if (!dc)
835     {
836         if (!(dc = (DC *)GDI_GetObjPtr( hdc, METAFILE_DC_MAGIC )))
837             return FALSE;
838     }
839
840     if (!dc->funcs->pGetTextMetrics ||
841         !dc->funcs->pGetTextMetrics( dc, metrics ))
842         return FALSE;
843
844     /* device layer returns values in device units
845      * therefore we have to convert them to logical */
846
847 #define WDPTOLP(x) ((x<0)?                                      \
848                 (-abs((x)*dc->wndExtX/dc->vportExtX)):          \
849                 (abs((x)*dc->wndExtX/dc->vportExtX)))
850 #define HDPTOLP(y) ((y<0)?                                      \
851                 (-abs((y)*dc->wndExtY/dc->vportExtY)):          \
852                 (abs((y)*dc->wndExtY/dc->vportExtY)))
853         
854     metrics->tmHeight           = HDPTOLP(metrics->tmHeight);
855     metrics->tmAscent           = HDPTOLP(metrics->tmAscent);
856     metrics->tmDescent          = HDPTOLP(metrics->tmDescent);
857     metrics->tmInternalLeading  = HDPTOLP(metrics->tmInternalLeading);
858     metrics->tmExternalLeading  = HDPTOLP(metrics->tmExternalLeading);
859     metrics->tmAveCharWidth     = WDPTOLP(metrics->tmAveCharWidth);
860     metrics->tmMaxCharWidth     = WDPTOLP(metrics->tmMaxCharWidth);
861     metrics->tmOverhang         = WDPTOLP(metrics->tmOverhang);
862
863     TRACE(font,"text metrics:
864     Weight = %03i\t FirstChar = %03i\t AveCharWidth = %i
865     Italic = % 3i\t LastChar = %03i\t\t MaxCharWidth = %i
866     UnderLined = %01i\t DefaultChar = %03i\t Overhang = %i
867     StruckOut = %01i\t BreakChar = %03i\t CharSet = %i
868     PitchAndFamily = %02x
869     --------------------
870     InternalLeading = %i
871     Ascent = %i
872     Descent = %i
873     Height = %i\n",
874     metrics->tmWeight, metrics->tmFirstChar, metrics->tmAveCharWidth,
875     metrics->tmItalic, metrics->tmLastChar, metrics->tmMaxCharWidth,
876     metrics->tmUnderlined, metrics->tmDefaultChar, metrics->tmOverhang,
877     metrics->tmStruckOut, metrics->tmBreakChar, metrics->tmCharSet,
878     metrics->tmPitchAndFamily,
879     metrics->tmInternalLeading,
880     metrics->tmAscent,
881     metrics->tmDescent,
882     metrics->tmHeight );
883     return TRUE;
884 }
885
886
887 /***********************************************************************
888  *           GetTextMetrics32W    (GDI32.237)
889  */
890 BOOL32 WINAPI GetTextMetrics32W( HDC32 hdc, TEXTMETRIC32W *metrics )
891 {
892     TEXTMETRIC32A tm;
893     if (!GetTextMetrics32A( (HDC16)hdc, &tm )) return FALSE;
894     FONT_TextMetric32Ato32W( &tm, metrics );
895     return TRUE;
896 }
897
898
899 /***********************************************************************
900  *           GetCharWidth16    (GDI.350)
901  */
902 BOOL16 WINAPI GetCharWidth16( HDC16 hdc, UINT16 firstChar, UINT16 lastChar,
903                               LPINT16 buffer )
904 {
905     BOOL32      retVal = FALSE;
906
907     if( firstChar != lastChar )
908     {
909         LPINT32 buf32 = (LPINT32)HeapAlloc(GetProcessHeap(), 0,
910                                  sizeof(INT32)*(1 + (lastChar - firstChar)));
911         if( buf32 )
912         {
913             LPINT32     obuf32 = buf32;
914             int         i;
915
916             retVal = GetCharWidth32A(hdc, firstChar, lastChar, buf32);
917             if (retVal)
918             {
919                 for (i = firstChar; i <= lastChar; i++)
920                     *buffer++ = *buf32++;
921             }
922             HeapFree(GetProcessHeap(), 0, obuf32);
923         }
924     }
925     else /* happens quite often to warrant a special treatment */
926     {
927         INT32 chWidth;
928         retVal = GetCharWidth32A(hdc, firstChar, lastChar, &chWidth );
929        *buffer = chWidth;
930     }
931     return retVal;
932 }
933
934
935 /***********************************************************************
936  *           GetCharWidth32A    (GDI32.155)
937  */
938 BOOL32 WINAPI GetCharWidth32A( HDC32 hdc, UINT32 firstChar, UINT32 lastChar,
939                                LPINT32 buffer )
940 {
941     UINT32 i, extra;
942     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
943     if (!dc)
944     {
945         if (!(dc = (DC *)GDI_GetObjPtr( hdc, METAFILE_DC_MAGIC )))
946             return FALSE;
947     }
948
949     if (!dc->funcs->pGetCharWidth ||
950         !dc->funcs->pGetCharWidth( dc, firstChar, lastChar, buffer))
951         return FALSE;
952
953     /* convert device units to logical */
954
955     extra = dc->vportExtX >> 1;
956     for( i = firstChar; i <= lastChar; i++, buffer++ )
957          *buffer = (*buffer * dc->wndExtX + extra) / dc->vportExtX;
958
959     return TRUE;
960 }
961
962
963 /***********************************************************************
964  *           GetCharWidth32W    (GDI32.158)
965  */
966 BOOL32 WINAPI GetCharWidth32W( HDC32 hdc, UINT32 firstChar, UINT32 lastChar,
967                                LPINT32 buffer )
968 {
969     return GetCharWidth32A( hdc, firstChar, lastChar, buffer );
970 }
971
972
973
974 /* FIXME: all following APIs *******************************************
975  *
976  *
977  *           SetMapperFlags16    (GDI.349)
978  */
979 DWORD WINAPI SetMapperFlags16( HDC16 hDC, DWORD dwFlag )
980 {
981     return SetMapperFlags32( hDC, dwFlag );
982 }
983
984
985 /***********************************************************************
986  *           SetMapperFlags32    (GDI32.322)
987  */
988 DWORD WINAPI SetMapperFlags32( HDC32 hDC, DWORD dwFlag )
989 {
990     FIXME(font, "(%04x, %08lX) -- Empty Stub !\n",
991                   hDC, dwFlag);
992     return 0L;
993 }
994
995 /***********************************************************************
996  *          GetAspectRatioFilterEx16  (GDI.486)
997  */
998 BOOL16 GetAspectRatioFilterEx16( HDC16 hdc, LPVOID pAspectRatio )
999 {
1000   FIXME(font, "(%04x, %p): -- Empty Stub !\n",
1001                 hdc, pAspectRatio);
1002   return FALSE;
1003 }
1004
1005
1006 /***********************************************************************
1007  *           GetCharABCWidths16   (GDI.307)
1008  */
1009 BOOL16 WINAPI GetCharABCWidths16( HDC16 hdc, UINT16 firstChar, UINT16 lastChar,
1010                                   LPABC16 abc )
1011 {
1012     ABC32 abc32;
1013     if (!GetCharABCWidths32A( hdc, firstChar, lastChar, &abc32 )) return FALSE;
1014     abc->abcA = abc32.abcA;
1015     abc->abcB = abc32.abcB;
1016     abc->abcC = abc32.abcC;
1017     return TRUE;
1018 }
1019
1020
1021 /***********************************************************************
1022  *           GetCharABCWidths32A   (GDI32.149)
1023  */
1024 BOOL32 WINAPI GetCharABCWidths32A(HDC32 hdc, UINT32 firstChar, UINT32 lastChar,
1025                                   LPABC32 abc )
1026 {
1027     /* No TrueType fonts in Wine so far */
1028     fprintf( stdnimp, "STUB: GetCharABCWidths(%04x,%04x,%04x,%p)\n",
1029              hdc, firstChar, lastChar, abc );
1030     return FALSE;
1031 }
1032
1033
1034 /***********************************************************************
1035  *           GetCharABCWidths32W   (GDI32.152)
1036  */
1037 BOOL32 WINAPI GetCharABCWidths32W(HDC32 hdc, UINT32 firstChar, UINT32 lastChar,
1038                                   LPABC32 abc )
1039 {
1040     return GetCharABCWidths32A( hdc, firstChar, lastChar, abc );
1041 }
1042
1043
1044 /***********************************************************************
1045  *           GetGlyphOutline16    (GDI.309)
1046  */
1047 DWORD WINAPI GetGlyphOutline16( HDC16 hdc, UINT16 uChar, UINT16 fuFormat,
1048                                 LPGLYPHMETRICS16 lpgm, DWORD cbBuffer,
1049                                 LPVOID lpBuffer, const MAT2 *lpmat2 )
1050 {
1051     fprintf( stdnimp,"GetGlyphOutLine16(%04x, '%c', %04x, %p, %ld, %p, %p) // - empty stub!\n",
1052              hdc, uChar, fuFormat, lpgm, cbBuffer, lpBuffer, lpmat2 );
1053     return (DWORD)-1; /* failure */
1054 }
1055
1056
1057 /***********************************************************************
1058  *           GetGlyphOutline32A    (GDI32.186)
1059  */
1060 DWORD WINAPI GetGlyphOutline32A( HDC32 hdc, UINT32 uChar, UINT32 fuFormat,
1061                                  LPGLYPHMETRICS32 lpgm, DWORD cbBuffer,
1062                                  LPVOID lpBuffer, const MAT2 *lpmat2 )
1063 {
1064     fprintf( stdnimp,"GetGlyphOutLine32A(%04x, '%c', %04x, %p, %ld, %p, %p) // - empty stub!\n",
1065              hdc, uChar, fuFormat, lpgm, cbBuffer, lpBuffer, lpmat2 );
1066     return (DWORD)-1; /* failure */
1067 }
1068
1069 /***********************************************************************
1070  *           GetGlyphOutline32W    (GDI32.187)
1071  */
1072 DWORD WINAPI GetGlyphOutline32W( HDC32 hdc, UINT32 uChar, UINT32 fuFormat,
1073                                  LPGLYPHMETRICS32 lpgm, DWORD cbBuffer,
1074                                  LPVOID lpBuffer, const MAT2 *lpmat2 )
1075 {
1076     fprintf( stdnimp,"GetGlyphOutLine32W(%04x, '%c', %04x, %p, %ld, %p, %p) // - empty stub!\n",
1077              hdc, uChar, fuFormat, lpgm, cbBuffer, lpBuffer, lpmat2 );
1078     return (DWORD)-1; /* failure */
1079 }
1080
1081 /***********************************************************************
1082  *           CreateScalableFontResource16   (GDI.310)
1083  */
1084 BOOL16 WINAPI CreateScalableFontResource16( UINT16 fHidden,
1085                                             LPCSTR lpszResourceFile,
1086                                             LPCSTR fontFile, LPCSTR path )
1087 {
1088     return CreateScalableFontResource32A( fHidden, lpszResourceFile,
1089                                           fontFile, path );
1090 }
1091
1092 /***********************************************************************
1093  *           CreateScalableFontResource32A   (GDI32.62)
1094  */
1095 BOOL32 WINAPI CreateScalableFontResource32A( DWORD fHidden,
1096                                              LPCSTR lpszResourceFile,
1097                                              LPCSTR lpszFontFile,
1098                                              LPCSTR lpszCurrentPath )
1099 {
1100     /* fHidden=1 - only visible for the calling app, read-only, not
1101      * enumbered with EnumFonts/EnumFontFamilies
1102      * lpszCurrentPath can be NULL
1103      */
1104     fprintf(stdnimp,"CreateScalableFontResource(%ld,%s,%s,%s) // empty stub\n",
1105             fHidden, lpszResourceFile, lpszFontFile, lpszCurrentPath );
1106     return FALSE; /* create failed */
1107 }
1108
1109 /***********************************************************************
1110  *           CreateScalableFontResource32W   (GDI32.63)
1111  */
1112 BOOL32 WINAPI CreateScalableFontResource32W( DWORD fHidden,
1113                                              LPCWSTR lpszResourceFile,
1114                                              LPCWSTR lpszFontFile,
1115                                              LPCWSTR lpszCurrentPath )
1116 {
1117     fprintf(stdnimp,"CreateScalableFontResource32W(%ld,%p,%p,%p) // empty stub\n",
1118             fHidden, lpszResourceFile, lpszFontFile, lpszCurrentPath );
1119     return FALSE; /* create failed */
1120 }
1121
1122
1123 /*************************************************************************
1124  *             GetRasterizerCaps16   (GDI.313)
1125  */
1126 BOOL16 WINAPI GetRasterizerCaps16( LPRASTERIZER_STATUS lprs, UINT16 cbNumBytes)
1127 {
1128     return GetRasterizerCaps32( lprs, cbNumBytes );
1129 }
1130
1131
1132 /*************************************************************************
1133  *             GetRasterizerCaps32   (GDI32.216)
1134  */
1135 BOOL32 WINAPI GetRasterizerCaps32( LPRASTERIZER_STATUS lprs, UINT32 cbNumBytes)
1136 {
1137   lprs->nSize = sizeof(RASTERIZER_STATUS);
1138   lprs->wFlags = TT_AVAILABLE|TT_ENABLED;
1139   lprs->nLanguageID = 0;
1140   return TRUE;
1141 }
1142
1143
1144 /*************************************************************************
1145  *             GetKerningPairs16   (GDI.332)
1146  */
1147 INT16 WINAPI GetKerningPairs16( HDC16 hDC, INT16 cPairs,
1148                                 LPKERNINGPAIR16 lpKerningPairs )
1149 {
1150     /* At this time kerning is ignored (set to 0) */
1151     int i;
1152     fprintf(stdnimp,"GetKerningPairs16: almost empty stub!\n");
1153     for (i = 0; i < cPairs; i++) lpKerningPairs[i].iKernAmount = 0;
1154     return 0;
1155 }
1156
1157
1158
1159 /*************************************************************************
1160  *             GetKerningPairs32A   (GDI32.192)
1161  */
1162 DWORD WINAPI GetKerningPairs32A( HDC32 hDC, DWORD cPairs,
1163                                  LPKERNINGPAIR32 lpKerningPairs )
1164 {
1165     int i;
1166     fprintf(stdnimp,"GetKerningPairs32: almost empty stub!\n");
1167     for (i = 0; i < cPairs; i++) lpKerningPairs[i].iKernAmount = 0;
1168     return 0;
1169 }
1170
1171
1172 /*************************************************************************
1173  *             GetKerningPairs32W   (GDI32.193)
1174  */
1175 DWORD WINAPI GetKerningPairs32W( HDC32 hDC, DWORD cPairs,
1176                                  LPKERNINGPAIR32 lpKerningPairs )
1177 {
1178     return GetKerningPairs32A( hDC, cPairs, lpKerningPairs );
1179 }
1180
1181 BOOL32 WINAPI TranslateCharSetInfo(LPDWORD lpSrc,LPCHARSETINFO lpCs,DWORD dwFlags) {
1182     fprintf(stderr,"TranslateCharSetInfo(%p,%p,0x%08lx), stub.\n",
1183         lpSrc,lpCs,dwFlags
1184     );
1185     return TRUE;
1186 }
1187
1188
1189 /*************************************************************************
1190  *             GetFontLanguageInfo   (GDI32.182)
1191  */
1192 DWORD WINAPI GetFontLanguageInfo32(HDC32 hdc) {
1193         /* return value 0 is correct for most cases anyway */
1194         fprintf(stderr,"GetFontLanguageInfo:stub!\n");
1195         return 0;
1196 }
1197
1198 /*************************************************************************
1199  *             GetFontLanguageInfo   (GDI.616)
1200  */
1201 DWORD WINAPI GetFontLanguageInfo16(HDC16 hdc) {
1202         /* return value 0 is correct for most cases anyway */
1203         fprintf(stderr,"GetFontLanguageInfo:stub!\n");
1204         return 0;
1205 }