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