Fix number and type of args in debugging statements.
[wine.git] / objects / font.c
blob27953753b1624ed7097be1a1f5791c77e4844ede
1 /*
2 * GDI font objects
4 * Copyright 1993 Alexandre Julliard
5 * 1997 Alex Korobka
6 */
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 #include "winerror.h"
17 #define ENUM_UNICODE 0x00000001
19 typedef struct
21 LPLOGFONT16 lpLogFontParam;
22 FONTENUMPROCEX16 lpEnumFunc;
23 LPARAM lpData;
25 LPNEWTEXTMETRICEX16 lpTextMetric;
26 LPENUMLOGFONTEX16 lpLogFont;
27 SEGPTR segTextMetric;
28 SEGPTR segLogFont;
29 } fontEnum16;
31 typedef struct
33 LPLOGFONT32W lpLogFontParam;
34 FONTENUMPROC32W lpEnumFunc;
35 LPARAM lpData;
37 LPNEWTEXTMETRICEX32W lpTextMetric;
38 LPENUMLOGFONTEX32W lpLogFont;
39 DWORD dwFlags;
40 } fontEnum32;
42 /***********************************************************************
43 * LOGFONT conversion functions.
45 static void __logfont32to16( INT16* plf16, const INT32* plf32 )
47 int i;
48 for( i = 0; i < 5; i++ ) *plf16++ = *plf32++;
49 *((INT32*)plf16)++ = *plf32++;
50 *((INT32*)plf16) = *plf32;
53 static void __logfont16to32( INT32* plf32, const INT16* plf16 )
55 int i;
56 for( i = 0; i < 5; i++ ) *plf32++ = *plf16++;
57 *plf32++ = *((INT32*)plf16)++;
58 *plf32 = *((INT32*)plf16);
61 void FONT_LogFont32ATo16( const LOGFONT32A* font32, LPLOGFONT16 font16 )
63 __logfont32to16( (INT16*)font16, (const INT32*)font32 );
64 lstrcpyn32A( font16->lfFaceName, font32->lfFaceName, LF_FACESIZE );
67 void FONT_LogFont32WTo16( const LOGFONT32W* font32, LPLOGFONT16 font16 )
69 __logfont32to16( (INT16*)font16, (const INT32*)font32 );
70 lstrcpynWtoA( font16->lfFaceName, font32->lfFaceName, LF_FACESIZE );
73 void FONT_LogFont16To32A( const LPLOGFONT16 font16, LPLOGFONT32A font32 )
75 __logfont16to32( (INT32*)font32, (const INT16*)font16 );
76 lstrcpyn32A( font32->lfFaceName, font16->lfFaceName, LF_FACESIZE );
79 void FONT_LogFont16To32W( const LPLOGFONT16 font16, LPLOGFONT32W font32 )
81 __logfont16to32( (INT32*)font32, (const INT16*)font16 );
82 lstrcpynAtoW( font32->lfFaceName, font16->lfFaceName, LF_FACESIZE );
85 /***********************************************************************
86 * TEXTMETRIC conversion functions.
88 void FONT_TextMetric32Ato16(const LPTEXTMETRIC32A ptm32, LPTEXTMETRIC16 ptm16 )
90 ptm16->tmHeight = ptm32->tmHeight;
91 ptm16->tmAscent = ptm32->tmAscent;
92 ptm16->tmDescent = ptm32->tmDescent;
93 ptm16->tmInternalLeading = ptm32->tmInternalLeading;
94 ptm16->tmExternalLeading = ptm32->tmExternalLeading;
95 ptm16->tmAveCharWidth = ptm32->tmAveCharWidth;
96 ptm16->tmMaxCharWidth = ptm32->tmMaxCharWidth;
97 ptm16->tmWeight = ptm32->tmWeight;
98 ptm16->tmOverhang = ptm32->tmOverhang;
99 ptm16->tmDigitizedAspectX = ptm32->tmDigitizedAspectX;
100 ptm16->tmDigitizedAspectY = ptm32->tmDigitizedAspectY;
101 ptm16->tmFirstChar = ptm32->tmFirstChar;
102 ptm16->tmLastChar = ptm32->tmLastChar;
103 ptm16->tmDefaultChar = ptm32->tmDefaultChar;
104 ptm16->tmBreakChar = ptm32->tmBreakChar;
105 ptm16->tmItalic = ptm32->tmItalic;
106 ptm16->tmUnderlined = ptm32->tmUnderlined;
107 ptm16->tmStruckOut = ptm32->tmStruckOut;
108 ptm16->tmPitchAndFamily = ptm32->tmPitchAndFamily;
109 ptm16->tmCharSet = ptm32->tmCharSet;
112 void FONT_TextMetric32Wto16(const LPTEXTMETRIC32W ptm32, LPTEXTMETRIC16 ptm16 )
114 ptm16->tmHeight = ptm32->tmHeight;
115 ptm16->tmAscent = ptm32->tmAscent;
116 ptm16->tmDescent = ptm32->tmDescent;
117 ptm16->tmInternalLeading = ptm32->tmInternalLeading;
118 ptm16->tmExternalLeading = ptm32->tmExternalLeading;
119 ptm16->tmAveCharWidth = ptm32->tmAveCharWidth;
120 ptm16->tmMaxCharWidth = ptm32->tmMaxCharWidth;
121 ptm16->tmWeight = ptm32->tmWeight;
122 ptm16->tmOverhang = ptm32->tmOverhang;
123 ptm16->tmDigitizedAspectX = ptm32->tmDigitizedAspectX;
124 ptm16->tmDigitizedAspectY = ptm32->tmDigitizedAspectY;
125 ptm16->tmFirstChar = ptm32->tmFirstChar;
126 ptm16->tmLastChar = ptm32->tmLastChar;
127 ptm16->tmDefaultChar = ptm32->tmDefaultChar;
128 ptm16->tmBreakChar = ptm32->tmBreakChar;
129 ptm16->tmItalic = ptm32->tmItalic;
130 ptm16->tmUnderlined = ptm32->tmUnderlined;
131 ptm16->tmStruckOut = ptm32->tmStruckOut;
132 ptm16->tmPitchAndFamily = ptm32->tmPitchAndFamily;
133 ptm16->tmCharSet = ptm32->tmCharSet;
136 void FONT_TextMetric16to32A(const LPTEXTMETRIC16 ptm16, LPTEXTMETRIC32A ptm32 )
138 ptm32->tmHeight = ptm16->tmHeight;
139 ptm32->tmAscent = ptm16->tmAscent;
140 ptm32->tmDescent = ptm16->tmDescent;
141 ptm32->tmInternalLeading = ptm16->tmInternalLeading;
142 ptm32->tmExternalLeading = ptm16->tmExternalLeading;
143 ptm32->tmAveCharWidth = ptm16->tmAveCharWidth;
144 ptm32->tmMaxCharWidth = ptm16->tmMaxCharWidth;
145 ptm32->tmWeight = ptm16->tmWeight;
146 ptm32->tmOverhang = ptm16->tmOverhang;
147 ptm32->tmDigitizedAspectX = ptm16->tmDigitizedAspectX;
148 ptm32->tmDigitizedAspectY = ptm16->tmDigitizedAspectY;
149 ptm32->tmFirstChar = ptm16->tmFirstChar;
150 ptm32->tmLastChar = ptm16->tmLastChar;
151 ptm32->tmDefaultChar = ptm16->tmDefaultChar;
152 ptm32->tmBreakChar = ptm16->tmBreakChar;
153 ptm32->tmItalic = ptm16->tmItalic;
154 ptm32->tmUnderlined = ptm16->tmUnderlined;
155 ptm32->tmStruckOut = ptm16->tmStruckOut;
156 ptm32->tmPitchAndFamily = ptm16->tmPitchAndFamily;
157 ptm32->tmCharSet = ptm16->tmCharSet;
160 void FONT_TextMetric16to32W(const LPTEXTMETRIC16 ptm16, LPTEXTMETRIC32W ptm32 )
162 ptm32->tmHeight = ptm16->tmHeight;
163 ptm32->tmAscent = ptm16->tmAscent;
164 ptm32->tmDescent = ptm16->tmDescent;
165 ptm32->tmInternalLeading = ptm16->tmInternalLeading;
166 ptm32->tmExternalLeading = ptm16->tmExternalLeading;
167 ptm32->tmAveCharWidth = ptm16->tmAveCharWidth;
168 ptm32->tmMaxCharWidth = ptm16->tmMaxCharWidth;
169 ptm32->tmWeight = ptm16->tmWeight;
170 ptm32->tmOverhang = ptm16->tmOverhang;
171 ptm32->tmDigitizedAspectX = ptm16->tmDigitizedAspectX;
172 ptm32->tmDigitizedAspectY = ptm16->tmDigitizedAspectY;
173 ptm32->tmFirstChar = ptm16->tmFirstChar;
174 ptm32->tmLastChar = ptm16->tmLastChar;
175 ptm32->tmDefaultChar = ptm16->tmDefaultChar;
176 ptm32->tmBreakChar = ptm16->tmBreakChar;
177 ptm32->tmItalic = ptm16->tmItalic;
178 ptm32->tmUnderlined = ptm16->tmUnderlined;
179 ptm32->tmStruckOut = ptm16->tmStruckOut;
180 ptm32->tmPitchAndFamily = ptm16->tmPitchAndFamily;
181 ptm32->tmCharSet = ptm16->tmCharSet;
184 void FONT_TextMetric32Ato32W(const LPTEXTMETRIC32A ptm32A, LPTEXTMETRIC32W ptm32W )
186 ptm32W->tmHeight = ptm32A->tmHeight;
187 ptm32W->tmAscent = ptm32A->tmAscent;
188 ptm32W->tmDescent = ptm32A->tmDescent;
189 ptm32W->tmInternalLeading = ptm32A->tmInternalLeading;
190 ptm32W->tmExternalLeading = ptm32A->tmExternalLeading;
191 ptm32W->tmAveCharWidth = ptm32A->tmAveCharWidth;
192 ptm32W->tmMaxCharWidth = ptm32A->tmMaxCharWidth;
193 ptm32W->tmWeight = ptm32A->tmWeight;
194 ptm32W->tmOverhang = ptm32A->tmOverhang;
195 ptm32W->tmDigitizedAspectX = ptm32A->tmDigitizedAspectX;
196 ptm32W->tmDigitizedAspectY = ptm32A->tmDigitizedAspectY;
197 ptm32W->tmFirstChar = ptm32A->tmFirstChar;
198 ptm32W->tmLastChar = ptm32A->tmLastChar;
199 ptm32W->tmDefaultChar = ptm32A->tmDefaultChar;
200 ptm32W->tmBreakChar = ptm32A->tmBreakChar;
201 ptm32W->tmItalic = ptm32A->tmItalic;
202 ptm32W->tmUnderlined = ptm32A->tmUnderlined;
203 ptm32W->tmStruckOut = ptm32A->tmStruckOut;
204 ptm32W->tmPitchAndFamily = ptm32A->tmPitchAndFamily;
205 ptm32W->tmCharSet = ptm32A->tmCharSet;
208 /***********************************************************************
209 * CreateFontIndirect16 (GDI.57)
211 HFONT16 WINAPI CreateFontIndirect16( const LOGFONT16 *font )
213 HFONT16 hFont = 0;
215 if (font)
217 hFont = GDI_AllocObject( sizeof(FONTOBJ), FONT_MAGIC );
218 if( hFont )
220 FONTOBJ* fontPtr;
221 fontPtr = (FONTOBJ *) GDI_HEAP_LOCK( hFont );
222 memcpy( &fontPtr->logfont, font, sizeof(LOGFONT16) );
224 TRACE(font,"(%i %i %i %i) '%s' %s %s => %04x\n",
225 font->lfHeight, font->lfWidth,
226 font->lfEscapement, font->lfOrientation,
227 font->lfFaceName ? font->lfFaceName : "NULL",
228 font->lfWeight > 400 ? "Bold" : "",
229 font->lfItalic ? "Italic" : "",
230 hFont);
232 if (font->lfEscapement != font->lfOrientation) {
233 /* this should really depend on whether GM_ADVANCED is set */
234 fontPtr->logfont.lfOrientation = fontPtr->logfont.lfEscapement;
235 WARN(font,
236 "orientation angle %f set to escapement angle %f for new font %04x\n",
237 font->lfOrientation/10., font->lfEscapement/10., hFont);
239 GDI_HEAP_UNLOCK( hFont );
242 else WARN(font,"(NULL) => NULL\n");
244 return hFont;
247 /***********************************************************************
248 * CreateFontIndirect32A (GDI32.44)
250 HFONT32 WINAPI CreateFontIndirect32A( const LOGFONT32A *font )
252 LOGFONT16 font16;
254 FONT_LogFont32ATo16( font, &font16 );
255 return CreateFontIndirect16( &font16 );
258 /***********************************************************************
259 * CreateFontIndirect32W (GDI32.45)
261 HFONT32 WINAPI CreateFontIndirect32W( const LOGFONT32W *font )
263 LOGFONT16 font16;
265 FONT_LogFont32WTo16( font, &font16 );
266 return CreateFontIndirect16( &font16 );
269 /***********************************************************************
270 * CreateFont16 (GDI.56)
272 HFONT16 WINAPI CreateFont16(INT16 height, INT16 width, INT16 esc, INT16 orient,
273 INT16 weight, BYTE italic, BYTE underline,
274 BYTE strikeout, BYTE charset, BYTE outpres,
275 BYTE clippres, BYTE quality, BYTE pitch,
276 LPCSTR name )
278 LOGFONT16 logfont = { height, width, esc, orient, weight, italic, underline,
279 strikeout, charset, outpres, clippres, quality, pitch, };
281 TRACE(font,"('%s',%d,%d)\n",
282 (name ? name : "(null)") , height, width);
283 if (name)
284 lstrcpyn32A(logfont.lfFaceName,name,sizeof(logfont.lfFaceName));
285 else
286 logfont.lfFaceName[0] = '\0';
287 return CreateFontIndirect16( &logfont );
290 /*************************************************************************
291 * CreateFont32A (GDI32.43)
293 HFONT32 WINAPI CreateFont32A( INT32 height, INT32 width, INT32 esc,
294 INT32 orient, INT32 weight, DWORD italic,
295 DWORD underline, DWORD strikeout, DWORD charset,
296 DWORD outpres, DWORD clippres, DWORD quality,
297 DWORD pitch, LPCSTR name )
299 return (HFONT32)CreateFont16( height, width, esc, orient, weight, italic,
300 underline, strikeout, charset, outpres,
301 clippres, quality, pitch, name );
304 /*************************************************************************
305 * CreateFont32W (GDI32.46)
307 HFONT32 WINAPI CreateFont32W( INT32 height, INT32 width, INT32 esc,
308 INT32 orient, INT32 weight, DWORD italic,
309 DWORD underline, DWORD strikeout, DWORD charset,
310 DWORD outpres, DWORD clippres, DWORD quality,
311 DWORD pitch, LPCWSTR name )
313 LPSTR namea = HEAP_strdupWtoA( GetProcessHeap(), 0, name );
314 HFONT32 ret = (HFONT32)CreateFont16( height, width, esc, orient, weight,
315 italic, underline, strikeout, charset,
316 outpres, clippres, quality, pitch,
317 namea );
318 if (namea) HeapFree( GetProcessHeap(), 0, namea );
319 return ret;
323 /***********************************************************************
324 * FONT_GetObject16
326 INT16 FONT_GetObject16( FONTOBJ * font, INT16 count, LPSTR buffer )
328 if (count > sizeof(LOGFONT16)) count = sizeof(LOGFONT16);
329 memcpy( buffer, &font->logfont, count );
330 return count;
333 /***********************************************************************
334 * FONT_GetObject32A
336 INT32 FONT_GetObject32A( FONTOBJ *font, INT32 count, LPSTR buffer )
338 LOGFONT32A fnt32;
340 FONT_LogFont16To32A( &font->logfont, &fnt32 );
342 if (count > sizeof(fnt32)) count = sizeof(fnt32);
343 memcpy( buffer, &fnt32, count );
344 return count;
346 /***********************************************************************
347 * FONT_GetObject32W
349 INT32 FONT_GetObject32W( FONTOBJ *font, INT32 count, LPSTR buffer )
351 LOGFONT32W fnt32;
353 FONT_LogFont16To32W( &font->logfont, &fnt32 );
355 if (count > sizeof(fnt32)) count = sizeof(fnt32);
356 memcpy( buffer, &fnt32, count );
357 return count;
361 /***********************************************************************
362 * FONT_EnumInstance16
364 * Called by the device driver layer to pass font info
365 * down to the application.
367 static INT32 FONT_EnumInstance16( LPENUMLOGFONT16 plf,
368 LPNEWTEXTMETRIC16 ptm, UINT16 fType, LPARAM lp )
370 #define pfe ((fontEnum16*)lp)
371 if( pfe->lpLogFontParam->lfCharSet == DEFAULT_CHARSET ||
372 pfe->lpLogFontParam->lfCharSet == plf->elfLogFont.lfCharSet )
374 memcpy( pfe->lpLogFont, plf, sizeof(ENUMLOGFONT16) );
375 memcpy( pfe->lpTextMetric, ptm, sizeof(NEWTEXTMETRIC16) );
377 return pfe->lpEnumFunc( pfe->segLogFont, pfe->segTextMetric, fType, (LPARAM)(pfe->lpData) );
379 #undef pfe
380 return 1;
383 /***********************************************************************
384 * FONT_EnumInstance32
386 static INT32 FONT_EnumInstance32( LPENUMLOGFONT16 plf,
387 LPNEWTEXTMETRIC16 ptm, UINT16 fType, LPARAM lp )
389 /* lfCharSet is at the same offset in both LOGFONT32A and LOGFONT32W */
391 #define pfe ((fontEnum32*)lp)
392 if( pfe->lpLogFontParam->lfCharSet == DEFAULT_CHARSET ||
393 pfe->lpLogFontParam->lfCharSet == plf->elfLogFont.lfCharSet )
395 /* convert font metrics */
397 if( pfe->dwFlags & ENUM_UNICODE )
399 FONT_LogFont16To32W( &plf->elfLogFont, (LPLOGFONT32W)(pfe->lpLogFont) );
400 FONT_TextMetric16to32W( (LPTEXTMETRIC16)ptm, (LPTEXTMETRIC32W)(pfe->lpTextMetric) );
402 else
404 FONT_LogFont16To32A( &plf->elfLogFont, (LPLOGFONT32A)pfe->lpLogFont );
405 FONT_TextMetric16to32A( (LPTEXTMETRIC16)ptm, (LPTEXTMETRIC32A)pfe->lpTextMetric );
408 return pfe->lpEnumFunc( (LPENUMLOGFONT32W)pfe->lpLogFont,
409 (LPNEWTEXTMETRIC32W)pfe->lpTextMetric, fType, pfe->lpData );
411 #undef pfe
412 return 1;
415 /***********************************************************************
416 * EnumFontFamiliesEx16 (GDI.613)
418 INT16 WINAPI EnumFontFamiliesEx16( HDC16 hDC, LPLOGFONT16 plf,
419 FONTENUMPROCEX16 efproc, LPARAM lParam,
420 DWORD dwFlags)
422 INT16 retVal = 0;
423 DC* dc = (DC*) GDI_GetObjPtr( hDC, DC_MAGIC );
425 if( dc && dc->funcs->pEnumDeviceFonts )
427 LPNEWTEXTMETRICEX16 lptm16 = SEGPTR_ALLOC( sizeof(NEWTEXTMETRICEX16) );
428 if( lptm16 )
430 LPENUMLOGFONTEX16 lplf16 = SEGPTR_ALLOC( sizeof(ENUMLOGFONTEX16) );
431 if( lplf16 )
433 fontEnum16 fe16 = { plf, efproc, lParam, lptm16, lplf16,
434 SEGPTR_GET(lptm16), SEGPTR_GET(lplf16) };
436 retVal = dc->funcs->pEnumDeviceFonts( dc, plf, FONT_EnumInstance16, (LPARAM)&fe16 );
438 SEGPTR_FREE(lplf16);
440 SEGPTR_FREE(lptm16);
443 return retVal;
446 /***********************************************************************
447 * FONT_EnumFontFamiliesEx32
449 static INT32 FONT_EnumFontFamiliesEx32( HDC32 hDC, LPLOGFONT32W plf, FONTENUMPROC32W efproc,
450 LPARAM lParam, DWORD dwUnicode)
452 DC* dc = (DC*) GDI_GetObjPtr( hDC, DC_MAGIC );
454 if( dc && dc->funcs->pEnumDeviceFonts )
456 LOGFONT16 lf16;
457 NEWTEXTMETRICEX32W tm32w;
458 ENUMLOGFONTEX32W lf32w;
459 fontEnum32 fe32 = { plf, efproc, lParam, &tm32w, &lf32w, dwUnicode };
461 /* the only difference between LOGFONT32A and LOGFONT32W is in the lfFaceName */
463 if( plf->lfFaceName[0] )
465 if( dwUnicode )
466 lstrcpynWtoA( lf16.lfFaceName, plf->lfFaceName, LF_FACESIZE );
467 else
468 lstrcpyn32A( lf16.lfFaceName, (LPCSTR)plf->lfFaceName, LF_FACESIZE );
470 else lf16.lfFaceName[0] = '\0';
471 lf16.lfCharSet = plf->lfCharSet;
473 return dc->funcs->pEnumDeviceFonts( dc, &lf16, FONT_EnumInstance32, (LPARAM)&fe32 );
475 return 0;
478 /***********************************************************************
479 * EnumFontFamiliesEx32W (GDI32.82)
481 INT32 WINAPI EnumFontFamiliesEx32W( HDC32 hDC, LPLOGFONT32W plf,
482 FONTENUMPROCEX32W efproc,
483 LPARAM lParam, DWORD dwFlags )
485 return FONT_EnumFontFamiliesEx32( hDC, plf, (FONTENUMPROC32W)efproc,
486 lParam, ENUM_UNICODE );
489 /***********************************************************************
490 * EnumFontFamiliesEx32A (GDI32.81)
492 INT32 WINAPI EnumFontFamiliesEx32A( HDC32 hDC, LPLOGFONT32A plf,
493 FONTENUMPROCEX32A efproc,
494 LPARAM lParam, DWORD dwFlags)
496 return FONT_EnumFontFamiliesEx32( hDC, (LPLOGFONT32W)plf,
497 (FONTENUMPROC32W)efproc, lParam, 0);
500 /***********************************************************************
501 * EnumFontFamilies16 (GDI.330)
503 INT16 WINAPI EnumFontFamilies16( HDC16 hDC, LPCSTR lpFamily,
504 FONTENUMPROC16 efproc, LPARAM lpData )
506 LOGFONT16 lf;
508 lf.lfCharSet = DEFAULT_CHARSET;
509 if( lpFamily ) lstrcpyn32A( lf.lfFaceName, lpFamily, LF_FACESIZE );
510 else lf.lfFaceName[0] = '\0';
512 return EnumFontFamiliesEx16( hDC, &lf, (FONTENUMPROCEX16)efproc, lpData, 0 );
515 /***********************************************************************
516 * EnumFontFamilies32A (GDI32.80)
518 INT32 WINAPI EnumFontFamilies32A( HDC32 hDC, LPCSTR lpFamily,
519 FONTENUMPROC32A efproc, LPARAM lpData )
521 LOGFONT32A lf;
523 lf.lfCharSet = DEFAULT_CHARSET;
524 if( lpFamily ) lstrcpyn32A( lf.lfFaceName, lpFamily, LF_FACESIZE );
525 else lf.lfFaceName[0] = lf.lfFaceName[1] = '\0';
527 return FONT_EnumFontFamiliesEx32( hDC, (LPLOGFONT32W)&lf,
528 (FONTENUMPROC32W)efproc, lpData, 0 );
531 /***********************************************************************
532 * EnumFontFamilies32W (GDI32.83)
534 INT32 WINAPI EnumFontFamilies32W( HDC32 hDC, LPCWSTR lpFamily,
535 FONTENUMPROC32W efproc, LPARAM lpData )
537 LOGFONT32W lf;
539 lf.lfCharSet = DEFAULT_CHARSET;
540 if( lpFamily ) lstrcpyn32W( lf.lfFaceName, lpFamily, LF_FACESIZE );
541 else lf.lfFaceName[0] = 0;
543 return FONT_EnumFontFamiliesEx32( hDC, &lf, efproc, lpData, ENUM_UNICODE );
546 /***********************************************************************
547 * EnumFonts16 (GDI.70)
549 INT16 WINAPI EnumFonts16( HDC16 hDC, LPCSTR lpName, FONTENUMPROC16 efproc,
550 LPARAM lpData )
552 return EnumFontFamilies16( hDC, lpName, (FONTENUMPROCEX16)efproc, lpData );
555 /***********************************************************************
556 * EnumFonts32A (GDI32.84)
558 INT32 WINAPI EnumFonts32A( HDC32 hDC, LPCSTR lpName, FONTENUMPROC32A efproc,
559 LPARAM lpData )
561 return EnumFontFamilies32A( hDC, lpName, efproc, lpData );
564 /***********************************************************************
565 * EnumFonts32W (GDI32.85)
567 INT32 WINAPI EnumFonts32W( HDC32 hDC, LPCWSTR lpName, FONTENUMPROC32W efproc,
568 LPARAM lpData )
570 return EnumFontFamilies32W( hDC, lpName, efproc, lpData );
574 /***********************************************************************
575 * GetTextCharacterExtra16 (GDI.89)
577 INT16 WINAPI GetTextCharacterExtra16( HDC16 hdc )
579 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
580 if (!dc) return 0;
581 return abs( (dc->w.charExtra * dc->wndExtX + dc->vportExtX / 2)
582 / dc->vportExtX );
586 /***********************************************************************
587 * GetTextCharacterExtra32 (GDI32.225)
589 INT32 WINAPI GetTextCharacterExtra32( HDC32 hdc )
591 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
592 if (!dc) return 0;
593 return abs( (dc->w.charExtra * dc->wndExtX + dc->vportExtX / 2)
594 / dc->vportExtX );
598 /***********************************************************************
599 * SetTextCharacterExtra16 (GDI.8)
601 INT16 WINAPI SetTextCharacterExtra16( HDC16 hdc, INT16 extra )
603 return (INT16)SetTextCharacterExtra32( hdc, extra );
607 /***********************************************************************
608 * SetTextCharacterExtra32 (GDI32.337)
610 INT32 WINAPI SetTextCharacterExtra32( HDC32 hdc, INT32 extra )
612 INT32 prev;
613 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
614 if (!dc) return 0;
615 extra = (extra * dc->vportExtX + dc->wndExtX / 2) / dc->wndExtX;
616 prev = dc->w.charExtra;
617 dc->w.charExtra = abs(extra);
618 return (prev * dc->wndExtX + dc->vportExtX / 2) / dc->vportExtX;
622 /***********************************************************************
623 * SetTextJustification16 (GDI.10)
625 INT16 WINAPI SetTextJustification16( HDC16 hdc, INT16 extra, INT16 breaks )
627 return SetTextJustification32( hdc, extra, breaks );
631 /***********************************************************************
632 * SetTextJustification32 (GDI32.339)
634 BOOL32 WINAPI SetTextJustification32( HDC32 hdc, INT32 extra, INT32 breaks )
636 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
637 if (!dc) return 0;
639 extra = abs((extra * dc->vportExtX + dc->wndExtX / 2) / dc->wndExtX);
640 if (!extra) breaks = 0;
641 dc->w.breakTotalExtra = extra;
642 dc->w.breakCount = breaks;
643 if (breaks)
645 dc->w.breakExtra = extra / breaks;
646 dc->w.breakRem = extra - (dc->w.breakCount * dc->w.breakExtra);
648 else
650 dc->w.breakExtra = 0;
651 dc->w.breakRem = 0;
653 return 1;
657 /***********************************************************************
658 * GetTextFace16 (GDI.92)
660 INT16 WINAPI GetTextFace16( HDC16 hdc, INT16 count, LPSTR name )
662 return GetTextFace32A(hdc,count,name);
665 /***********************************************************************
666 * GetTextFace32A (GDI32.234)
668 INT32 WINAPI GetTextFace32A( HDC32 hdc, INT32 count, LPSTR name )
670 FONTOBJ *font;
672 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
673 if (!dc) return 0;
674 if (!(font = (FONTOBJ *) GDI_GetObjPtr( dc->w.hFont, FONT_MAGIC )))
675 return 0;
676 if (name)
677 lstrcpyn32A( name, font->logfont.lfFaceName, count );
678 GDI_HEAP_UNLOCK( dc->w.hFont );
679 if (name)
680 return strlen(name);
681 else
682 return strlen(font->logfont.lfFaceName) + 1;
685 /***********************************************************************
686 * GetTextFace32W (GDI32.235)
688 INT32 WINAPI GetTextFace32W( HDC32 hdc, INT32 count, LPWSTR name )
690 LPSTR nameA = HeapAlloc( GetProcessHeap(), 0, count );
691 INT32 res = GetTextFace32A(hdc,count,nameA);
692 lstrcpyAtoW( name, nameA );
693 HeapFree( GetProcessHeap(), 0, nameA );
694 return res;
698 /***********************************************************************
699 * GetTextExtent (GDI.91)
701 DWORD WINAPI GetTextExtent( HDC16 hdc, LPCSTR str, INT16 count )
703 SIZE16 size;
704 if (!GetTextExtentPoint16( hdc, str, count, &size )) return 0;
705 return MAKELONG( size.cx, size.cy );
709 /***********************************************************************
710 * GetTextExtentPoint16 (GDI.471)
712 * FIXME: Should this have a bug for compatibility?
713 * Original Windows versions of GetTextExtentPoint{A,W} have documented
714 * bugs.
716 BOOL16 WINAPI GetTextExtentPoint16( HDC16 hdc, LPCSTR str, INT16 count,
717 LPSIZE16 size )
719 SIZE32 size32;
720 BOOL32 ret = GetTextExtentPoint32A( hdc, str, count, &size32 );
721 CONV_SIZE32TO16( &size32, size );
722 return (BOOL16)ret;
726 /***********************************************************************
727 * GetTextExtentPoint32A (GDI32.230)
729 BOOL32 WINAPI GetTextExtentPoint32A( HDC32 hdc, LPCSTR str, INT32 count,
730 LPSIZE32 size )
732 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
733 if (!dc)
735 if (!(dc = (DC *)GDI_GetObjPtr( hdc, METAFILE_DC_MAGIC )))
736 return FALSE;
739 if (!dc->funcs->pGetTextExtentPoint ||
740 !dc->funcs->pGetTextExtentPoint( dc, str, count, size ))
741 return FALSE;
743 TRACE(font,"(%08x %s %d %p): returning %d,%d\n",
744 hdc, debugstr_an (str, count), count,
745 size, size->cx, size->cy );
746 return TRUE;
750 /***********************************************************************
751 * GetTextExtentPoint32W [GDI32.231] Computes width/height for a string
753 * Computes width and height of the specified string.
755 * RETURNS
756 * Success: TRUE
757 * Failure: FALSE
759 BOOL32 WINAPI GetTextExtentPoint32W(
760 HDC32 hdc, /* [in] Handle of device context */
761 LPCWSTR str, /* [in] Address of text string */
762 INT32 count, /* [in] Number of characters in string */
763 LPSIZE32 size) /* [out] Address of structure for string size */
765 LPSTR p = HEAP_strdupWtoA( GetProcessHeap(), 0, str );
766 BOOL32 ret = GetTextExtentPoint32A( hdc, p, count, size );
767 HeapFree( GetProcessHeap(), 0, p );
768 return ret;
772 /***********************************************************************
773 * GetTextExtentPoint32ABuggy (GDI32.232)
775 BOOL32 WINAPI GetTextExtentPoint32ABuggy( HDC32 hdc, LPCSTR str, INT32 count,
776 LPSIZE32 size )
778 TRACE(font, "not bug compatible.\n");
779 return GetTextExtentPoint32A( hdc, str, count, size );
782 /***********************************************************************
783 * GetTextExtentPoint32WBuggy (GDI32.233)
785 BOOL32 WINAPI GetTextExtentPoint32WBuggy( HDC32 hdc, LPCWSTR str, INT32 count,
786 LPSIZE32 size )
788 TRACE(font, "not bug compatible.\n");
789 return GetTextExtentPoint32W( hdc, str, count, size );
793 /***********************************************************************
794 * GetTextExtentExPoint32A (GDI32.228)
796 BOOL32 WINAPI GetTextExtentExPoint32A( HDC32 hdc, LPCSTR str, INT32 count,
797 INT32 maxExt, LPINT32 lpnFit,
798 LPINT32 alpDx, LPSIZE32 size )
800 int index, nFit, extent;
801 SIZE32 tSize;
802 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
804 if (!dc)
806 if (!(dc = (DC *)GDI_GetObjPtr( hdc, METAFILE_DC_MAGIC )))
807 return FALSE;
809 if (!dc->funcs->pGetTextExtentPoint) return FALSE;
811 size->cx = size->cy = nFit = extent = 0;
812 for(index = 0; index < count; index++)
814 if(!dc->funcs->pGetTextExtentPoint( dc, str, 1, &tSize )) return FALSE;
815 if( extent+tSize.cx < maxExt )
817 extent+=tSize.cx;
818 nFit++;
819 str++;
820 if( alpDx ) alpDx[index] = extent;
821 if( tSize.cy > size->cy ) size->cy = tSize.cy;
823 else break;
825 size->cx = extent;
826 *lpnFit = nFit;
828 TRACE(font,"(%08x '%.*s' %d) returning %d %d %d\n",
829 hdc,count,str,maxExt,nFit, size->cx,size->cy);
830 return TRUE;
834 /***********************************************************************
835 * GetTextExtentExPoint32W (GDI32.229)
838 BOOL32 WINAPI GetTextExtentExPoint32W( HDC32 hdc, LPCWSTR str, INT32 count,
839 INT32 maxExt, LPINT32 lpnFit,
840 LPINT32 alpDx, LPSIZE32 size )
842 LPSTR p = HEAP_strdupWtoA( GetProcessHeap(), 0, str );
843 BOOL32 ret = GetTextExtentExPoint32A( hdc, p, count, maxExt,
844 lpnFit, alpDx, size);
845 HeapFree( GetProcessHeap(), 0, p );
846 return ret;
849 /***********************************************************************
850 * GetTextMetrics16 (GDI.93)
852 BOOL16 WINAPI GetTextMetrics16( HDC16 hdc, TEXTMETRIC16 *metrics )
854 TEXTMETRIC32A tm32;
856 if (!GetTextMetrics32A( (HDC32)hdc, &tm32 )) return FALSE;
857 FONT_TextMetric32Ato16( &tm32, metrics );
858 return TRUE;
862 /***********************************************************************
863 * GetTextMetrics32A (GDI32.236)
865 BOOL32 WINAPI GetTextMetrics32A( HDC32 hdc, TEXTMETRIC32A *metrics )
867 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
868 if (!dc)
870 if (!(dc = (DC *)GDI_GetObjPtr( hdc, METAFILE_DC_MAGIC )))
871 return FALSE;
874 if (!dc->funcs->pGetTextMetrics ||
875 !dc->funcs->pGetTextMetrics( dc, metrics ))
876 return FALSE;
878 /* device layer returns values in device units
879 * therefore we have to convert them to logical */
881 #define WDPTOLP(x) ((x<0)? \
882 (-abs((x)*dc->wndExtX/dc->vportExtX)): \
883 (abs((x)*dc->wndExtX/dc->vportExtX)))
884 #define HDPTOLP(y) ((y<0)? \
885 (-abs((y)*dc->wndExtY/dc->vportExtY)): \
886 (abs((y)*dc->wndExtY/dc->vportExtY)))
888 metrics->tmHeight = HDPTOLP(metrics->tmHeight);
889 metrics->tmAscent = HDPTOLP(metrics->tmAscent);
890 metrics->tmDescent = HDPTOLP(metrics->tmDescent);
891 metrics->tmInternalLeading = HDPTOLP(metrics->tmInternalLeading);
892 metrics->tmExternalLeading = HDPTOLP(metrics->tmExternalLeading);
893 metrics->tmAveCharWidth = WDPTOLP(metrics->tmAveCharWidth);
894 metrics->tmMaxCharWidth = WDPTOLP(metrics->tmMaxCharWidth);
895 metrics->tmOverhang = WDPTOLP(metrics->tmOverhang);
897 TRACE(font,"text metrics:
898 Weight = %03i\t FirstChar = %03i\t AveCharWidth = %i
899 Italic = % 3i\t LastChar = %03i\t\t MaxCharWidth = %i
900 UnderLined = %01i\t DefaultChar = %03i\t Overhang = %i
901 StruckOut = %01i\t BreakChar = %03i\t CharSet = %i
902 PitchAndFamily = %02x
903 --------------------
904 InternalLeading = %i
905 Ascent = %i
906 Descent = %i
907 Height = %i\n",
908 metrics->tmWeight, metrics->tmFirstChar, metrics->tmAveCharWidth,
909 metrics->tmItalic, metrics->tmLastChar, metrics->tmMaxCharWidth,
910 metrics->tmUnderlined, metrics->tmDefaultChar, metrics->tmOverhang,
911 metrics->tmStruckOut, metrics->tmBreakChar, metrics->tmCharSet,
912 metrics->tmPitchAndFamily,
913 metrics->tmInternalLeading,
914 metrics->tmAscent,
915 metrics->tmDescent,
916 metrics->tmHeight );
917 return TRUE;
921 /***********************************************************************
922 * GetTextMetrics32W (GDI32.237)
924 BOOL32 WINAPI GetTextMetrics32W( HDC32 hdc, TEXTMETRIC32W *metrics )
926 TEXTMETRIC32A tm;
927 if (!GetTextMetrics32A( (HDC16)hdc, &tm )) return FALSE;
928 FONT_TextMetric32Ato32W( &tm, metrics );
929 return TRUE;
933 /***********************************************************************
934 * GetOutlineTextMetrics [GDI.308] Gets metrics for TrueType fonts.
936 * NOTES
937 * lpOTM should be LPOUTLINETEXTMETRIC
939 * RETURNS
940 * Success: Non-zero or size of required buffer
941 * Failure: 0
943 UINT16 WINAPI GetOutlineTextMetrics16(
944 HDC16 hdc, /* [in] Handle of device context */
945 UINT16 cbData, /* [in] Size of metric data array */
946 LPOUTLINETEXTMETRIC16 lpOTM) /* [out] Address of metric data array */
948 FIXME(font, "(%04x,%04x,%p): stub\n", hdc,cbData,lpOTM);
949 return 0;
953 /***********************************************************************
954 * GetOutlineTextMetrics [GDI.207] Gets metrics for TrueType fonts.
957 * RETURNS
958 * Success: Non-zero or size of required buffer
959 * Failure: 0
961 UINT32 WINAPI GetOutlineTextMetrics32A(
962 HDC32 hdc, /* [in] Handle of device context */
963 UINT32 cbData, /* [in] Size of metric data array */
964 LPOUTLINETEXTMETRIC32A lpOTM) /* [out] Address of metric data array */
968 UINT32 rtn = FALSE;
969 LPTEXTMETRIC32A lptxtMetr;
973 if (lpOTM == 0)
976 lpOTM = (LPOUTLINETEXTMETRIC32A)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(OUTLINETEXTMETRIC32A));
977 rtn = sizeof(OUTLINETEXTMETRIC32A);
978 cbData = rtn;
979 } else
981 cbData = sizeof(*lpOTM);
982 rtn = cbData;
985 lpOTM->otmSize = cbData;
987 lptxtMetr =HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(TEXTMETRIC32A));
989 if (!GetTextMetrics32A(hdc,lptxtMetr))
991 return 0;
992 } else
994 memcpy(&(lpOTM->otmTextMetrics),lptxtMetr,sizeof(TEXTMETRIC32A));
997 HeapFree(GetProcessHeap(),HEAP_ZERO_MEMORY,lptxtMetr);
999 lpOTM->otmFilter = 0;
1001 lpOTM->otmPanoseNumber.bFamilyType = 0;
1002 lpOTM->otmPanoseNumber.bSerifStyle = 0;
1003 lpOTM->otmPanoseNumber.bWeight = 0;
1004 lpOTM->otmPanoseNumber.bProportion = 0;
1005 lpOTM->otmPanoseNumber.bContrast = 0;
1006 lpOTM->otmPanoseNumber.bStrokeVariation = 0;
1007 lpOTM->otmPanoseNumber.bArmStyle = 0;
1008 lpOTM->otmPanoseNumber.bLetterform = 0;
1009 lpOTM->otmPanoseNumber.bMidline = 0;
1010 lpOTM->otmPanoseNumber.bXHeight = 0;
1012 lpOTM->otmfsSelection = 0;
1013 lpOTM->otmfsType = 0;
1016 Further fill of the structure not implemented,
1017 Needs real values for the structure members
1020 return rtn;
1023 /***********************************************************************
1024 * GetOutlineTextMetrics32W [GDI32.208]
1026 UINT32 WINAPI GetOutlineTextMetrics32W(
1027 HDC32 hdc, /* [in] Handle of device context */
1028 UINT32 cbData, /* [in] Size of metric data array */
1029 LPOUTLINETEXTMETRIC32W lpOTM) /* [out] Address of metric data array */
1031 FIXME(font, "(%d,%d,%p): stub\n", hdc, cbData, lpOTM);
1032 return 0;
1035 /***********************************************************************
1036 * GetCharWidth16 (GDI.350)
1038 BOOL16 WINAPI GetCharWidth16( HDC16 hdc, UINT16 firstChar, UINT16 lastChar,
1039 LPINT16 buffer )
1041 BOOL32 retVal = FALSE;
1043 if( firstChar != lastChar )
1045 LPINT32 buf32 = (LPINT32)HeapAlloc(GetProcessHeap(), 0,
1046 sizeof(INT32)*(1 + (lastChar - firstChar)));
1047 if( buf32 )
1049 LPINT32 obuf32 = buf32;
1050 int i;
1052 retVal = GetCharWidth32A(hdc, firstChar, lastChar, buf32);
1053 if (retVal)
1055 for (i = firstChar; i <= lastChar; i++)
1056 *buffer++ = *buf32++;
1058 HeapFree(GetProcessHeap(), 0, obuf32);
1061 else /* happens quite often to warrant a special treatment */
1063 INT32 chWidth;
1064 retVal = GetCharWidth32A(hdc, firstChar, lastChar, &chWidth );
1065 *buffer = chWidth;
1067 return retVal;
1071 /***********************************************************************
1072 * GetCharWidth32A (GDI32.155)
1074 BOOL32 WINAPI GetCharWidth32A( HDC32 hdc, UINT32 firstChar, UINT32 lastChar,
1075 LPINT32 buffer )
1077 UINT32 i, extra;
1078 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
1079 if (!dc)
1081 if (!(dc = (DC *)GDI_GetObjPtr( hdc, METAFILE_DC_MAGIC )))
1082 return FALSE;
1085 if (!dc->funcs->pGetCharWidth ||
1086 !dc->funcs->pGetCharWidth( dc, firstChar, lastChar, buffer))
1087 return FALSE;
1089 /* convert device units to logical */
1091 extra = dc->vportExtX >> 1;
1092 for( i = firstChar; i <= lastChar; i++, buffer++ )
1093 *buffer = (*buffer * dc->wndExtX + extra) / dc->vportExtX;
1095 return TRUE;
1099 /***********************************************************************
1100 * GetCharWidth32W (GDI32.158)
1102 BOOL32 WINAPI GetCharWidth32W( HDC32 hdc, UINT32 firstChar, UINT32 lastChar,
1103 LPINT32 buffer )
1105 return GetCharWidth32A( hdc, firstChar, lastChar, buffer );
1110 /* FIXME: all following APIs *******************************************
1113 * SetMapperFlags16 (GDI.349)
1115 DWORD WINAPI SetMapperFlags16( HDC16 hDC, DWORD dwFlag )
1117 return SetMapperFlags32( hDC, dwFlag );
1121 /***********************************************************************
1122 * SetMapperFlags32 (GDI32.322)
1124 DWORD WINAPI SetMapperFlags32( HDC32 hDC, DWORD dwFlag )
1126 FIXME(font, "(0x%04x, 0x%08lx): stub - harmless\n", hDC, dwFlag);
1127 return 0;
1130 /***********************************************************************
1131 * GetAspectRatioFilterEx16 (GDI.486)
1133 BOOL16 WINAPI GetAspectRatioFilterEx16( HDC16 hdc, LPSIZE16 pAspectRatio )
1135 FIXME(font, "(%04x, %p): -- Empty Stub !\n",
1136 hdc, pAspectRatio);
1137 return FALSE;
1140 /***********************************************************************
1141 * GetAspectRatioFilterEx32 (GDI32.142)
1143 BOOL32 WINAPI GetAspectRatioFilterEx32( HDC32 hdc, LPSIZE32 pAspectRatio )
1145 FIXME(font, "(%04x, %p): -- Empty Stub !\n",
1146 hdc, pAspectRatio);
1147 return FALSE;
1150 /***********************************************************************
1151 * GetCharABCWidths16 (GDI.307)
1153 BOOL16 WINAPI GetCharABCWidths16( HDC16 hdc, UINT16 firstChar, UINT16 lastChar,
1154 LPABC16 abc )
1156 ABC32 abc32;
1157 if (!GetCharABCWidths32A( hdc, firstChar, lastChar, &abc32 )) return FALSE;
1158 abc->abcA = abc32.abcA;
1159 abc->abcB = abc32.abcB;
1160 abc->abcC = abc32.abcC;
1161 return TRUE;
1165 /***********************************************************************
1166 * GetCharABCWidths32A (GDI32.149)
1168 BOOL32 WINAPI GetCharABCWidths32A(HDC32 hdc, UINT32 firstChar, UINT32 lastChar,
1169 LPABC32 abc )
1171 return GetCharABCWidths32W( hdc, firstChar, lastChar, abc );
1175 /******************************************************************************
1176 * GetCharABCWidths32W [GDI32.152] Retrieves widths of characters in range
1178 * PARAMS
1179 * hdc [I] Handle of device context
1180 * firstChar [I] First character in range to query
1181 * lastChar [I] Last character in range to query
1182 * abc [O] Address of character-width structure
1184 * NOTES
1185 * Only works with TrueType fonts
1187 * RETURNS
1188 * Success: TRUE
1189 * Failure: FALSE
1191 BOOL32 WINAPI GetCharABCWidths32W( HDC32 hdc, UINT32 firstChar, UINT32 lastChar,
1192 LPABC32 abc )
1194 /* No TrueType fonts in Wine so far */
1195 FIXME(font, "(%04x,%04x,%04x,%p): stub\n", hdc, firstChar, lastChar, abc);
1196 return FALSE;
1200 /***********************************************************************
1201 * GetGlyphOutline16 (GDI.309)
1203 DWORD WINAPI GetGlyphOutline16( HDC16 hdc, UINT16 uChar, UINT16 fuFormat,
1204 LPGLYPHMETRICS16 lpgm, DWORD cbBuffer,
1205 LPVOID lpBuffer, const MAT2 *lpmat2 )
1207 FIXME(font,"(%04x, '%c', %04x, %p, %ld, %p, %p): stub\n",
1208 hdc, uChar, fuFormat, lpgm, cbBuffer, lpBuffer, lpmat2 );
1209 return (DWORD)-1; /* failure */
1213 /***********************************************************************
1214 * GetGlyphOutline32A (GDI32.186)
1216 DWORD WINAPI GetGlyphOutline32A( HDC32 hdc, UINT32 uChar, UINT32 fuFormat,
1217 LPGLYPHMETRICS32 lpgm, DWORD cbBuffer,
1218 LPVOID lpBuffer, const MAT2 *lpmat2 )
1220 FIXME(font,"(%04x, '%c', %04x, %p, %ld, %p, %p): stub\n",
1221 hdc, uChar, fuFormat, lpgm, cbBuffer, lpBuffer, lpmat2 );
1222 return (DWORD)-1; /* failure */
1225 /***********************************************************************
1226 * GetGlyphOutline32W (GDI32.187)
1228 DWORD WINAPI GetGlyphOutline32W( HDC32 hdc, UINT32 uChar, UINT32 fuFormat,
1229 LPGLYPHMETRICS32 lpgm, DWORD cbBuffer,
1230 LPVOID lpBuffer, const MAT2 *lpmat2 )
1232 FIXME(font,"(%04x, '%c', %04x, %p, %ld, %p, %p): stub\n",
1233 hdc, uChar, fuFormat, lpgm, cbBuffer, lpBuffer, lpmat2 );
1234 return (DWORD)-1; /* failure */
1237 /***********************************************************************
1238 * CreateScalableFontResource16 (GDI.310)
1240 BOOL16 WINAPI CreateScalableFontResource16( UINT16 fHidden,
1241 LPCSTR lpszResourceFile,
1242 LPCSTR fontFile, LPCSTR path )
1244 return CreateScalableFontResource32A( fHidden, lpszResourceFile,
1245 fontFile, path );
1248 /***********************************************************************
1249 * CreateScalableFontResource32A (GDI32.62)
1251 BOOL32 WINAPI CreateScalableFontResource32A( DWORD fHidden,
1252 LPCSTR lpszResourceFile,
1253 LPCSTR lpszFontFile,
1254 LPCSTR lpszCurrentPath )
1256 /* fHidden=1 - only visible for the calling app, read-only, not
1257 * enumbered with EnumFonts/EnumFontFamilies
1258 * lpszCurrentPath can be NULL
1260 FIXME(font,"(%ld,%s,%s,%s): stub\n",
1261 fHidden, lpszResourceFile, lpszFontFile, lpszCurrentPath );
1262 return FALSE; /* create failed */
1265 /***********************************************************************
1266 * CreateScalableFontResource32W (GDI32.63)
1268 BOOL32 WINAPI CreateScalableFontResource32W( DWORD fHidden,
1269 LPCWSTR lpszResourceFile,
1270 LPCWSTR lpszFontFile,
1271 LPCWSTR lpszCurrentPath )
1273 FIXME(font,"(%ld,%p,%p,%p): stub\n",
1274 fHidden, lpszResourceFile, lpszFontFile, lpszCurrentPath );
1275 return FALSE; /* create failed */
1279 /*************************************************************************
1280 * GetRasterizerCaps16 (GDI.313)
1282 BOOL16 WINAPI GetRasterizerCaps16( LPRASTERIZER_STATUS lprs, UINT16 cbNumBytes)
1284 return GetRasterizerCaps32( lprs, cbNumBytes );
1288 /*************************************************************************
1289 * GetRasterizerCaps32 (GDI32.216)
1291 BOOL32 WINAPI GetRasterizerCaps32( LPRASTERIZER_STATUS lprs, UINT32 cbNumBytes)
1293 lprs->nSize = sizeof(RASTERIZER_STATUS);
1294 lprs->wFlags = TT_AVAILABLE|TT_ENABLED;
1295 lprs->nLanguageID = 0;
1296 return TRUE;
1300 /*************************************************************************
1301 * GetKerningPairs16 (GDI.332)
1303 INT16 WINAPI GetKerningPairs16( HDC16 hDC, INT16 cPairs,
1304 LPKERNINGPAIR16 lpKerningPairs )
1306 /* At this time kerning is ignored (set to 0) */
1307 int i;
1308 FIXME(font,"(%x,%d,%p): almost empty stub!\n",
1309 hDC, cPairs, lpKerningPairs);
1310 for (i = 0; i < cPairs; i++)
1311 lpKerningPairs[i].iKernAmount = 0;
1312 return 0;
1317 /*************************************************************************
1318 * GetKerningPairs32A (GDI32.192)
1320 DWORD WINAPI GetKerningPairs32A( HDC32 hDC, DWORD cPairs,
1321 LPKERNINGPAIR32 lpKerningPairs )
1323 int i;
1324 FIXME(font,"(%x,%ld,%p): almost empty stub!\n",
1325 hDC, cPairs, lpKerningPairs);
1326 for (i = 0; i < cPairs; i++)
1327 lpKerningPairs[i].iKernAmount = 0;
1328 return 0;
1332 /*************************************************************************
1333 * GetKerningPairs32W (GDI32.193)
1335 DWORD WINAPI GetKerningPairs32W( HDC32 hDC, DWORD cPairs,
1336 LPKERNINGPAIR32 lpKerningPairs )
1338 return GetKerningPairs32A( hDC, cPairs, lpKerningPairs );
1341 /*************************************************************************
1342 * TranslateCharsetInfo [GDI32.382]
1344 * Fills a CHARSETINFO structure for a character set, code page, or
1345 * font. This allows making the correspondance between different labelings
1346 * (character set, Windows, ANSI, and OEM codepages, and Unicode ranges)
1347 * of the same encoding.
1349 * Only one codepage will be set in lpCs->fs. If TCI_SRCFONTSIG is used,
1350 * only one codepage should be set in *lpSrc.
1352 * RETURNS
1353 * TRUE on success, FALSE on failure.
1355 * BUGS
1356 * Not implemented.
1358 BOOL32 WINAPI TranslateCharsetInfo(
1359 LPDWORD lpSrc, /*
1360 if flags == TCI_SRCFONTSIG: pointer to fsCsb of a FONTSIGNATURE
1361 if flags == TCI_SRCCHARSET: a character set value
1362 if flags == TCI_SRCCODEPAGE: a code page value
1364 LPCHARSETINFO lpCs, /* structure to receive charset information */
1365 DWORD flags /* determines interpretation of lpSrc */
1367 FIXME(font,"(%p,%p,0x%08lx), stub.\n",lpSrc,lpCs, flags);
1368 return TRUE;
1371 /*************************************************************************
1372 * GetFontLanguageInfo (GDI32.182)
1374 DWORD WINAPI GetFontLanguageInfo32(HDC32 hdc) {
1375 /* return value 0 is correct for most cases anyway */
1376 FIXME(font,"(%x):stub!\n", hdc);
1377 return 0;
1380 /*************************************************************************
1381 * GetFontLanguageInfo (GDI.616)
1383 DWORD WINAPI GetFontLanguageInfo16(HDC16 hdc) {
1384 /* return value 0 is correct for most cases anyway */
1385 FIXME(font,"(%x):stub!\n",hdc);
1386 return 0;
1389 /*************************************************************************
1390 * GetFontData32 [GDI32.181] Retrieve data for TrueType font
1392 * RETURNS
1394 * success: Number of bytes returned
1395 * failure: GDI_ERROR
1397 * NOTES
1399 * Calls SetLastError()
1401 * BUGS
1403 * Unimplemented
1405 DWORD WINAPI GetFontData32(HDC32 hdc, DWORD table, DWORD offset,
1406 LPVOID buffer, DWORD length)
1408 FIXME(font, "(%x,%ld,%ld,%p,%ld): stub\n",
1409 hdc, table, offset, buffer, length);
1410 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1411 return GDI_ERROR;
1414 /*************************************************************************
1415 * GetCharacterPlacement32A [GDI32.160]
1417 DWORD WINAPI
1418 GetCharacterPlacement32A(HDC32 hdc, LPCSTR lpString, INT32 uCount,
1419 INT32 nMaxExtent, GCP_RESULTS32A *lpResults,
1420 DWORD dwFlags)
1422 /* return value 0 is correct for most cases anyway */
1423 FIXME(font,":stub!\n");
1424 return 0;
1427 /*************************************************************************
1428 * GetCharacterPlacement32W [GDI32.161]
1430 DWORD WINAPI
1431 GetCharacterPlacement32W(HDC32 hdc, LPCWSTR lpString, INT32 uCount,
1432 INT32 nMaxExtent, GCP_RESULTS32W *lpResults,
1433 DWORD dwFlags)
1435 /* return value 0 is correct for most cases anyway */
1436 FIXME(font,":stub!\n");
1437 return 0;
1440 /*************************************************************************
1441 * GetCharABCWidthsFloat32A [GDI32.150]
1443 BOOL32 WINAPI GetCharABCWidthsFloat32A(HDC32 hdc, UINT32 iFirstChar, UINT32 iLastChar,
1444 LPABCFLOAT lpABCF)
1446 FIXME(gdi, "GetCharABCWidthsFloatA, stub\n");
1447 return 0;
1450 /*************************************************************************
1451 * GetCharABCWidthsFloat32W [GDI32.151]
1453 BOOL32 WINAPI GetCharABCWidthsFloat32W(HDC32 hdc, UINT32 iFirstChar,
1454 UINT32 iLastChar, LPABCFLOAT lpABCF)
1456 FIXME(gdi, "GetCharABCWidthsFloatW, stub\n");
1457 return 0;
1460 /*************************************************************************
1461 * GetCharWidthFloat32A [GDI32.156]
1463 BOOL32 WINAPI GetCharWidthFloat32A(HDC32 hdc, UINT32 iFirstChar,
1464 UINT32 iLastChar, PFLOAT pxBuffer)
1466 FIXME(gdi, "GetCharWidthFloatA, stub\n");
1467 return 0;
1470 /*************************************************************************
1471 * GetCharWidthFloat32W [GDI32.157]
1473 BOOL32 WINAPI GetCharWidthFloat32W(HDC32 hdc, UINT32 iFirstChar,
1474 UINT32 iLastChar, PFLOAT pxBuffer)
1476 FIXME(gdi, "GetCharWidthFloatW, stub\n");
1477 return 0;