Added Makefile.
[wine.git] / objects / font.c
blob9e0d53417e98898d46e121fda3920efbb0602860
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;
1141 /***********************************************************************
1142 * GetCharABCWidths16 (GDI.307)
1144 BOOL16 WINAPI GetCharABCWidths16( HDC16 hdc, UINT16 firstChar, UINT16 lastChar,
1145 LPABC16 abc )
1147 ABC32 abc32;
1148 if (!GetCharABCWidths32A( hdc, firstChar, lastChar, &abc32 )) return FALSE;
1149 abc->abcA = abc32.abcA;
1150 abc->abcB = abc32.abcB;
1151 abc->abcC = abc32.abcC;
1152 return TRUE;
1156 /***********************************************************************
1157 * GetCharABCWidths32A (GDI32.149)
1159 BOOL32 WINAPI GetCharABCWidths32A(HDC32 hdc, UINT32 firstChar, UINT32 lastChar,
1160 LPABC32 abc )
1162 return GetCharABCWidths32W( hdc, firstChar, lastChar, abc );
1166 /******************************************************************************
1167 * GetCharABCWidths32W [GDI32.152] Retrieves widths of characters in range
1169 * PARAMS
1170 * hdc [I] Handle of device context
1171 * firstChar [I] First character in range to query
1172 * lastChar [I] Last character in range to query
1173 * abc [O] Address of character-width structure
1175 * NOTES
1176 * Only works with TrueType fonts
1178 * RETURNS
1179 * Success: TRUE
1180 * Failure: FALSE
1182 BOOL32 WINAPI GetCharABCWidths32W( HDC32 hdc, UINT32 firstChar, UINT32 lastChar,
1183 LPABC32 abc )
1185 /* No TrueType fonts in Wine so far */
1186 FIXME(font, "(%04x,%04x,%04x,%p): stub\n", hdc, firstChar, lastChar, abc);
1187 return FALSE;
1191 /***********************************************************************
1192 * GetGlyphOutline16 (GDI.309)
1194 DWORD WINAPI GetGlyphOutline16( HDC16 hdc, UINT16 uChar, UINT16 fuFormat,
1195 LPGLYPHMETRICS16 lpgm, DWORD cbBuffer,
1196 LPVOID lpBuffer, const MAT2 *lpmat2 )
1198 FIXME(font,"(%04x, '%c', %04x, %p, %ld, %p, %p): stub\n",
1199 hdc, uChar, fuFormat, lpgm, cbBuffer, lpBuffer, lpmat2 );
1200 return (DWORD)-1; /* failure */
1204 /***********************************************************************
1205 * GetGlyphOutline32A (GDI32.186)
1207 DWORD WINAPI GetGlyphOutline32A( HDC32 hdc, UINT32 uChar, UINT32 fuFormat,
1208 LPGLYPHMETRICS32 lpgm, DWORD cbBuffer,
1209 LPVOID lpBuffer, const MAT2 *lpmat2 )
1211 FIXME(font,"(%04x, '%c', %04x, %p, %ld, %p, %p): stub\n",
1212 hdc, uChar, fuFormat, lpgm, cbBuffer, lpBuffer, lpmat2 );
1213 return (DWORD)-1; /* failure */
1216 /***********************************************************************
1217 * GetGlyphOutline32W (GDI32.187)
1219 DWORD WINAPI GetGlyphOutline32W( HDC32 hdc, UINT32 uChar, UINT32 fuFormat,
1220 LPGLYPHMETRICS32 lpgm, DWORD cbBuffer,
1221 LPVOID lpBuffer, const MAT2 *lpmat2 )
1223 FIXME(font,"(%04x, '%c', %04x, %p, %ld, %p, %p): stub\n",
1224 hdc, uChar, fuFormat, lpgm, cbBuffer, lpBuffer, lpmat2 );
1225 return (DWORD)-1; /* failure */
1228 /***********************************************************************
1229 * CreateScalableFontResource16 (GDI.310)
1231 BOOL16 WINAPI CreateScalableFontResource16( UINT16 fHidden,
1232 LPCSTR lpszResourceFile,
1233 LPCSTR fontFile, LPCSTR path )
1235 return CreateScalableFontResource32A( fHidden, lpszResourceFile,
1236 fontFile, path );
1239 /***********************************************************************
1240 * CreateScalableFontResource32A (GDI32.62)
1242 BOOL32 WINAPI CreateScalableFontResource32A( DWORD fHidden,
1243 LPCSTR lpszResourceFile,
1244 LPCSTR lpszFontFile,
1245 LPCSTR lpszCurrentPath )
1247 /* fHidden=1 - only visible for the calling app, read-only, not
1248 * enumbered with EnumFonts/EnumFontFamilies
1249 * lpszCurrentPath can be NULL
1251 FIXME(font,"(%ld,%s,%s,%s): stub\n",
1252 fHidden, lpszResourceFile, lpszFontFile, lpszCurrentPath );
1253 return FALSE; /* create failed */
1256 /***********************************************************************
1257 * CreateScalableFontResource32W (GDI32.63)
1259 BOOL32 WINAPI CreateScalableFontResource32W( DWORD fHidden,
1260 LPCWSTR lpszResourceFile,
1261 LPCWSTR lpszFontFile,
1262 LPCWSTR lpszCurrentPath )
1264 FIXME(font,"(%ld,%p,%p,%p): stub\n",
1265 fHidden, lpszResourceFile, lpszFontFile, lpszCurrentPath );
1266 return FALSE; /* create failed */
1270 /*************************************************************************
1271 * GetRasterizerCaps16 (GDI.313)
1273 BOOL16 WINAPI GetRasterizerCaps16( LPRASTERIZER_STATUS lprs, UINT16 cbNumBytes)
1275 return GetRasterizerCaps32( lprs, cbNumBytes );
1279 /*************************************************************************
1280 * GetRasterizerCaps32 (GDI32.216)
1282 BOOL32 WINAPI GetRasterizerCaps32( LPRASTERIZER_STATUS lprs, UINT32 cbNumBytes)
1284 lprs->nSize = sizeof(RASTERIZER_STATUS);
1285 lprs->wFlags = TT_AVAILABLE|TT_ENABLED;
1286 lprs->nLanguageID = 0;
1287 return TRUE;
1291 /*************************************************************************
1292 * GetKerningPairs16 (GDI.332)
1294 INT16 WINAPI GetKerningPairs16( HDC16 hDC, INT16 cPairs,
1295 LPKERNINGPAIR16 lpKerningPairs )
1297 /* At this time kerning is ignored (set to 0) */
1298 int i;
1299 FIXME(font,"(%x,%d,%p): almost empty stub!\n",
1300 hDC, cPairs, lpKerningPairs);
1301 for (i = 0; i < cPairs; i++)
1302 lpKerningPairs[i].iKernAmount = 0;
1303 return 0;
1308 /*************************************************************************
1309 * GetKerningPairs32A (GDI32.192)
1311 DWORD WINAPI GetKerningPairs32A( HDC32 hDC, DWORD cPairs,
1312 LPKERNINGPAIR32 lpKerningPairs )
1314 int i;
1315 FIXME(font,"(%x,%ld,%p): almost empty stub!\n",
1316 hDC, cPairs, lpKerningPairs);
1317 for (i = 0; i < cPairs; i++)
1318 lpKerningPairs[i].iKernAmount = 0;
1319 return 0;
1323 /*************************************************************************
1324 * GetKerningPairs32W (GDI32.193)
1326 DWORD WINAPI GetKerningPairs32W( HDC32 hDC, DWORD cPairs,
1327 LPKERNINGPAIR32 lpKerningPairs )
1329 return GetKerningPairs32A( hDC, cPairs, lpKerningPairs );
1332 /*************************************************************************
1333 * TranslateCharSetInfo [GDI32.382]
1335 BOOL32 WINAPI TranslateCharSetInfo(LPDWORD lpSrc,LPCHARSETINFO lpCs,DWORD dwFlags) {
1336 FIXME(font,"(%p,%p,0x%08lx), stub.\n",lpSrc,lpCs,dwFlags);
1337 return TRUE;
1340 /*************************************************************************
1341 * GetFontLanguageInfo (GDI32.182)
1343 DWORD WINAPI GetFontLanguageInfo32(HDC32 hdc) {
1344 /* return value 0 is correct for most cases anyway */
1345 FIXME(font,"(%x):stub!\n", hdc);
1346 return 0;
1349 /*************************************************************************
1350 * GetFontLanguageInfo (GDI.616)
1352 DWORD WINAPI GetFontLanguageInfo16(HDC16 hdc) {
1353 /* return value 0 is correct for most cases anyway */
1354 FIXME(font,"(%x):stub!\n",hdc);
1355 return 0;
1358 /*************************************************************************
1359 * GetFontData32 [GDI32.181] Retrieve data for TrueType font
1361 * RETURNS
1363 * success: Number of bytes returned
1364 * failure: GDI_ERROR
1366 * NOTES
1368 * Calls SetLastError()
1370 * BUGS
1372 * Unimplemented
1374 DWORD WINAPI GetFontData32(HDC32 hdc, DWORD table, DWORD offset,
1375 LPVOID buffer, DWORD length)
1377 FIXME(font, "(%x,%ld,%ld,%p,%ld): stub\n",
1378 hdc, table, offset, buffer, length);
1379 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1380 return GDI_ERROR;
1383 /*************************************************************************
1384 * GetCharacterPlacement32A [GDI32.160]
1386 DWORD WINAPI
1387 GetCharacterPlacement32A(HDC32 hdc, LPCSTR lpString, INT32 uCount,
1388 INT32 nMaxExtent, GCP_RESULTS32A *lpResults,
1389 DWORD dwFlags)
1391 /* return value 0 is correct for most cases anyway */
1392 FIXME(font,":stub!\n");
1393 return 0;
1396 /*************************************************************************
1397 * GetCharacterPlacement32W [GDI32.161]
1399 DWORD WINAPI
1400 GetCharacterPlacement32W(HDC32 hdc, LPCWSTR lpString, INT32 uCount,
1401 INT32 nMaxExtent, GCP_RESULTS32W *lpResults,
1402 DWORD dwFlags)
1404 /* return value 0 is correct for most cases anyway */
1405 FIXME(font,":stub!\n");
1406 return 0;