Authors: Chris Morgan <cmorgan@wpi.edu>, James Abbatiello <abbejy@wpi.edu>
[wine/multimedia.git] / objects / font.c
blob106bc76e8c69e6c6e7b66a447864de51da2d521d
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 "wine/winestring.h"
11 #include "font.h"
12 #include "heap.h"
13 #include "metafile.h"
14 #include "options.h"
15 #include "debug.h"
16 #include "winerror.h"
18 DECLARE_DEBUG_CHANNEL(font)
19 DECLARE_DEBUG_CHANNEL(gdi)
21 #define ENUM_UNICODE 0x00000001
23 typedef struct
25 LPLOGFONT16 lpLogFontParam;
26 FONTENUMPROCEX16 lpEnumFunc;
27 LPARAM lpData;
29 LPNEWTEXTMETRICEX16 lpTextMetric;
30 LPENUMLOGFONTEX16 lpLogFont;
31 SEGPTR segTextMetric;
32 SEGPTR segLogFont;
33 } fontEnum16;
35 typedef struct
37 LPLOGFONTW lpLogFontParam;
38 FONTENUMPROCW lpEnumFunc;
39 LPARAM lpData;
41 LPNEWTEXTMETRICEXW lpTextMetric;
42 LPENUMLOGFONTEXW lpLogFont;
43 DWORD dwFlags;
44 } fontEnum32;
47 * For TranslateCharsetInfo
49 #define FS(x) {{0,0,0,0},{0x1<<(x),0}}
50 #define MAXTCIINDEX 32
51 static CHARSETINFO FONT_tci[MAXTCIINDEX] = {
52 /* ANSI */
53 { ANSI_CHARSET, 1252, FS(0)},
54 { EASTEUROPE_CHARSET, 1250, FS(1)},
55 { RUSSIAN_CHARSET, 1251, FS(2)},
56 { GREEK_CHARSET, 1253, FS(3)},
57 { TURKISH_CHARSET, 1254, FS(4)},
58 { HEBREW_CHARSET, 1255, FS(5)},
59 { ARABIC_CHARSET, 1256, FS(6)},
60 { BALTIC_CHARSET, 1257, FS(7)},
61 /* reserved by ANSI */
62 { DEFAULT_CHARSET, 0, FS(0)},
63 { DEFAULT_CHARSET, 0, FS(0)},
64 { DEFAULT_CHARSET, 0, FS(0)},
65 { DEFAULT_CHARSET, 0, FS(0)},
66 { DEFAULT_CHARSET, 0, FS(0)},
67 { DEFAULT_CHARSET, 0, FS(0)},
68 { DEFAULT_CHARSET, 0, FS(0)},
69 { DEFAULT_CHARSET, 0, FS(0)},
70 /* ANSI and OEM */
71 { THAI_CHARSET, 874, FS(16)},
72 { SHIFTJIS_CHARSET, 932, FS(17)},
73 { GB2312_CHARSET, 936, FS(18)},
74 { HANGEUL_CHARSET, 949, FS(19)},
75 { CHINESEBIG5_CHARSET, 950, FS(20)},
76 { JOHAB_CHARSET, 1361, FS(21)},
77 /* reserved for alternate ANSI and OEM */
78 { DEFAULT_CHARSET, 0, FS(0)},
79 { DEFAULT_CHARSET, 0, FS(0)},
80 { DEFAULT_CHARSET, 0, FS(0)},
81 { DEFAULT_CHARSET, 0, FS(0)},
82 { DEFAULT_CHARSET, 0, FS(0)},
83 { DEFAULT_CHARSET, 0, FS(0)},
84 { DEFAULT_CHARSET, 0, FS(0)},
85 { DEFAULT_CHARSET, 0, FS(0)},
86 /* reserved for system */
87 { DEFAULT_CHARSET, 0, FS(0)},
88 { DEFAULT_CHARSET, 0, FS(0)},
91 /***********************************************************************
92 * LOGFONT conversion functions.
94 static void __logfont32to16( INT16* plf16, const INT* plf32 )
96 int i;
97 for( i = 0; i < 5; i++ ) *plf16++ = *plf32++;
98 *((INT*)plf16)++ = *plf32++;
99 *((INT*)plf16) = *plf32;
102 static void __logfont16to32( INT* plf32, const INT16* plf16 )
104 int i;
105 for( i = 0; i < 5; i++ ) *plf32++ = *plf16++;
106 *plf32++ = *((INT*)plf16)++;
107 *plf32 = *((INT*)plf16);
110 void FONT_LogFont32ATo16( const LOGFONTA* font32, LPLOGFONT16 font16 )
112 __logfont32to16( (INT16*)font16, (const INT*)font32 );
113 lstrcpynA( font16->lfFaceName, font32->lfFaceName, LF_FACESIZE );
116 void FONT_LogFont32WTo16( const LOGFONTW* font32, LPLOGFONT16 font16 )
118 __logfont32to16( (INT16*)font16, (const INT*)font32 );
119 lstrcpynWtoA( font16->lfFaceName, font32->lfFaceName, LF_FACESIZE );
122 void FONT_LogFont16To32A( const LPLOGFONT16 font16, LPLOGFONTA font32 )
124 __logfont16to32( (INT*)font32, (const INT16*)font16 );
125 lstrcpynA( font32->lfFaceName, font16->lfFaceName, LF_FACESIZE );
128 void FONT_LogFont16To32W( const LPLOGFONT16 font16, LPLOGFONTW font32 )
130 __logfont16to32( (INT*)font32, (const INT16*)font16 );
131 lstrcpynAtoW( font32->lfFaceName, font16->lfFaceName, LF_FACESIZE );
134 /***********************************************************************
135 * TEXTMETRIC conversion functions.
137 void FONT_TextMetric32Ato16(const LPTEXTMETRICA ptm32, LPTEXTMETRIC16 ptm16 )
139 ptm16->tmHeight = ptm32->tmHeight;
140 ptm16->tmAscent = ptm32->tmAscent;
141 ptm16->tmDescent = ptm32->tmDescent;
142 ptm16->tmInternalLeading = ptm32->tmInternalLeading;
143 ptm16->tmExternalLeading = ptm32->tmExternalLeading;
144 ptm16->tmAveCharWidth = ptm32->tmAveCharWidth;
145 ptm16->tmMaxCharWidth = ptm32->tmMaxCharWidth;
146 ptm16->tmWeight = ptm32->tmWeight;
147 ptm16->tmOverhang = ptm32->tmOverhang;
148 ptm16->tmDigitizedAspectX = ptm32->tmDigitizedAspectX;
149 ptm16->tmDigitizedAspectY = ptm32->tmDigitizedAspectY;
150 ptm16->tmFirstChar = ptm32->tmFirstChar;
151 ptm16->tmLastChar = ptm32->tmLastChar;
152 ptm16->tmDefaultChar = ptm32->tmDefaultChar;
153 ptm16->tmBreakChar = ptm32->tmBreakChar;
154 ptm16->tmItalic = ptm32->tmItalic;
155 ptm16->tmUnderlined = ptm32->tmUnderlined;
156 ptm16->tmStruckOut = ptm32->tmStruckOut;
157 ptm16->tmPitchAndFamily = ptm32->tmPitchAndFamily;
158 ptm16->tmCharSet = ptm32->tmCharSet;
161 void FONT_TextMetric32Wto16(const LPTEXTMETRICW ptm32, LPTEXTMETRIC16 ptm16 )
163 ptm16->tmHeight = ptm32->tmHeight;
164 ptm16->tmAscent = ptm32->tmAscent;
165 ptm16->tmDescent = ptm32->tmDescent;
166 ptm16->tmInternalLeading = ptm32->tmInternalLeading;
167 ptm16->tmExternalLeading = ptm32->tmExternalLeading;
168 ptm16->tmAveCharWidth = ptm32->tmAveCharWidth;
169 ptm16->tmMaxCharWidth = ptm32->tmMaxCharWidth;
170 ptm16->tmWeight = ptm32->tmWeight;
171 ptm16->tmOverhang = ptm32->tmOverhang;
172 ptm16->tmDigitizedAspectX = ptm32->tmDigitizedAspectX;
173 ptm16->tmDigitizedAspectY = ptm32->tmDigitizedAspectY;
174 ptm16->tmFirstChar = ptm32->tmFirstChar;
175 ptm16->tmLastChar = ptm32->tmLastChar;
176 ptm16->tmDefaultChar = ptm32->tmDefaultChar;
177 ptm16->tmBreakChar = ptm32->tmBreakChar;
178 ptm16->tmItalic = ptm32->tmItalic;
179 ptm16->tmUnderlined = ptm32->tmUnderlined;
180 ptm16->tmStruckOut = ptm32->tmStruckOut;
181 ptm16->tmPitchAndFamily = ptm32->tmPitchAndFamily;
182 ptm16->tmCharSet = ptm32->tmCharSet;
185 void FONT_TextMetric16to32A(const LPTEXTMETRIC16 ptm16, LPTEXTMETRICA ptm32 )
187 ptm32->tmHeight = ptm16->tmHeight;
188 ptm32->tmAscent = ptm16->tmAscent;
189 ptm32->tmDescent = ptm16->tmDescent;
190 ptm32->tmInternalLeading = ptm16->tmInternalLeading;
191 ptm32->tmExternalLeading = ptm16->tmExternalLeading;
192 ptm32->tmAveCharWidth = ptm16->tmAveCharWidth;
193 ptm32->tmMaxCharWidth = ptm16->tmMaxCharWidth;
194 ptm32->tmWeight = ptm16->tmWeight;
195 ptm32->tmOverhang = ptm16->tmOverhang;
196 ptm32->tmDigitizedAspectX = ptm16->tmDigitizedAspectX;
197 ptm32->tmDigitizedAspectY = ptm16->tmDigitizedAspectY;
198 ptm32->tmFirstChar = ptm16->tmFirstChar;
199 ptm32->tmLastChar = ptm16->tmLastChar;
200 ptm32->tmDefaultChar = ptm16->tmDefaultChar;
201 ptm32->tmBreakChar = ptm16->tmBreakChar;
202 ptm32->tmItalic = ptm16->tmItalic;
203 ptm32->tmUnderlined = ptm16->tmUnderlined;
204 ptm32->tmStruckOut = ptm16->tmStruckOut;
205 ptm32->tmPitchAndFamily = ptm16->tmPitchAndFamily;
206 ptm32->tmCharSet = ptm16->tmCharSet;
209 void FONT_TextMetric16to32W(const LPTEXTMETRIC16 ptm16, LPTEXTMETRICW ptm32 )
211 ptm32->tmHeight = ptm16->tmHeight;
212 ptm32->tmAscent = ptm16->tmAscent;
213 ptm32->tmDescent = ptm16->tmDescent;
214 ptm32->tmInternalLeading = ptm16->tmInternalLeading;
215 ptm32->tmExternalLeading = ptm16->tmExternalLeading;
216 ptm32->tmAveCharWidth = ptm16->tmAveCharWidth;
217 ptm32->tmMaxCharWidth = ptm16->tmMaxCharWidth;
218 ptm32->tmWeight = ptm16->tmWeight;
219 ptm32->tmOverhang = ptm16->tmOverhang;
220 ptm32->tmDigitizedAspectX = ptm16->tmDigitizedAspectX;
221 ptm32->tmDigitizedAspectY = ptm16->tmDigitizedAspectY;
222 ptm32->tmFirstChar = ptm16->tmFirstChar;
223 ptm32->tmLastChar = ptm16->tmLastChar;
224 ptm32->tmDefaultChar = ptm16->tmDefaultChar;
225 ptm32->tmBreakChar = ptm16->tmBreakChar;
226 ptm32->tmItalic = ptm16->tmItalic;
227 ptm32->tmUnderlined = ptm16->tmUnderlined;
228 ptm32->tmStruckOut = ptm16->tmStruckOut;
229 ptm32->tmPitchAndFamily = ptm16->tmPitchAndFamily;
230 ptm32->tmCharSet = ptm16->tmCharSet;
233 void FONT_TextMetric32Ato32W(const LPTEXTMETRICA ptm32A, LPTEXTMETRICW ptm32W )
235 ptm32W->tmHeight = ptm32A->tmHeight;
236 ptm32W->tmAscent = ptm32A->tmAscent;
237 ptm32W->tmDescent = ptm32A->tmDescent;
238 ptm32W->tmInternalLeading = ptm32A->tmInternalLeading;
239 ptm32W->tmExternalLeading = ptm32A->tmExternalLeading;
240 ptm32W->tmAveCharWidth = ptm32A->tmAveCharWidth;
241 ptm32W->tmMaxCharWidth = ptm32A->tmMaxCharWidth;
242 ptm32W->tmWeight = ptm32A->tmWeight;
243 ptm32W->tmOverhang = ptm32A->tmOverhang;
244 ptm32W->tmDigitizedAspectX = ptm32A->tmDigitizedAspectX;
245 ptm32W->tmDigitizedAspectY = ptm32A->tmDigitizedAspectY;
246 ptm32W->tmFirstChar = ptm32A->tmFirstChar;
247 ptm32W->tmLastChar = ptm32A->tmLastChar;
248 ptm32W->tmDefaultChar = ptm32A->tmDefaultChar;
249 ptm32W->tmBreakChar = ptm32A->tmBreakChar;
250 ptm32W->tmItalic = ptm32A->tmItalic;
251 ptm32W->tmUnderlined = ptm32A->tmUnderlined;
252 ptm32W->tmStruckOut = ptm32A->tmStruckOut;
253 ptm32W->tmPitchAndFamily = ptm32A->tmPitchAndFamily;
254 ptm32W->tmCharSet = ptm32A->tmCharSet;
257 /***********************************************************************
258 * CreateFontIndirect16 (GDI.57)
260 HFONT16 WINAPI CreateFontIndirect16( const LOGFONT16 *font )
262 HFONT16 hFont = 0;
264 if (font)
266 hFont = GDI_AllocObject( sizeof(FONTOBJ), FONT_MAGIC );
267 if( hFont )
269 FONTOBJ* fontPtr;
270 fontPtr = (FONTOBJ *) GDI_HEAP_LOCK( hFont );
271 memcpy( &fontPtr->logfont, font, sizeof(LOGFONT16) );
273 TRACE(font,"(%i %i %i %i) '%s' %s %s => %04x\n",
274 font->lfHeight, font->lfWidth,
275 font->lfEscapement, font->lfOrientation,
276 font->lfFaceName ? font->lfFaceName : "NULL",
277 font->lfWeight > 400 ? "Bold" : "",
278 font->lfItalic ? "Italic" : "",
279 hFont);
281 if (font->lfEscapement != font->lfOrientation) {
282 /* this should really depend on whether GM_ADVANCED is set */
283 fontPtr->logfont.lfOrientation = fontPtr->logfont.lfEscapement;
284 WARN(font,
285 "orientation angle %f set to escapement angle %f for new font %04x\n",
286 font->lfOrientation/10., font->lfEscapement/10., hFont);
288 GDI_HEAP_UNLOCK( hFont );
291 else WARN(font,"(NULL) => NULL\n");
293 return hFont;
296 /***********************************************************************
297 * CreateFontIndirect32A (GDI32.44)
299 HFONT WINAPI CreateFontIndirectA( const LOGFONTA *font )
301 LOGFONT16 font16;
303 FONT_LogFont32ATo16( font, &font16 );
304 return CreateFontIndirect16( &font16 );
307 /***********************************************************************
308 * CreateFontIndirect32W (GDI32.45)
310 HFONT WINAPI CreateFontIndirectW( const LOGFONTW *font )
312 LOGFONT16 font16;
314 FONT_LogFont32WTo16( font, &font16 );
315 return CreateFontIndirect16( &font16 );
318 /***********************************************************************
319 * CreateFont16 (GDI.56)
321 HFONT16 WINAPI CreateFont16(INT16 height, INT16 width, INT16 esc, INT16 orient,
322 INT16 weight, BYTE italic, BYTE underline,
323 BYTE strikeout, BYTE charset, BYTE outpres,
324 BYTE clippres, BYTE quality, BYTE pitch,
325 LPCSTR name )
327 LOGFONT16 logfont = { height, width, esc, orient, weight, italic, underline,
328 strikeout, charset, outpres, clippres, quality, pitch, };
330 TRACE(font,"('%s',%d,%d)\n",
331 (name ? name : "(null)") , height, width);
332 if (name)
333 lstrcpynA(logfont.lfFaceName,name,sizeof(logfont.lfFaceName));
334 else
335 logfont.lfFaceName[0] = '\0';
336 return CreateFontIndirect16( &logfont );
339 /*************************************************************************
340 * CreateFont32A (GDI32.43)
342 HFONT WINAPI CreateFontA( INT height, INT width, INT esc,
343 INT orient, INT weight, DWORD italic,
344 DWORD underline, DWORD strikeout, DWORD charset,
345 DWORD outpres, DWORD clippres, DWORD quality,
346 DWORD pitch, LPCSTR name )
348 return (HFONT)CreateFont16( height, width, esc, orient, weight, italic,
349 underline, strikeout, charset, outpres,
350 clippres, quality, pitch, name );
353 /*************************************************************************
354 * CreateFont32W (GDI32.46)
356 HFONT WINAPI CreateFontW( INT height, INT width, INT esc,
357 INT orient, INT weight, DWORD italic,
358 DWORD underline, DWORD strikeout, DWORD charset,
359 DWORD outpres, DWORD clippres, DWORD quality,
360 DWORD pitch, LPCWSTR name )
362 LPSTR namea = HEAP_strdupWtoA( GetProcessHeap(), 0, name );
363 HFONT ret = (HFONT)CreateFont16( height, width, esc, orient, weight,
364 italic, underline, strikeout, charset,
365 outpres, clippres, quality, pitch,
366 namea );
367 if (namea) HeapFree( GetProcessHeap(), 0, namea );
368 return ret;
372 /***********************************************************************
373 * FONT_GetObject16
375 INT16 FONT_GetObject16( FONTOBJ * font, INT16 count, LPSTR buffer )
377 if (count > sizeof(LOGFONT16)) count = sizeof(LOGFONT16);
378 memcpy( buffer, &font->logfont, count );
379 return count;
382 /***********************************************************************
383 * FONT_GetObject32A
385 INT FONT_GetObjectA( FONTOBJ *font, INT count, LPSTR buffer )
387 LOGFONTA fnt32;
389 FONT_LogFont16To32A( &font->logfont, &fnt32 );
391 if (count > sizeof(fnt32)) count = sizeof(fnt32);
392 memcpy( buffer, &fnt32, count );
393 return count;
395 /***********************************************************************
396 * FONT_GetObject32W
398 INT FONT_GetObjectW( FONTOBJ *font, INT count, LPSTR buffer )
400 LOGFONTW fnt32;
402 FONT_LogFont16To32W( &font->logfont, &fnt32 );
404 if (count > sizeof(fnt32)) count = sizeof(fnt32);
405 memcpy( buffer, &fnt32, count );
406 return count;
410 /***********************************************************************
411 * FONT_EnumInstance16
413 * Called by the device driver layer to pass font info
414 * down to the application.
416 static INT FONT_EnumInstance16( LPENUMLOGFONT16 plf,
417 LPNEWTEXTMETRIC16 ptm, UINT16 fType, LPARAM lp )
419 #define pfe ((fontEnum16*)lp)
420 if( pfe->lpLogFontParam->lfCharSet == DEFAULT_CHARSET ||
421 pfe->lpLogFontParam->lfCharSet == plf->elfLogFont.lfCharSet )
423 memcpy( pfe->lpLogFont, plf, sizeof(ENUMLOGFONT16) );
424 memcpy( pfe->lpTextMetric, ptm, sizeof(NEWTEXTMETRIC16) );
426 return pfe->lpEnumFunc( pfe->segLogFont, pfe->segTextMetric, fType, (LPARAM)(pfe->lpData) );
428 #undef pfe
429 return 1;
432 /***********************************************************************
433 * FONT_EnumInstance32
435 static INT FONT_EnumInstance( LPENUMLOGFONT16 plf,
436 LPNEWTEXTMETRIC16 ptm, UINT16 fType, LPARAM lp )
438 /* lfCharSet is at the same offset in both LOGFONT32A and LOGFONT32W */
440 #define pfe ((fontEnum32*)lp)
441 if( pfe->lpLogFontParam->lfCharSet == DEFAULT_CHARSET ||
442 pfe->lpLogFontParam->lfCharSet == plf->elfLogFont.lfCharSet )
444 /* convert font metrics */
446 if( pfe->dwFlags & ENUM_UNICODE )
448 FONT_LogFont16To32W( &plf->elfLogFont, (LPLOGFONTW)(pfe->lpLogFont) );
449 FONT_TextMetric16to32W( (LPTEXTMETRIC16)ptm, (LPTEXTMETRICW)(pfe->lpTextMetric) );
451 else
453 FONT_LogFont16To32A( &plf->elfLogFont, (LPLOGFONTA)pfe->lpLogFont );
454 FONT_TextMetric16to32A( (LPTEXTMETRIC16)ptm, (LPTEXTMETRICA)pfe->lpTextMetric );
457 return pfe->lpEnumFunc( (LPENUMLOGFONTW)pfe->lpLogFont,
458 (LPNEWTEXTMETRICW)pfe->lpTextMetric, fType, pfe->lpData );
460 #undef pfe
461 return 1;
464 /***********************************************************************
465 * EnumFontFamiliesEx16 (GDI.613)
467 INT16 WINAPI EnumFontFamiliesEx16( HDC16 hDC, LPLOGFONT16 plf,
468 FONTENUMPROCEX16 efproc, LPARAM lParam,
469 DWORD dwFlags)
471 INT16 retVal = 0;
472 DC* dc = (DC*) GDI_GetObjPtr( hDC, DC_MAGIC );
474 if( dc && dc->funcs->pEnumDeviceFonts )
476 LPNEWTEXTMETRICEX16 lptm16 = SEGPTR_ALLOC( sizeof(NEWTEXTMETRICEX16) );
477 if( lptm16 )
479 LPENUMLOGFONTEX16 lplf16 = SEGPTR_ALLOC( sizeof(ENUMLOGFONTEX16) );
480 if( lplf16 )
482 fontEnum16 fe16 = { plf, efproc, lParam, lptm16, lplf16,
483 SEGPTR_GET(lptm16), SEGPTR_GET(lplf16) };
485 retVal = dc->funcs->pEnumDeviceFonts( dc, plf, FONT_EnumInstance16, (LPARAM)&fe16 );
487 SEGPTR_FREE(lplf16);
489 SEGPTR_FREE(lptm16);
492 return retVal;
495 /***********************************************************************
496 * FONT_EnumFontFamiliesEx32
498 static INT FONT_EnumFontFamiliesEx( HDC hDC, LPLOGFONTW plf, FONTENUMPROCW efproc,
499 LPARAM lParam, DWORD dwUnicode)
501 DC* dc = (DC*) GDI_GetObjPtr( hDC, DC_MAGIC );
503 if( dc && dc->funcs->pEnumDeviceFonts )
505 LOGFONT16 lf16;
506 NEWTEXTMETRICEXW tm32w;
507 ENUMLOGFONTEXW lf32w;
508 fontEnum32 fe32 = { plf, efproc, lParam, &tm32w, &lf32w, dwUnicode };
510 /* the only difference between LOGFONT32A and LOGFONT32W is in the lfFaceName */
512 if( plf->lfFaceName[0] )
514 if( dwUnicode )
515 lstrcpynWtoA( lf16.lfFaceName, plf->lfFaceName, LF_FACESIZE );
516 else
517 lstrcpynA( lf16.lfFaceName, (LPCSTR)plf->lfFaceName, LF_FACESIZE );
519 else lf16.lfFaceName[0] = '\0';
520 lf16.lfCharSet = plf->lfCharSet;
522 return dc->funcs->pEnumDeviceFonts( dc, &lf16, FONT_EnumInstance, (LPARAM)&fe32 );
524 return 0;
527 /***********************************************************************
528 * EnumFontFamiliesEx32W (GDI32.82)
530 INT WINAPI EnumFontFamiliesExW( HDC hDC, LPLOGFONTW plf,
531 FONTENUMPROCEXW efproc,
532 LPARAM lParam, DWORD dwFlags )
534 return FONT_EnumFontFamiliesEx( hDC, plf, (FONTENUMPROCW)efproc,
535 lParam, ENUM_UNICODE );
538 /***********************************************************************
539 * EnumFontFamiliesEx32A (GDI32.81)
541 INT WINAPI EnumFontFamiliesExA( HDC hDC, LPLOGFONTA plf,
542 FONTENUMPROCEXA efproc,
543 LPARAM lParam, DWORD dwFlags)
545 return FONT_EnumFontFamiliesEx( hDC, (LPLOGFONTW)plf,
546 (FONTENUMPROCW)efproc, lParam, 0);
549 /***********************************************************************
550 * EnumFontFamilies16 (GDI.330)
552 INT16 WINAPI EnumFontFamilies16( HDC16 hDC, LPCSTR lpFamily,
553 FONTENUMPROC16 efproc, LPARAM lpData )
555 LOGFONT16 lf;
557 lf.lfCharSet = DEFAULT_CHARSET;
558 if( lpFamily ) lstrcpynA( lf.lfFaceName, lpFamily, LF_FACESIZE );
559 else lf.lfFaceName[0] = '\0';
561 return EnumFontFamiliesEx16( hDC, &lf, (FONTENUMPROCEX16)efproc, lpData, 0 );
564 /***********************************************************************
565 * EnumFontFamilies32A (GDI32.80)
567 INT WINAPI EnumFontFamiliesA( HDC hDC, LPCSTR lpFamily,
568 FONTENUMPROCA efproc, LPARAM lpData )
570 LOGFONTA lf;
572 lf.lfCharSet = DEFAULT_CHARSET;
573 if( lpFamily ) lstrcpynA( lf.lfFaceName, lpFamily, LF_FACESIZE );
574 else lf.lfFaceName[0] = lf.lfFaceName[1] = '\0';
576 return FONT_EnumFontFamiliesEx( hDC, (LPLOGFONTW)&lf,
577 (FONTENUMPROCW)efproc, lpData, 0 );
580 /***********************************************************************
581 * EnumFontFamilies32W (GDI32.83)
583 INT WINAPI EnumFontFamiliesW( HDC hDC, LPCWSTR lpFamily,
584 FONTENUMPROCW efproc, LPARAM lpData )
586 LOGFONTW lf;
588 lf.lfCharSet = DEFAULT_CHARSET;
589 if( lpFamily ) lstrcpynW( lf.lfFaceName, lpFamily, LF_FACESIZE );
590 else lf.lfFaceName[0] = 0;
592 return FONT_EnumFontFamiliesEx( hDC, &lf, efproc, lpData, ENUM_UNICODE );
595 /***********************************************************************
596 * EnumFonts16 (GDI.70)
598 INT16 WINAPI EnumFonts16( HDC16 hDC, LPCSTR lpName, FONTENUMPROC16 efproc,
599 LPARAM lpData )
601 return EnumFontFamilies16( hDC, lpName, (FONTENUMPROCEX16)efproc, lpData );
604 /***********************************************************************
605 * EnumFonts32A (GDI32.84)
607 INT WINAPI EnumFontsA( HDC hDC, LPCSTR lpName, FONTENUMPROCA efproc,
608 LPARAM lpData )
610 return EnumFontFamiliesA( hDC, lpName, efproc, lpData );
613 /***********************************************************************
614 * EnumFonts32W (GDI32.85)
616 INT WINAPI EnumFontsW( HDC hDC, LPCWSTR lpName, FONTENUMPROCW efproc,
617 LPARAM lpData )
619 return EnumFontFamiliesW( hDC, lpName, efproc, lpData );
623 /***********************************************************************
624 * GetTextCharacterExtra16 (GDI.89)
626 INT16 WINAPI GetTextCharacterExtra16( HDC16 hdc )
628 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
629 if (!dc) return 0;
630 return abs( (dc->w.charExtra * dc->wndExtX + dc->vportExtX / 2)
631 / dc->vportExtX );
635 /***********************************************************************
636 * GetTextCharacterExtra32 (GDI32.225)
638 INT WINAPI GetTextCharacterExtra( HDC hdc )
640 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
641 if (!dc) return 0;
642 return abs( (dc->w.charExtra * dc->wndExtX + dc->vportExtX / 2)
643 / dc->vportExtX );
647 /***********************************************************************
648 * SetTextCharacterExtra16 (GDI.8)
650 INT16 WINAPI SetTextCharacterExtra16( HDC16 hdc, INT16 extra )
652 return (INT16)SetTextCharacterExtra( hdc, extra );
656 /***********************************************************************
657 * SetTextCharacterExtra32 (GDI32.337)
659 INT WINAPI SetTextCharacterExtra( HDC hdc, INT extra )
661 INT prev;
662 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
663 if (!dc) return 0;
664 extra = (extra * dc->vportExtX + dc->wndExtX / 2) / dc->wndExtX;
665 prev = dc->w.charExtra;
666 dc->w.charExtra = abs(extra);
667 return (prev * dc->wndExtX + dc->vportExtX / 2) / dc->vportExtX;
671 /***********************************************************************
672 * SetTextJustification16 (GDI.10)
674 INT16 WINAPI SetTextJustification16( HDC16 hdc, INT16 extra, INT16 breaks )
676 return SetTextJustification( hdc, extra, breaks );
680 /***********************************************************************
681 * SetTextJustification32 (GDI32.339)
683 BOOL WINAPI SetTextJustification( HDC hdc, INT extra, INT breaks )
685 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
686 if (!dc) return 0;
688 extra = abs((extra * dc->vportExtX + dc->wndExtX / 2) / dc->wndExtX);
689 if (!extra) breaks = 0;
690 dc->w.breakTotalExtra = extra;
691 dc->w.breakCount = breaks;
692 if (breaks)
694 dc->w.breakExtra = extra / breaks;
695 dc->w.breakRem = extra - (dc->w.breakCount * dc->w.breakExtra);
697 else
699 dc->w.breakExtra = 0;
700 dc->w.breakRem = 0;
702 return 1;
706 /***********************************************************************
707 * GetTextFace16 (GDI.92)
709 INT16 WINAPI GetTextFace16( HDC16 hdc, INT16 count, LPSTR name )
711 return GetTextFaceA(hdc,count,name);
714 /***********************************************************************
715 * GetTextFace32A (GDI32.234)
717 INT WINAPI GetTextFaceA( HDC hdc, INT count, LPSTR name )
719 FONTOBJ *font;
721 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
722 if (!dc) return 0;
723 if (!(font = (FONTOBJ *) GDI_GetObjPtr( dc->w.hFont, FONT_MAGIC )))
724 return 0;
725 if (name)
726 lstrcpynA( name, font->logfont.lfFaceName, count );
727 GDI_HEAP_UNLOCK( dc->w.hFont );
728 if (name)
729 return strlen(name);
730 else
731 return strlen(font->logfont.lfFaceName) + 1;
734 /***********************************************************************
735 * GetTextFace32W (GDI32.235)
737 INT WINAPI GetTextFaceW( HDC hdc, INT count, LPWSTR name )
739 LPSTR nameA = HeapAlloc( GetProcessHeap(), 0, count );
740 INT res = GetTextFaceA(hdc,count,nameA);
741 lstrcpyAtoW( name, nameA );
742 HeapFree( GetProcessHeap(), 0, nameA );
743 return res;
747 /***********************************************************************
748 * GetTextExtent (GDI.91)
750 DWORD WINAPI GetTextExtent16( HDC16 hdc, LPCSTR str, INT16 count )
752 SIZE16 size;
753 if (!GetTextExtentPoint16( hdc, str, count, &size )) return 0;
754 return MAKELONG( size.cx, size.cy );
758 /***********************************************************************
759 * GetTextExtentPoint16 (GDI.471)
761 * FIXME: Should this have a bug for compatibility?
762 * Original Windows versions of GetTextExtentPoint{A,W} have documented
763 * bugs (-> MSDN KB q147647.txt).
765 BOOL16 WINAPI GetTextExtentPoint16( HDC16 hdc, LPCSTR str, INT16 count,
766 LPSIZE16 size )
768 SIZE size32;
769 BOOL ret = GetTextExtentPoint32A( hdc, str, count, &size32 );
770 CONV_SIZE32TO16( &size32, size );
771 return (BOOL16)ret;
775 /***********************************************************************
776 * GetTextExtentPoint32A (GDI32.230)
778 BOOL WINAPI GetTextExtentPoint32A( HDC hdc, LPCSTR str, INT count,
779 LPSIZE size )
781 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
782 if (!dc)
784 if (!(dc = (DC *)GDI_GetObjPtr( hdc, METAFILE_DC_MAGIC )))
785 return FALSE;
788 if (!dc->funcs->pGetTextExtentPoint ||
789 !dc->funcs->pGetTextExtentPoint( dc, str, count, size ))
790 return FALSE;
792 TRACE(font,"(%08x %s %d %p): returning %d,%d\n",
793 hdc, debugstr_an (str, count), count,
794 size, size->cx, size->cy );
795 return TRUE;
799 /***********************************************************************
800 * GetTextExtentPoint32W [GDI32.231] Computes width/height for a string
802 * Computes width and height of the specified string.
804 * RETURNS
805 * Success: TRUE
806 * Failure: FALSE
808 BOOL WINAPI GetTextExtentPoint32W(
809 HDC hdc, /* [in] Handle of device context */
810 LPCWSTR str, /* [in] Address of text string */
811 INT count, /* [in] Number of characters in string */
812 LPSIZE size) /* [out] Address of structure for string size */
814 LPSTR p = HEAP_strdupWtoA( GetProcessHeap(), 0, str );
815 BOOL ret = GetTextExtentPoint32A( hdc, p, count, size );
816 HeapFree( GetProcessHeap(), 0, p );
817 return ret;
821 /***********************************************************************
822 * GetTextExtentPoint32ABuggy (GDI32.232)
824 BOOL WINAPI GetTextExtentPointA( HDC hdc, LPCSTR str, INT count,
825 LPSIZE size )
827 TRACE(font, "not bug compatible.\n");
828 return GetTextExtentPoint32A( hdc, str, count, size );
831 /***********************************************************************
832 * GetTextExtentPoint32WBuggy (GDI32.233)
834 BOOL WINAPI GetTextExtentPointW( HDC hdc, LPCWSTR str, INT count,
835 LPSIZE size )
837 TRACE(font, "not bug compatible.\n");
838 return GetTextExtentPoint32W( hdc, str, count, size );
842 /***********************************************************************
843 * GetTextExtentExPoint32A (GDI32.228)
845 BOOL WINAPI GetTextExtentExPointA( HDC hdc, LPCSTR str, INT count,
846 INT maxExt, LPINT lpnFit,
847 LPINT alpDx, LPSIZE size )
849 int index, nFit, extent;
850 SIZE tSize;
851 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
853 if (!dc)
855 if (!(dc = (DC *)GDI_GetObjPtr( hdc, METAFILE_DC_MAGIC )))
856 return FALSE;
858 if (!dc->funcs->pGetTextExtentPoint) return FALSE;
860 size->cx = size->cy = nFit = extent = 0;
861 for(index = 0; index < count; index++)
863 if(!dc->funcs->pGetTextExtentPoint( dc, str, 1, &tSize )) return FALSE;
864 if( extent+tSize.cx < maxExt )
866 extent+=tSize.cx;
867 nFit++;
868 str++;
869 if( alpDx ) alpDx[index] = extent;
870 if( tSize.cy > size->cy ) size->cy = tSize.cy;
872 else break;
874 size->cx = extent;
875 *lpnFit = nFit;
877 TRACE(font,"(%08x '%.*s' %d) returning %d %d %d\n",
878 hdc,count,str,maxExt,nFit, size->cx,size->cy);
879 return TRUE;
883 /***********************************************************************
884 * GetTextExtentExPoint32W (GDI32.229)
887 BOOL WINAPI GetTextExtentExPointW( HDC hdc, LPCWSTR str, INT count,
888 INT maxExt, LPINT lpnFit,
889 LPINT alpDx, LPSIZE size )
891 LPSTR p = HEAP_strdupWtoA( GetProcessHeap(), 0, str );
892 BOOL ret = GetTextExtentExPointA( hdc, p, count, maxExt,
893 lpnFit, alpDx, size);
894 HeapFree( GetProcessHeap(), 0, p );
895 return ret;
898 /***********************************************************************
899 * GetTextMetrics16 (GDI.93)
901 BOOL16 WINAPI GetTextMetrics16( HDC16 hdc, TEXTMETRIC16 *metrics )
903 TEXTMETRICA tm32;
905 if (!GetTextMetricsA( (HDC)hdc, &tm32 )) return FALSE;
906 FONT_TextMetric32Ato16( &tm32, metrics );
907 return TRUE;
911 /***********************************************************************
912 * GetTextMetrics32A (GDI32.236)
914 BOOL WINAPI GetTextMetricsA( HDC hdc, TEXTMETRICA *metrics )
916 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
917 if (!dc)
919 if (!(dc = (DC *)GDI_GetObjPtr( hdc, METAFILE_DC_MAGIC )))
920 return FALSE;
923 if (!dc->funcs->pGetTextMetrics ||
924 !dc->funcs->pGetTextMetrics( dc, metrics ))
925 return FALSE;
927 /* device layer returns values in device units
928 * therefore we have to convert them to logical */
930 #define WDPTOLP(x) ((x<0)? \
931 (-abs((x)*dc->wndExtX/dc->vportExtX)): \
932 (abs((x)*dc->wndExtX/dc->vportExtX)))
933 #define HDPTOLP(y) ((y<0)? \
934 (-abs((y)*dc->wndExtY/dc->vportExtY)): \
935 (abs((y)*dc->wndExtY/dc->vportExtY)))
937 metrics->tmHeight = HDPTOLP(metrics->tmHeight);
938 metrics->tmAscent = HDPTOLP(metrics->tmAscent);
939 metrics->tmDescent = HDPTOLP(metrics->tmDescent);
940 metrics->tmInternalLeading = HDPTOLP(metrics->tmInternalLeading);
941 metrics->tmExternalLeading = HDPTOLP(metrics->tmExternalLeading);
942 metrics->tmAveCharWidth = WDPTOLP(metrics->tmAveCharWidth);
943 metrics->tmMaxCharWidth = WDPTOLP(metrics->tmMaxCharWidth);
944 metrics->tmOverhang = WDPTOLP(metrics->tmOverhang);
946 TRACE(font,"text metrics:
947 Weight = %03i\t FirstChar = %03i\t AveCharWidth = %i
948 Italic = % 3i\t LastChar = %03i\t\t MaxCharWidth = %i
949 UnderLined = %01i\t DefaultChar = %03i\t Overhang = %i
950 StruckOut = %01i\t BreakChar = %03i\t CharSet = %i
951 PitchAndFamily = %02x
952 --------------------
953 InternalLeading = %i
954 Ascent = %i
955 Descent = %i
956 Height = %i\n",
957 metrics->tmWeight, metrics->tmFirstChar, metrics->tmAveCharWidth,
958 metrics->tmItalic, metrics->tmLastChar, metrics->tmMaxCharWidth,
959 metrics->tmUnderlined, metrics->tmDefaultChar, metrics->tmOverhang,
960 metrics->tmStruckOut, metrics->tmBreakChar, metrics->tmCharSet,
961 metrics->tmPitchAndFamily,
962 metrics->tmInternalLeading,
963 metrics->tmAscent,
964 metrics->tmDescent,
965 metrics->tmHeight );
966 return TRUE;
970 /***********************************************************************
971 * GetTextMetrics32W (GDI32.237)
973 BOOL WINAPI GetTextMetricsW( HDC hdc, TEXTMETRICW *metrics )
975 TEXTMETRICA tm;
976 if (!GetTextMetricsA( (HDC16)hdc, &tm )) return FALSE;
977 FONT_TextMetric32Ato32W( &tm, metrics );
978 return TRUE;
982 /***********************************************************************
983 * GetOutlineTextMetrics [GDI.308] Gets metrics for TrueType fonts.
985 * NOTES
986 * lpOTM should be LPOUTLINETEXTMETRIC
988 * RETURNS
989 * Success: Non-zero or size of required buffer
990 * Failure: 0
992 UINT16 WINAPI GetOutlineTextMetrics16(
993 HDC16 hdc, /* [in] Handle of device context */
994 UINT16 cbData, /* [in] Size of metric data array */
995 LPOUTLINETEXTMETRIC16 lpOTM) /* [out] Address of metric data array */
997 FIXME(font, "(%04x,%04x,%p): stub\n", hdc,cbData,lpOTM);
998 return 0;
1002 /***********************************************************************
1003 * GetOutlineTextMetrics [GDI.207] Gets metrics for TrueType fonts.
1006 * RETURNS
1007 * Success: Non-zero or size of required buffer
1008 * Failure: 0
1010 UINT WINAPI GetOutlineTextMetricsA(
1011 HDC hdc, /* [in] Handle of device context */
1012 UINT cbData, /* [in] Size of metric data array */
1013 LPOUTLINETEXTMETRICA lpOTM) /* [out] Address of metric data array */
1017 UINT rtn = FALSE;
1018 LPTEXTMETRICA lptxtMetr;
1022 if (lpOTM == 0)
1025 lpOTM = (LPOUTLINETEXTMETRICA)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(OUTLINETEXTMETRICA));
1026 rtn = sizeof(OUTLINETEXTMETRICA);
1027 cbData = rtn;
1028 } else
1030 cbData = sizeof(*lpOTM);
1031 rtn = cbData;
1034 lpOTM->otmSize = cbData;
1036 lptxtMetr =HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(TEXTMETRICA));
1038 if (!GetTextMetricsA(hdc,lptxtMetr))
1040 return 0;
1041 } else
1043 memcpy(&(lpOTM->otmTextMetrics),lptxtMetr,sizeof(TEXTMETRICA));
1046 HeapFree(GetProcessHeap(),HEAP_ZERO_MEMORY,lptxtMetr);
1048 lpOTM->otmFilter = 0;
1050 lpOTM->otmPanoseNumber.bFamilyType = 0;
1051 lpOTM->otmPanoseNumber.bSerifStyle = 0;
1052 lpOTM->otmPanoseNumber.bWeight = 0;
1053 lpOTM->otmPanoseNumber.bProportion = 0;
1054 lpOTM->otmPanoseNumber.bContrast = 0;
1055 lpOTM->otmPanoseNumber.bStrokeVariation = 0;
1056 lpOTM->otmPanoseNumber.bArmStyle = 0;
1057 lpOTM->otmPanoseNumber.bLetterform = 0;
1058 lpOTM->otmPanoseNumber.bMidline = 0;
1059 lpOTM->otmPanoseNumber.bXHeight = 0;
1061 lpOTM->otmfsSelection = 0;
1062 lpOTM->otmfsType = 0;
1065 Further fill of the structure not implemented,
1066 Needs real values for the structure members
1069 return rtn;
1072 /***********************************************************************
1073 * GetOutlineTextMetrics32W [GDI32.208]
1075 UINT WINAPI GetOutlineTextMetricsW(
1076 HDC hdc, /* [in] Handle of device context */
1077 UINT cbData, /* [in] Size of metric data array */
1078 LPOUTLINETEXTMETRICW lpOTM) /* [out] Address of metric data array */
1080 FIXME(font, "(%d,%d,%p): stub\n", hdc, cbData, lpOTM);
1081 return 0;
1084 /***********************************************************************
1085 * GetCharWidth16 (GDI.350)
1087 BOOL16 WINAPI GetCharWidth16( HDC16 hdc, UINT16 firstChar, UINT16 lastChar,
1088 LPINT16 buffer )
1090 BOOL retVal = FALSE;
1092 if( firstChar != lastChar )
1094 LPINT buf32 = (LPINT)HeapAlloc(GetProcessHeap(), 0,
1095 sizeof(INT)*(1 + (lastChar - firstChar)));
1096 if( buf32 )
1098 LPINT obuf32 = buf32;
1099 int i;
1101 retVal = GetCharWidth32A(hdc, firstChar, lastChar, buf32);
1102 if (retVal)
1104 for (i = firstChar; i <= lastChar; i++)
1105 *buffer++ = *buf32++;
1107 HeapFree(GetProcessHeap(), 0, obuf32);
1110 else /* happens quite often to warrant a special treatment */
1112 INT chWidth;
1113 retVal = GetCharWidth32A(hdc, firstChar, lastChar, &chWidth );
1114 *buffer = chWidth;
1116 return retVal;
1120 /***********************************************************************
1121 * GetCharWidth32A (GDI32.155)
1123 BOOL WINAPI GetCharWidth32A( HDC hdc, UINT firstChar, UINT lastChar,
1124 LPINT buffer )
1126 UINT i, extra;
1127 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
1128 if (!dc)
1130 if (!(dc = (DC *)GDI_GetObjPtr( hdc, METAFILE_DC_MAGIC )))
1131 return FALSE;
1134 if (!dc->funcs->pGetCharWidth ||
1135 !dc->funcs->pGetCharWidth( dc, firstChar, lastChar, buffer))
1136 return FALSE;
1138 /* convert device units to logical */
1140 extra = dc->vportExtX >> 1;
1141 for( i = firstChar; i <= lastChar; i++, buffer++ )
1142 *buffer = (*buffer * dc->wndExtX + extra) / dc->vportExtX;
1144 return TRUE;
1148 /***********************************************************************
1149 * GetCharWidth32W (GDI32.158)
1151 BOOL WINAPI GetCharWidth32W( HDC hdc, UINT firstChar, UINT lastChar,
1152 LPINT buffer )
1154 return GetCharWidth32A( hdc, firstChar, lastChar, buffer );
1159 /* FIXME: all following APIs *******************************************
1162 * SetMapperFlags16 (GDI.349)
1164 DWORD WINAPI SetMapperFlags16( HDC16 hDC, DWORD dwFlag )
1166 return SetMapperFlags( hDC, dwFlag );
1170 /***********************************************************************
1171 * SetMapperFlags32 (GDI32.322)
1173 DWORD WINAPI SetMapperFlags( HDC hDC, DWORD dwFlag )
1175 FIXME(font, "(0x%04x, 0x%08lx): stub - harmless\n", hDC, dwFlag);
1176 return 0;
1179 /***********************************************************************
1180 * GetAspectRatioFilterEx16 (GDI.486)
1182 BOOL16 WINAPI GetAspectRatioFilterEx16( HDC16 hdc, LPSIZE16 pAspectRatio )
1184 FIXME(font, "(%04x, %p): -- Empty Stub !\n",
1185 hdc, pAspectRatio);
1186 return FALSE;
1189 /***********************************************************************
1190 * GetAspectRatioFilterEx32 (GDI32.142)
1192 BOOL WINAPI GetAspectRatioFilterEx( HDC hdc, LPSIZE pAspectRatio )
1194 FIXME(font, "(%04x, %p): -- Empty Stub !\n",
1195 hdc, pAspectRatio);
1196 return FALSE;
1199 /***********************************************************************
1200 * GetCharABCWidths16 (GDI.307)
1202 BOOL16 WINAPI GetCharABCWidths16( HDC16 hdc, UINT16 firstChar, UINT16 lastChar,
1203 LPABC16 abc )
1205 ABC abc32;
1206 if (!GetCharABCWidthsA( hdc, firstChar, lastChar, &abc32 )) return FALSE;
1207 abc->abcA = abc32.abcA;
1208 abc->abcB = abc32.abcB;
1209 abc->abcC = abc32.abcC;
1210 return TRUE;
1214 /***********************************************************************
1215 * GetCharABCWidths32A (GDI32.149)
1217 BOOL WINAPI GetCharABCWidthsA(HDC hdc, UINT firstChar, UINT lastChar,
1218 LPABC abc )
1220 return GetCharABCWidthsW( hdc, firstChar, lastChar, abc );
1224 /******************************************************************************
1225 * GetCharABCWidths32W [GDI32.152] Retrieves widths of characters in range
1227 * PARAMS
1228 * hdc [I] Handle of device context
1229 * firstChar [I] First character in range to query
1230 * lastChar [I] Last character in range to query
1231 * abc [O] Address of character-width structure
1233 * NOTES
1234 * Only works with TrueType fonts
1236 * RETURNS
1237 * Success: TRUE
1238 * Failure: FALSE
1240 BOOL WINAPI GetCharABCWidthsW( HDC hdc, UINT firstChar, UINT lastChar,
1241 LPABC abc )
1243 /* No TrueType fonts in Wine so far */
1244 FIXME(font, "(%04x,%04x,%04x,%p): stub\n", hdc, firstChar, lastChar, abc);
1245 return FALSE;
1249 /***********************************************************************
1250 * GetGlyphOutline16 (GDI.309)
1252 DWORD WINAPI GetGlyphOutline16( HDC16 hdc, UINT16 uChar, UINT16 fuFormat,
1253 LPGLYPHMETRICS16 lpgm, DWORD cbBuffer,
1254 LPVOID lpBuffer, const MAT2 *lpmat2 )
1256 FIXME(font,"(%04x, '%c', %04x, %p, %ld, %p, %p): stub\n",
1257 hdc, uChar, fuFormat, lpgm, cbBuffer, lpBuffer, lpmat2 );
1258 return (DWORD)-1; /* failure */
1262 /***********************************************************************
1263 * GetGlyphOutline32A (GDI32.186)
1265 DWORD WINAPI GetGlyphOutlineA( HDC hdc, UINT uChar, UINT fuFormat,
1266 LPGLYPHMETRICS lpgm, DWORD cbBuffer,
1267 LPVOID lpBuffer, const MAT2 *lpmat2 )
1269 FIXME(font,"(%04x, '%c', %04x, %p, %ld, %p, %p): stub\n",
1270 hdc, uChar, fuFormat, lpgm, cbBuffer, lpBuffer, lpmat2 );
1271 return (DWORD)-1; /* failure */
1274 /***********************************************************************
1275 * GetGlyphOutline32W (GDI32.187)
1277 DWORD WINAPI GetGlyphOutlineW( HDC hdc, UINT uChar, UINT fuFormat,
1278 LPGLYPHMETRICS lpgm, DWORD cbBuffer,
1279 LPVOID lpBuffer, const MAT2 *lpmat2 )
1281 FIXME(font,"(%04x, '%c', %04x, %p, %ld, %p, %p): stub\n",
1282 hdc, uChar, fuFormat, lpgm, cbBuffer, lpBuffer, lpmat2 );
1283 return (DWORD)-1; /* failure */
1286 /***********************************************************************
1287 * CreateScalableFontResource16 (GDI.310)
1289 BOOL16 WINAPI CreateScalableFontResource16( UINT16 fHidden,
1290 LPCSTR lpszResourceFile,
1291 LPCSTR fontFile, LPCSTR path )
1293 return CreateScalableFontResourceA( fHidden, lpszResourceFile,
1294 fontFile, path );
1297 /***********************************************************************
1298 * CreateScalableFontResource32A (GDI32.62)
1300 BOOL WINAPI CreateScalableFontResourceA( DWORD fHidden,
1301 LPCSTR lpszResourceFile,
1302 LPCSTR lpszFontFile,
1303 LPCSTR lpszCurrentPath )
1305 /* fHidden=1 - only visible for the calling app, read-only, not
1306 * enumbered with EnumFonts/EnumFontFamilies
1307 * lpszCurrentPath can be NULL
1309 FIXME(font,"(%ld,%s,%s,%s): stub\n",
1310 fHidden, lpszResourceFile, lpszFontFile, lpszCurrentPath );
1311 return FALSE; /* create failed */
1314 /***********************************************************************
1315 * CreateScalableFontResource32W (GDI32.63)
1317 BOOL WINAPI CreateScalableFontResourceW( DWORD fHidden,
1318 LPCWSTR lpszResourceFile,
1319 LPCWSTR lpszFontFile,
1320 LPCWSTR lpszCurrentPath )
1322 FIXME(font,"(%ld,%p,%p,%p): stub\n",
1323 fHidden, lpszResourceFile, lpszFontFile, lpszCurrentPath );
1324 return FALSE; /* create failed */
1328 /*************************************************************************
1329 * GetRasterizerCaps16 (GDI.313)
1331 BOOL16 WINAPI GetRasterizerCaps16( LPRASTERIZER_STATUS lprs, UINT16 cbNumBytes)
1333 return GetRasterizerCaps( lprs, cbNumBytes );
1337 /*************************************************************************
1338 * GetRasterizerCaps32 (GDI32.216)
1340 BOOL WINAPI GetRasterizerCaps( LPRASTERIZER_STATUS lprs, UINT cbNumBytes)
1342 lprs->nSize = sizeof(RASTERIZER_STATUS);
1343 lprs->wFlags = TT_AVAILABLE|TT_ENABLED;
1344 lprs->nLanguageID = 0;
1345 return TRUE;
1349 /*************************************************************************
1350 * GetKerningPairs16 (GDI.332)
1352 INT16 WINAPI GetKerningPairs16( HDC16 hDC, INT16 cPairs,
1353 LPKERNINGPAIR16 lpKerningPairs )
1355 /* At this time kerning is ignored (set to 0) */
1356 int i;
1357 FIXME(font,"(%x,%d,%p): almost empty stub!\n",
1358 hDC, cPairs, lpKerningPairs);
1359 for (i = 0; i < cPairs; i++)
1360 lpKerningPairs[i].iKernAmount = 0;
1361 return 0;
1366 /*************************************************************************
1367 * GetKerningPairs32A (GDI32.192)
1369 DWORD WINAPI GetKerningPairsA( HDC hDC, DWORD cPairs,
1370 LPKERNINGPAIR lpKerningPairs )
1372 int i;
1373 FIXME(font,"(%x,%ld,%p): almost empty stub!\n",
1374 hDC, cPairs, lpKerningPairs);
1375 for (i = 0; i < cPairs; i++)
1376 lpKerningPairs[i].iKernAmount = 0;
1377 return 0;
1381 /*************************************************************************
1382 * GetKerningPairs32W (GDI32.193)
1384 DWORD WINAPI GetKerningPairsW( HDC hDC, DWORD cPairs,
1385 LPKERNINGPAIR lpKerningPairs )
1387 return GetKerningPairsA( hDC, cPairs, lpKerningPairs );
1390 /*************************************************************************
1391 * TranslateCharsetInfo [GDI32.382]
1393 * Fills a CHARSETINFO structure for a character set, code page, or
1394 * font. This allows making the correspondance between different labelings
1395 * (character set, Windows, ANSI, and OEM codepages, and Unicode ranges)
1396 * of the same encoding.
1398 * Only one codepage will be set in lpCs->fs. If TCI_SRCFONTSIG is used,
1399 * only one codepage should be set in *lpSrc.
1401 * RETURNS
1402 * TRUE on success, FALSE on failure.
1405 BOOL WINAPI TranslateCharsetInfo(
1406 LPDWORD lpSrc, /*
1407 if flags == TCI_SRCFONTSIG: pointer to fsCsb of a FONTSIGNATURE
1408 if flags == TCI_SRCCHARSET: a character set value
1409 if flags == TCI_SRCCODEPAGE: a code page value
1411 LPCHARSETINFO lpCs, /* structure to receive charset information */
1412 DWORD flags /* determines interpretation of lpSrc */
1414 int index = 0;
1415 switch (flags) {
1416 case TCI_SRCFONTSIG:
1417 while (!(*lpSrc>>index & 0x0001) && index<MAXTCIINDEX) index++;
1418 break;
1419 case TCI_SRCCODEPAGE:
1420 while ((UINT) (lpSrc) != FONT_tci[index].ciACP && index < MAXTCIINDEX) index++;
1421 break;
1422 case TCI_SRCCHARSET:
1423 while ((UINT) (lpSrc) != FONT_tci[index].ciCharset && index < MAXTCIINDEX) index++;
1424 break;
1425 default:
1426 return FALSE;
1428 if (index >= MAXTCIINDEX || FONT_tci[index].ciCharset == DEFAULT_CHARSET) return FALSE;
1429 memcpy(lpCs, &FONT_tci[index], sizeof(CHARSETINFO));
1430 return TRUE;
1433 /*************************************************************************
1434 * GetFontLanguageInfo (GDI32.182)
1436 DWORD WINAPI GetFontLanguageInfo(HDC hdc) {
1437 /* return value 0 is correct for most cases anyway */
1438 FIXME(font,"(%x):stub!\n", hdc);
1439 return 0;
1442 /*************************************************************************
1443 * GetFontLanguageInfo (GDI.616)
1445 DWORD WINAPI GetFontLanguageInfo16(HDC16 hdc) {
1446 /* return value 0 is correct for most cases anyway */
1447 FIXME(font,"(%x):stub!\n",hdc);
1448 return 0;
1451 /*************************************************************************
1452 * GetFontData32 [GDI32.181] Retrieve data for TrueType font
1454 * RETURNS
1456 * success: Number of bytes returned
1457 * failure: GDI_ERROR
1459 * NOTES
1461 * Calls SetLastError()
1463 * BUGS
1465 * Unimplemented
1467 DWORD WINAPI GetFontData(HDC hdc, DWORD table, DWORD offset,
1468 LPVOID buffer, DWORD length)
1470 FIXME(font, "(%x,%ld,%ld,%p,%ld): stub\n",
1471 hdc, table, offset, buffer, length);
1472 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1473 return GDI_ERROR;
1476 /*************************************************************************
1477 * GetCharacterPlacement32A [GDI32.160]
1479 DWORD WINAPI
1480 GetCharacterPlacementA(HDC hdc, LPCSTR lpString, INT uCount,
1481 INT nMaxExtent, GCP_RESULTSA *lpResults,
1482 DWORD dwFlags)
1484 /* return value 0 is correct for most cases anyway */
1485 FIXME(font,":stub!\n");
1486 return 0;
1489 /*************************************************************************
1490 * GetCharacterPlacement32W [GDI32.161]
1492 DWORD WINAPI
1493 GetCharacterPlacementW(HDC hdc, LPCWSTR lpString, INT uCount,
1494 INT nMaxExtent, GCP_RESULTSW *lpResults,
1495 DWORD dwFlags)
1497 /* return value 0 is correct for most cases anyway */
1498 FIXME(font,":stub!\n");
1499 return 0;
1502 /*************************************************************************
1503 * GetCharABCWidthsFloat32A [GDI32.150]
1505 BOOL WINAPI GetCharABCWidthsFloatA(HDC hdc, UINT iFirstChar, UINT iLastChar,
1506 LPABCFLOAT lpABCF)
1508 FIXME(gdi, "GetCharABCWidthsFloatA, stub\n");
1509 return 0;
1512 /*************************************************************************
1513 * GetCharABCWidthsFloat32W [GDI32.151]
1515 BOOL WINAPI GetCharABCWidthsFloatW(HDC hdc, UINT iFirstChar,
1516 UINT iLastChar, LPABCFLOAT lpABCF)
1518 FIXME(gdi, "GetCharABCWidthsFloatW, stub\n");
1519 return 0;
1522 /*************************************************************************
1523 * GetCharWidthFloat32A [GDI32.156]
1525 BOOL WINAPI GetCharWidthFloatA(HDC hdc, UINT iFirstChar,
1526 UINT iLastChar, PFLOAT pxBuffer)
1528 FIXME(gdi, "GetCharWidthFloatA, stub\n");
1529 return 0;
1532 /*************************************************************************
1533 * GetCharWidthFloat32W [GDI32.157]
1535 BOOL WINAPI GetCharWidthFloatW(HDC hdc, UINT iFirstChar,
1536 UINT iLastChar, PFLOAT pxBuffer)
1538 FIXME(gdi, "GetCharWidthFloatW, stub\n");
1539 return 0;