4 * Copyright 1993 Alexandre Julliard
10 #include "wine/winestring.h"
18 #define ENUM_UNICODE 0x00000001
22 LPLOGFONT16 lpLogFontParam
;
23 FONTENUMPROCEX16 lpEnumFunc
;
26 LPNEWTEXTMETRICEX16 lpTextMetric
;
27 LPENUMLOGFONTEX16 lpLogFont
;
34 LPLOGFONT32W lpLogFontParam
;
35 FONTENUMPROC32W lpEnumFunc
;
38 LPNEWTEXTMETRICEX32W lpTextMetric
;
39 LPENUMLOGFONTEX32W lpLogFont
;
44 * For TranslateCharsetInfo
46 #define FS(x) {{0,0,0,0},{0x1<<(x),0}}
47 #define MAXTCIINDEX 32
48 static CHARSETINFO FONT_tci
[MAXTCIINDEX
] = {
50 { ANSI_CHARSET
, 1252, FS(0)},
51 { EASTEUROPE_CHARSET
, 1250, FS(1)},
52 { RUSSIAN_CHARSET
, 1251, FS(2)},
53 { GREEK_CHARSET
, 1253, FS(3)},
54 { TURKISH_CHARSET
, 1254, FS(4)},
55 { HEBREW_CHARSET
, 1255, FS(5)},
56 { ARABIC_CHARSET
, 1256, FS(6)},
57 { BALTIC_CHARSET
, 1257, FS(7)},
58 /* reserved by ANSI */
59 { DEFAULT_CHARSET
, 0, FS(0)},
60 { DEFAULT_CHARSET
, 0, FS(0)},
61 { DEFAULT_CHARSET
, 0, FS(0)},
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)},
68 { THAI_CHARSET
, 874, FS(16)},
69 { SHIFTJIS_CHARSET
, 932, FS(17)},
70 { GB2312_CHARSET
, 936, FS(18)},
71 { HANGEUL_CHARSET
, 949, FS(19)},
72 { CHINESEBIG5_CHARSET
, 950, FS(20)},
73 { JOHAB_CHARSET
, 1361, FS(21)},
74 /* reserved for alternate ANSI and OEM */
75 { DEFAULT_CHARSET
, 0, FS(0)},
76 { DEFAULT_CHARSET
, 0, FS(0)},
77 { DEFAULT_CHARSET
, 0, FS(0)},
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 /* reserved for system */
84 { DEFAULT_CHARSET
, 0, FS(0)},
85 { DEFAULT_CHARSET
, 0, FS(0)},
88 /***********************************************************************
89 * LOGFONT conversion functions.
91 static void __logfont32to16( INT16
* plf16
, const INT32
* plf32
)
94 for( i
= 0; i
< 5; i
++ ) *plf16
++ = *plf32
++;
95 *((INT32
*)plf16
)++ = *plf32
++;
96 *((INT32
*)plf16
) = *plf32
;
99 static void __logfont16to32( INT32
* plf32
, const INT16
* plf16
)
102 for( i
= 0; i
< 5; i
++ ) *plf32
++ = *plf16
++;
103 *plf32
++ = *((INT32
*)plf16
)++;
104 *plf32
= *((INT32
*)plf16
);
107 void FONT_LogFont32ATo16( const LOGFONT32A
* font32
, LPLOGFONT16 font16
)
109 __logfont32to16( (INT16
*)font16
, (const INT32
*)font32
);
110 lstrcpyn32A( font16
->lfFaceName
, font32
->lfFaceName
, LF_FACESIZE
);
113 void FONT_LogFont32WTo16( const LOGFONT32W
* font32
, LPLOGFONT16 font16
)
115 __logfont32to16( (INT16
*)font16
, (const INT32
*)font32
);
116 lstrcpynWtoA( font16
->lfFaceName
, font32
->lfFaceName
, LF_FACESIZE
);
119 void FONT_LogFont16To32A( const LPLOGFONT16 font16
, LPLOGFONT32A font32
)
121 __logfont16to32( (INT32
*)font32
, (const INT16
*)font16
);
122 lstrcpyn32A( font32
->lfFaceName
, font16
->lfFaceName
, LF_FACESIZE
);
125 void FONT_LogFont16To32W( const LPLOGFONT16 font16
, LPLOGFONT32W font32
)
127 __logfont16to32( (INT32
*)font32
, (const INT16
*)font16
);
128 lstrcpynAtoW( font32
->lfFaceName
, font16
->lfFaceName
, LF_FACESIZE
);
131 /***********************************************************************
132 * TEXTMETRIC conversion functions.
134 void FONT_TextMetric32Ato16(const LPTEXTMETRIC32A ptm32
, LPTEXTMETRIC16 ptm16
)
136 ptm16
->tmHeight
= ptm32
->tmHeight
;
137 ptm16
->tmAscent
= ptm32
->tmAscent
;
138 ptm16
->tmDescent
= ptm32
->tmDescent
;
139 ptm16
->tmInternalLeading
= ptm32
->tmInternalLeading
;
140 ptm16
->tmExternalLeading
= ptm32
->tmExternalLeading
;
141 ptm16
->tmAveCharWidth
= ptm32
->tmAveCharWidth
;
142 ptm16
->tmMaxCharWidth
= ptm32
->tmMaxCharWidth
;
143 ptm16
->tmWeight
= ptm32
->tmWeight
;
144 ptm16
->tmOverhang
= ptm32
->tmOverhang
;
145 ptm16
->tmDigitizedAspectX
= ptm32
->tmDigitizedAspectX
;
146 ptm16
->tmDigitizedAspectY
= ptm32
->tmDigitizedAspectY
;
147 ptm16
->tmFirstChar
= ptm32
->tmFirstChar
;
148 ptm16
->tmLastChar
= ptm32
->tmLastChar
;
149 ptm16
->tmDefaultChar
= ptm32
->tmDefaultChar
;
150 ptm16
->tmBreakChar
= ptm32
->tmBreakChar
;
151 ptm16
->tmItalic
= ptm32
->tmItalic
;
152 ptm16
->tmUnderlined
= ptm32
->tmUnderlined
;
153 ptm16
->tmStruckOut
= ptm32
->tmStruckOut
;
154 ptm16
->tmPitchAndFamily
= ptm32
->tmPitchAndFamily
;
155 ptm16
->tmCharSet
= ptm32
->tmCharSet
;
158 void FONT_TextMetric32Wto16(const LPTEXTMETRIC32W ptm32
, LPTEXTMETRIC16 ptm16
)
160 ptm16
->tmHeight
= ptm32
->tmHeight
;
161 ptm16
->tmAscent
= ptm32
->tmAscent
;
162 ptm16
->tmDescent
= ptm32
->tmDescent
;
163 ptm16
->tmInternalLeading
= ptm32
->tmInternalLeading
;
164 ptm16
->tmExternalLeading
= ptm32
->tmExternalLeading
;
165 ptm16
->tmAveCharWidth
= ptm32
->tmAveCharWidth
;
166 ptm16
->tmMaxCharWidth
= ptm32
->tmMaxCharWidth
;
167 ptm16
->tmWeight
= ptm32
->tmWeight
;
168 ptm16
->tmOverhang
= ptm32
->tmOverhang
;
169 ptm16
->tmDigitizedAspectX
= ptm32
->tmDigitizedAspectX
;
170 ptm16
->tmDigitizedAspectY
= ptm32
->tmDigitizedAspectY
;
171 ptm16
->tmFirstChar
= ptm32
->tmFirstChar
;
172 ptm16
->tmLastChar
= ptm32
->tmLastChar
;
173 ptm16
->tmDefaultChar
= ptm32
->tmDefaultChar
;
174 ptm16
->tmBreakChar
= ptm32
->tmBreakChar
;
175 ptm16
->tmItalic
= ptm32
->tmItalic
;
176 ptm16
->tmUnderlined
= ptm32
->tmUnderlined
;
177 ptm16
->tmStruckOut
= ptm32
->tmStruckOut
;
178 ptm16
->tmPitchAndFamily
= ptm32
->tmPitchAndFamily
;
179 ptm16
->tmCharSet
= ptm32
->tmCharSet
;
182 void FONT_TextMetric16to32A(const LPTEXTMETRIC16 ptm16
, LPTEXTMETRIC32A ptm32
)
184 ptm32
->tmHeight
= ptm16
->tmHeight
;
185 ptm32
->tmAscent
= ptm16
->tmAscent
;
186 ptm32
->tmDescent
= ptm16
->tmDescent
;
187 ptm32
->tmInternalLeading
= ptm16
->tmInternalLeading
;
188 ptm32
->tmExternalLeading
= ptm16
->tmExternalLeading
;
189 ptm32
->tmAveCharWidth
= ptm16
->tmAveCharWidth
;
190 ptm32
->tmMaxCharWidth
= ptm16
->tmMaxCharWidth
;
191 ptm32
->tmWeight
= ptm16
->tmWeight
;
192 ptm32
->tmOverhang
= ptm16
->tmOverhang
;
193 ptm32
->tmDigitizedAspectX
= ptm16
->tmDigitizedAspectX
;
194 ptm32
->tmDigitizedAspectY
= ptm16
->tmDigitizedAspectY
;
195 ptm32
->tmFirstChar
= ptm16
->tmFirstChar
;
196 ptm32
->tmLastChar
= ptm16
->tmLastChar
;
197 ptm32
->tmDefaultChar
= ptm16
->tmDefaultChar
;
198 ptm32
->tmBreakChar
= ptm16
->tmBreakChar
;
199 ptm32
->tmItalic
= ptm16
->tmItalic
;
200 ptm32
->tmUnderlined
= ptm16
->tmUnderlined
;
201 ptm32
->tmStruckOut
= ptm16
->tmStruckOut
;
202 ptm32
->tmPitchAndFamily
= ptm16
->tmPitchAndFamily
;
203 ptm32
->tmCharSet
= ptm16
->tmCharSet
;
206 void FONT_TextMetric16to32W(const LPTEXTMETRIC16 ptm16
, LPTEXTMETRIC32W ptm32
)
208 ptm32
->tmHeight
= ptm16
->tmHeight
;
209 ptm32
->tmAscent
= ptm16
->tmAscent
;
210 ptm32
->tmDescent
= ptm16
->tmDescent
;
211 ptm32
->tmInternalLeading
= ptm16
->tmInternalLeading
;
212 ptm32
->tmExternalLeading
= ptm16
->tmExternalLeading
;
213 ptm32
->tmAveCharWidth
= ptm16
->tmAveCharWidth
;
214 ptm32
->tmMaxCharWidth
= ptm16
->tmMaxCharWidth
;
215 ptm32
->tmWeight
= ptm16
->tmWeight
;
216 ptm32
->tmOverhang
= ptm16
->tmOverhang
;
217 ptm32
->tmDigitizedAspectX
= ptm16
->tmDigitizedAspectX
;
218 ptm32
->tmDigitizedAspectY
= ptm16
->tmDigitizedAspectY
;
219 ptm32
->tmFirstChar
= ptm16
->tmFirstChar
;
220 ptm32
->tmLastChar
= ptm16
->tmLastChar
;
221 ptm32
->tmDefaultChar
= ptm16
->tmDefaultChar
;
222 ptm32
->tmBreakChar
= ptm16
->tmBreakChar
;
223 ptm32
->tmItalic
= ptm16
->tmItalic
;
224 ptm32
->tmUnderlined
= ptm16
->tmUnderlined
;
225 ptm32
->tmStruckOut
= ptm16
->tmStruckOut
;
226 ptm32
->tmPitchAndFamily
= ptm16
->tmPitchAndFamily
;
227 ptm32
->tmCharSet
= ptm16
->tmCharSet
;
230 void FONT_TextMetric32Ato32W(const LPTEXTMETRIC32A ptm32A
, LPTEXTMETRIC32W ptm32W
)
232 ptm32W
->tmHeight
= ptm32A
->tmHeight
;
233 ptm32W
->tmAscent
= ptm32A
->tmAscent
;
234 ptm32W
->tmDescent
= ptm32A
->tmDescent
;
235 ptm32W
->tmInternalLeading
= ptm32A
->tmInternalLeading
;
236 ptm32W
->tmExternalLeading
= ptm32A
->tmExternalLeading
;
237 ptm32W
->tmAveCharWidth
= ptm32A
->tmAveCharWidth
;
238 ptm32W
->tmMaxCharWidth
= ptm32A
->tmMaxCharWidth
;
239 ptm32W
->tmWeight
= ptm32A
->tmWeight
;
240 ptm32W
->tmOverhang
= ptm32A
->tmOverhang
;
241 ptm32W
->tmDigitizedAspectX
= ptm32A
->tmDigitizedAspectX
;
242 ptm32W
->tmDigitizedAspectY
= ptm32A
->tmDigitizedAspectY
;
243 ptm32W
->tmFirstChar
= ptm32A
->tmFirstChar
;
244 ptm32W
->tmLastChar
= ptm32A
->tmLastChar
;
245 ptm32W
->tmDefaultChar
= ptm32A
->tmDefaultChar
;
246 ptm32W
->tmBreakChar
= ptm32A
->tmBreakChar
;
247 ptm32W
->tmItalic
= ptm32A
->tmItalic
;
248 ptm32W
->tmUnderlined
= ptm32A
->tmUnderlined
;
249 ptm32W
->tmStruckOut
= ptm32A
->tmStruckOut
;
250 ptm32W
->tmPitchAndFamily
= ptm32A
->tmPitchAndFamily
;
251 ptm32W
->tmCharSet
= ptm32A
->tmCharSet
;
254 /***********************************************************************
255 * CreateFontIndirect16 (GDI.57)
257 HFONT16 WINAPI
CreateFontIndirect16( const LOGFONT16
*font
)
263 hFont
= GDI_AllocObject( sizeof(FONTOBJ
), FONT_MAGIC
);
267 fontPtr
= (FONTOBJ
*) GDI_HEAP_LOCK( hFont
);
268 memcpy( &fontPtr
->logfont
, font
, sizeof(LOGFONT16
) );
270 TRACE(font
,"(%i %i %i %i) '%s' %s %s => %04x\n",
271 font
->lfHeight
, font
->lfWidth
,
272 font
->lfEscapement
, font
->lfOrientation
,
273 font
->lfFaceName
? font
->lfFaceName
: "NULL",
274 font
->lfWeight
> 400 ? "Bold" : "",
275 font
->lfItalic
? "Italic" : "",
278 if (font
->lfEscapement
!= font
->lfOrientation
) {
279 /* this should really depend on whether GM_ADVANCED is set */
280 fontPtr
->logfont
.lfOrientation
= fontPtr
->logfont
.lfEscapement
;
282 "orientation angle %f set to escapement angle %f for new font %04x\n",
283 font
->lfOrientation
/10., font
->lfEscapement
/10., hFont
);
285 GDI_HEAP_UNLOCK( hFont
);
288 else WARN(font
,"(NULL) => NULL\n");
293 /***********************************************************************
294 * CreateFontIndirect32A (GDI32.44)
296 HFONT32 WINAPI
CreateFontIndirect32A( const LOGFONT32A
*font
)
300 FONT_LogFont32ATo16( font
, &font16
);
301 return CreateFontIndirect16( &font16
);
304 /***********************************************************************
305 * CreateFontIndirect32W (GDI32.45)
307 HFONT32 WINAPI
CreateFontIndirect32W( const LOGFONT32W
*font
)
311 FONT_LogFont32WTo16( font
, &font16
);
312 return CreateFontIndirect16( &font16
);
315 /***********************************************************************
316 * CreateFont16 (GDI.56)
318 HFONT16 WINAPI
CreateFont16(INT16 height
, INT16 width
, INT16 esc
, INT16 orient
,
319 INT16 weight
, BYTE italic
, BYTE underline
,
320 BYTE strikeout
, BYTE charset
, BYTE outpres
,
321 BYTE clippres
, BYTE quality
, BYTE pitch
,
324 LOGFONT16 logfont
= { height
, width
, esc
, orient
, weight
, italic
, underline
,
325 strikeout
, charset
, outpres
, clippres
, quality
, pitch
, };
327 TRACE(font
,"('%s',%d,%d)\n",
328 (name
? name
: "(null)") , height
, width
);
330 lstrcpyn32A(logfont
.lfFaceName
,name
,sizeof(logfont
.lfFaceName
));
332 logfont
.lfFaceName
[0] = '\0';
333 return CreateFontIndirect16( &logfont
);
336 /*************************************************************************
337 * CreateFont32A (GDI32.43)
339 HFONT32 WINAPI
CreateFont32A( INT32 height
, INT32 width
, INT32 esc
,
340 INT32 orient
, INT32 weight
, DWORD italic
,
341 DWORD underline
, DWORD strikeout
, DWORD charset
,
342 DWORD outpres
, DWORD clippres
, DWORD quality
,
343 DWORD pitch
, LPCSTR name
)
345 return (HFONT32
)CreateFont16( height
, width
, esc
, orient
, weight
, italic
,
346 underline
, strikeout
, charset
, outpres
,
347 clippres
, quality
, pitch
, name
);
350 /*************************************************************************
351 * CreateFont32W (GDI32.46)
353 HFONT32 WINAPI
CreateFont32W( INT32 height
, INT32 width
, INT32 esc
,
354 INT32 orient
, INT32 weight
, DWORD italic
,
355 DWORD underline
, DWORD strikeout
, DWORD charset
,
356 DWORD outpres
, DWORD clippres
, DWORD quality
,
357 DWORD pitch
, LPCWSTR name
)
359 LPSTR namea
= HEAP_strdupWtoA( GetProcessHeap(), 0, name
);
360 HFONT32 ret
= (HFONT32
)CreateFont16( height
, width
, esc
, orient
, weight
,
361 italic
, underline
, strikeout
, charset
,
362 outpres
, clippres
, quality
, pitch
,
364 if (namea
) HeapFree( GetProcessHeap(), 0, namea
);
369 /***********************************************************************
372 INT16
FONT_GetObject16( FONTOBJ
* font
, INT16 count
, LPSTR buffer
)
374 if (count
> sizeof(LOGFONT16
)) count
= sizeof(LOGFONT16
);
375 memcpy( buffer
, &font
->logfont
, count
);
379 /***********************************************************************
382 INT32
FONT_GetObject32A( FONTOBJ
*font
, INT32 count
, LPSTR buffer
)
386 FONT_LogFont16To32A( &font
->logfont
, &fnt32
);
388 if (count
> sizeof(fnt32
)) count
= sizeof(fnt32
);
389 memcpy( buffer
, &fnt32
, count
);
392 /***********************************************************************
395 INT32
FONT_GetObject32W( FONTOBJ
*font
, INT32 count
, LPSTR buffer
)
399 FONT_LogFont16To32W( &font
->logfont
, &fnt32
);
401 if (count
> sizeof(fnt32
)) count
= sizeof(fnt32
);
402 memcpy( buffer
, &fnt32
, count
);
407 /***********************************************************************
408 * FONT_EnumInstance16
410 * Called by the device driver layer to pass font info
411 * down to the application.
413 static INT32
FONT_EnumInstance16( LPENUMLOGFONT16 plf
,
414 LPNEWTEXTMETRIC16 ptm
, UINT16 fType
, LPARAM lp
)
416 #define pfe ((fontEnum16*)lp)
417 if( pfe
->lpLogFontParam
->lfCharSet
== DEFAULT_CHARSET
||
418 pfe
->lpLogFontParam
->lfCharSet
== plf
->elfLogFont
.lfCharSet
)
420 memcpy( pfe
->lpLogFont
, plf
, sizeof(ENUMLOGFONT16
) );
421 memcpy( pfe
->lpTextMetric
, ptm
, sizeof(NEWTEXTMETRIC16
) );
423 return pfe
->lpEnumFunc( pfe
->segLogFont
, pfe
->segTextMetric
, fType
, (LPARAM
)(pfe
->lpData
) );
429 /***********************************************************************
430 * FONT_EnumInstance32
432 static INT32
FONT_EnumInstance32( LPENUMLOGFONT16 plf
,
433 LPNEWTEXTMETRIC16 ptm
, UINT16 fType
, LPARAM lp
)
435 /* lfCharSet is at the same offset in both LOGFONT32A and LOGFONT32W */
437 #define pfe ((fontEnum32*)lp)
438 if( pfe
->lpLogFontParam
->lfCharSet
== DEFAULT_CHARSET
||
439 pfe
->lpLogFontParam
->lfCharSet
== plf
->elfLogFont
.lfCharSet
)
441 /* convert font metrics */
443 if( pfe
->dwFlags
& ENUM_UNICODE
)
445 FONT_LogFont16To32W( &plf
->elfLogFont
, (LPLOGFONT32W
)(pfe
->lpLogFont
) );
446 FONT_TextMetric16to32W( (LPTEXTMETRIC16
)ptm
, (LPTEXTMETRIC32W
)(pfe
->lpTextMetric
) );
450 FONT_LogFont16To32A( &plf
->elfLogFont
, (LPLOGFONT32A
)pfe
->lpLogFont
);
451 FONT_TextMetric16to32A( (LPTEXTMETRIC16
)ptm
, (LPTEXTMETRIC32A
)pfe
->lpTextMetric
);
454 return pfe
->lpEnumFunc( (LPENUMLOGFONT32W
)pfe
->lpLogFont
,
455 (LPNEWTEXTMETRIC32W
)pfe
->lpTextMetric
, fType
, pfe
->lpData
);
461 /***********************************************************************
462 * EnumFontFamiliesEx16 (GDI.613)
464 INT16 WINAPI
EnumFontFamiliesEx16( HDC16 hDC
, LPLOGFONT16 plf
,
465 FONTENUMPROCEX16 efproc
, LPARAM lParam
,
469 DC
* dc
= (DC
*) GDI_GetObjPtr( hDC
, DC_MAGIC
);
471 if( dc
&& dc
->funcs
->pEnumDeviceFonts
)
473 LPNEWTEXTMETRICEX16 lptm16
= SEGPTR_ALLOC( sizeof(NEWTEXTMETRICEX16
) );
476 LPENUMLOGFONTEX16 lplf16
= SEGPTR_ALLOC( sizeof(ENUMLOGFONTEX16
) );
479 fontEnum16 fe16
= { plf
, efproc
, lParam
, lptm16
, lplf16
,
480 SEGPTR_GET(lptm16
), SEGPTR_GET(lplf16
) };
482 retVal
= dc
->funcs
->pEnumDeviceFonts( dc
, plf
, FONT_EnumInstance16
, (LPARAM
)&fe16
);
492 /***********************************************************************
493 * FONT_EnumFontFamiliesEx32
495 static INT32
FONT_EnumFontFamiliesEx32( HDC32 hDC
, LPLOGFONT32W plf
, FONTENUMPROC32W efproc
,
496 LPARAM lParam
, DWORD dwUnicode
)
498 DC
* dc
= (DC
*) GDI_GetObjPtr( hDC
, DC_MAGIC
);
500 if( dc
&& dc
->funcs
->pEnumDeviceFonts
)
503 NEWTEXTMETRICEX32W tm32w
;
504 ENUMLOGFONTEX32W lf32w
;
505 fontEnum32 fe32
= { plf
, efproc
, lParam
, &tm32w
, &lf32w
, dwUnicode
};
507 /* the only difference between LOGFONT32A and LOGFONT32W is in the lfFaceName */
509 if( plf
->lfFaceName
[0] )
512 lstrcpynWtoA( lf16
.lfFaceName
, plf
->lfFaceName
, LF_FACESIZE
);
514 lstrcpyn32A( lf16
.lfFaceName
, (LPCSTR
)plf
->lfFaceName
, LF_FACESIZE
);
516 else lf16
.lfFaceName
[0] = '\0';
517 lf16
.lfCharSet
= plf
->lfCharSet
;
519 return dc
->funcs
->pEnumDeviceFonts( dc
, &lf16
, FONT_EnumInstance32
, (LPARAM
)&fe32
);
524 /***********************************************************************
525 * EnumFontFamiliesEx32W (GDI32.82)
527 INT32 WINAPI
EnumFontFamiliesEx32W( HDC32 hDC
, LPLOGFONT32W plf
,
528 FONTENUMPROCEX32W efproc
,
529 LPARAM lParam
, DWORD dwFlags
)
531 return FONT_EnumFontFamiliesEx32( hDC
, plf
, (FONTENUMPROC32W
)efproc
,
532 lParam
, ENUM_UNICODE
);
535 /***********************************************************************
536 * EnumFontFamiliesEx32A (GDI32.81)
538 INT32 WINAPI
EnumFontFamiliesEx32A( HDC32 hDC
, LPLOGFONT32A plf
,
539 FONTENUMPROCEX32A efproc
,
540 LPARAM lParam
, DWORD dwFlags
)
542 return FONT_EnumFontFamiliesEx32( hDC
, (LPLOGFONT32W
)plf
,
543 (FONTENUMPROC32W
)efproc
, lParam
, 0);
546 /***********************************************************************
547 * EnumFontFamilies16 (GDI.330)
549 INT16 WINAPI
EnumFontFamilies16( HDC16 hDC
, LPCSTR lpFamily
,
550 FONTENUMPROC16 efproc
, LPARAM lpData
)
554 lf
.lfCharSet
= DEFAULT_CHARSET
;
555 if( lpFamily
) lstrcpyn32A( lf
.lfFaceName
, lpFamily
, LF_FACESIZE
);
556 else lf
.lfFaceName
[0] = '\0';
558 return EnumFontFamiliesEx16( hDC
, &lf
, (FONTENUMPROCEX16
)efproc
, lpData
, 0 );
561 /***********************************************************************
562 * EnumFontFamilies32A (GDI32.80)
564 INT32 WINAPI
EnumFontFamilies32A( HDC32 hDC
, LPCSTR lpFamily
,
565 FONTENUMPROC32A efproc
, LPARAM lpData
)
569 lf
.lfCharSet
= DEFAULT_CHARSET
;
570 if( lpFamily
) lstrcpyn32A( lf
.lfFaceName
, lpFamily
, LF_FACESIZE
);
571 else lf
.lfFaceName
[0] = lf
.lfFaceName
[1] = '\0';
573 return FONT_EnumFontFamiliesEx32( hDC
, (LPLOGFONT32W
)&lf
,
574 (FONTENUMPROC32W
)efproc
, lpData
, 0 );
577 /***********************************************************************
578 * EnumFontFamilies32W (GDI32.83)
580 INT32 WINAPI
EnumFontFamilies32W( HDC32 hDC
, LPCWSTR lpFamily
,
581 FONTENUMPROC32W efproc
, LPARAM lpData
)
585 lf
.lfCharSet
= DEFAULT_CHARSET
;
586 if( lpFamily
) lstrcpyn32W( lf
.lfFaceName
, lpFamily
, LF_FACESIZE
);
587 else lf
.lfFaceName
[0] = 0;
589 return FONT_EnumFontFamiliesEx32( hDC
, &lf
, efproc
, lpData
, ENUM_UNICODE
);
592 /***********************************************************************
593 * EnumFonts16 (GDI.70)
595 INT16 WINAPI
EnumFonts16( HDC16 hDC
, LPCSTR lpName
, FONTENUMPROC16 efproc
,
598 return EnumFontFamilies16( hDC
, lpName
, (FONTENUMPROCEX16
)efproc
, lpData
);
601 /***********************************************************************
602 * EnumFonts32A (GDI32.84)
604 INT32 WINAPI
EnumFonts32A( HDC32 hDC
, LPCSTR lpName
, FONTENUMPROC32A efproc
,
607 return EnumFontFamilies32A( hDC
, lpName
, efproc
, lpData
);
610 /***********************************************************************
611 * EnumFonts32W (GDI32.85)
613 INT32 WINAPI
EnumFonts32W( HDC32 hDC
, LPCWSTR lpName
, FONTENUMPROC32W efproc
,
616 return EnumFontFamilies32W( hDC
, lpName
, efproc
, lpData
);
620 /***********************************************************************
621 * GetTextCharacterExtra16 (GDI.89)
623 INT16 WINAPI
GetTextCharacterExtra16( HDC16 hdc
)
625 DC
* dc
= (DC
*) GDI_GetObjPtr( hdc
, DC_MAGIC
);
627 return abs( (dc
->w
.charExtra
* dc
->wndExtX
+ dc
->vportExtX
/ 2)
632 /***********************************************************************
633 * GetTextCharacterExtra32 (GDI32.225)
635 INT32 WINAPI
GetTextCharacterExtra32( HDC32 hdc
)
637 DC
* dc
= (DC
*) GDI_GetObjPtr( hdc
, DC_MAGIC
);
639 return abs( (dc
->w
.charExtra
* dc
->wndExtX
+ dc
->vportExtX
/ 2)
644 /***********************************************************************
645 * SetTextCharacterExtra16 (GDI.8)
647 INT16 WINAPI
SetTextCharacterExtra16( HDC16 hdc
, INT16 extra
)
649 return (INT16
)SetTextCharacterExtra32( hdc
, extra
);
653 /***********************************************************************
654 * SetTextCharacterExtra32 (GDI32.337)
656 INT32 WINAPI
SetTextCharacterExtra32( HDC32 hdc
, INT32 extra
)
659 DC
* dc
= (DC
*) GDI_GetObjPtr( hdc
, DC_MAGIC
);
661 extra
= (extra
* dc
->vportExtX
+ dc
->wndExtX
/ 2) / dc
->wndExtX
;
662 prev
= dc
->w
.charExtra
;
663 dc
->w
.charExtra
= abs(extra
);
664 return (prev
* dc
->wndExtX
+ dc
->vportExtX
/ 2) / dc
->vportExtX
;
668 /***********************************************************************
669 * SetTextJustification16 (GDI.10)
671 INT16 WINAPI
SetTextJustification16( HDC16 hdc
, INT16 extra
, INT16 breaks
)
673 return SetTextJustification32( hdc
, extra
, breaks
);
677 /***********************************************************************
678 * SetTextJustification32 (GDI32.339)
680 BOOL32 WINAPI
SetTextJustification32( HDC32 hdc
, INT32 extra
, INT32 breaks
)
682 DC
* dc
= (DC
*) GDI_GetObjPtr( hdc
, DC_MAGIC
);
685 extra
= abs((extra
* dc
->vportExtX
+ dc
->wndExtX
/ 2) / dc
->wndExtX
);
686 if (!extra
) breaks
= 0;
687 dc
->w
.breakTotalExtra
= extra
;
688 dc
->w
.breakCount
= breaks
;
691 dc
->w
.breakExtra
= extra
/ breaks
;
692 dc
->w
.breakRem
= extra
- (dc
->w
.breakCount
* dc
->w
.breakExtra
);
696 dc
->w
.breakExtra
= 0;
703 /***********************************************************************
704 * GetTextFace16 (GDI.92)
706 INT16 WINAPI
GetTextFace16( HDC16 hdc
, INT16 count
, LPSTR name
)
708 return GetTextFace32A(hdc
,count
,name
);
711 /***********************************************************************
712 * GetTextFace32A (GDI32.234)
714 INT32 WINAPI
GetTextFace32A( HDC32 hdc
, INT32 count
, LPSTR name
)
718 DC
* dc
= (DC
*) GDI_GetObjPtr( hdc
, DC_MAGIC
);
720 if (!(font
= (FONTOBJ
*) GDI_GetObjPtr( dc
->w
.hFont
, FONT_MAGIC
)))
723 lstrcpyn32A( name
, font
->logfont
.lfFaceName
, count
);
724 GDI_HEAP_UNLOCK( dc
->w
.hFont
);
728 return strlen(font
->logfont
.lfFaceName
) + 1;
731 /***********************************************************************
732 * GetTextFace32W (GDI32.235)
734 INT32 WINAPI
GetTextFace32W( HDC32 hdc
, INT32 count
, LPWSTR name
)
736 LPSTR nameA
= HeapAlloc( GetProcessHeap(), 0, count
);
737 INT32 res
= GetTextFace32A(hdc
,count
,nameA
);
738 lstrcpyAtoW( name
, nameA
);
739 HeapFree( GetProcessHeap(), 0, nameA
);
744 /***********************************************************************
745 * GetTextExtent (GDI.91)
747 DWORD WINAPI
GetTextExtent( HDC16 hdc
, LPCSTR str
, INT16 count
)
750 if (!GetTextExtentPoint16( hdc
, str
, count
, &size
)) return 0;
751 return MAKELONG( size
.cx
, size
.cy
);
755 /***********************************************************************
756 * GetTextExtentPoint16 (GDI.471)
758 * FIXME: Should this have a bug for compatibility?
759 * Original Windows versions of GetTextExtentPoint{A,W} have documented
760 * bugs (-> MSDN KB q147647.txt).
762 BOOL16 WINAPI
GetTextExtentPoint16( HDC16 hdc
, LPCSTR str
, INT16 count
,
766 BOOL32 ret
= GetTextExtentPoint32A( hdc
, str
, count
, &size32
);
767 CONV_SIZE32TO16( &size32
, size
);
772 /***********************************************************************
773 * GetTextExtentPoint32A (GDI32.230)
775 BOOL32 WINAPI
GetTextExtentPoint32A( HDC32 hdc
, LPCSTR str
, INT32 count
,
778 DC
* dc
= (DC
*) GDI_GetObjPtr( hdc
, DC_MAGIC
);
781 if (!(dc
= (DC
*)GDI_GetObjPtr( hdc
, METAFILE_DC_MAGIC
)))
785 if (!dc
->funcs
->pGetTextExtentPoint
||
786 !dc
->funcs
->pGetTextExtentPoint( dc
, str
, count
, size
))
789 TRACE(font
,"(%08x %s %d %p): returning %d,%d\n",
790 hdc
, debugstr_an (str
, count
), count
,
791 size
, size
->cx
, size
->cy
);
796 /***********************************************************************
797 * GetTextExtentPoint32W [GDI32.231] Computes width/height for a string
799 * Computes width and height of the specified string.
805 BOOL32 WINAPI
GetTextExtentPoint32W(
806 HDC32 hdc
, /* [in] Handle of device context */
807 LPCWSTR str
, /* [in] Address of text string */
808 INT32 count
, /* [in] Number of characters in string */
809 LPSIZE32 size
) /* [out] Address of structure for string size */
811 LPSTR p
= HEAP_strdupWtoA( GetProcessHeap(), 0, str
);
812 BOOL32 ret
= GetTextExtentPoint32A( hdc
, p
, count
, size
);
813 HeapFree( GetProcessHeap(), 0, p
);
818 /***********************************************************************
819 * GetTextExtentPoint32ABuggy (GDI32.232)
821 BOOL32 WINAPI
GetTextExtentPoint32ABuggy( HDC32 hdc
, LPCSTR str
, INT32 count
,
824 TRACE(font
, "not bug compatible.\n");
825 return GetTextExtentPoint32A( hdc
, str
, count
, size
);
828 /***********************************************************************
829 * GetTextExtentPoint32WBuggy (GDI32.233)
831 BOOL32 WINAPI
GetTextExtentPoint32WBuggy( HDC32 hdc
, LPCWSTR str
, INT32 count
,
834 TRACE(font
, "not bug compatible.\n");
835 return GetTextExtentPoint32W( hdc
, str
, count
, size
);
839 /***********************************************************************
840 * GetTextExtentExPoint32A (GDI32.228)
842 BOOL32 WINAPI
GetTextExtentExPoint32A( HDC32 hdc
, LPCSTR str
, INT32 count
,
843 INT32 maxExt
, LPINT32 lpnFit
,
844 LPINT32 alpDx
, LPSIZE32 size
)
846 int index
, nFit
, extent
;
848 DC
* dc
= (DC
*) GDI_GetObjPtr( hdc
, DC_MAGIC
);
852 if (!(dc
= (DC
*)GDI_GetObjPtr( hdc
, METAFILE_DC_MAGIC
)))
855 if (!dc
->funcs
->pGetTextExtentPoint
) return FALSE
;
857 size
->cx
= size
->cy
= nFit
= extent
= 0;
858 for(index
= 0; index
< count
; index
++)
860 if(!dc
->funcs
->pGetTextExtentPoint( dc
, str
, 1, &tSize
)) return FALSE
;
861 if( extent
+tSize
.cx
< maxExt
)
866 if( alpDx
) alpDx
[index
] = extent
;
867 if( tSize
.cy
> size
->cy
) size
->cy
= tSize
.cy
;
874 TRACE(font
,"(%08x '%.*s' %d) returning %d %d %d\n",
875 hdc
,count
,str
,maxExt
,nFit
, size
->cx
,size
->cy
);
880 /***********************************************************************
881 * GetTextExtentExPoint32W (GDI32.229)
884 BOOL32 WINAPI
GetTextExtentExPoint32W( HDC32 hdc
, LPCWSTR str
, INT32 count
,
885 INT32 maxExt
, LPINT32 lpnFit
,
886 LPINT32 alpDx
, LPSIZE32 size
)
888 LPSTR p
= HEAP_strdupWtoA( GetProcessHeap(), 0, str
);
889 BOOL32 ret
= GetTextExtentExPoint32A( hdc
, p
, count
, maxExt
,
890 lpnFit
, alpDx
, size
);
891 HeapFree( GetProcessHeap(), 0, p
);
895 /***********************************************************************
896 * GetTextMetrics16 (GDI.93)
898 BOOL16 WINAPI
GetTextMetrics16( HDC16 hdc
, TEXTMETRIC16
*metrics
)
902 if (!GetTextMetrics32A( (HDC32
)hdc
, &tm32
)) return FALSE
;
903 FONT_TextMetric32Ato16( &tm32
, metrics
);
908 /***********************************************************************
909 * GetTextMetrics32A (GDI32.236)
911 BOOL32 WINAPI
GetTextMetrics32A( HDC32 hdc
, TEXTMETRIC32A
*metrics
)
913 DC
* dc
= (DC
*) GDI_GetObjPtr( hdc
, DC_MAGIC
);
916 if (!(dc
= (DC
*)GDI_GetObjPtr( hdc
, METAFILE_DC_MAGIC
)))
920 if (!dc
->funcs
->pGetTextMetrics
||
921 !dc
->funcs
->pGetTextMetrics( dc
, metrics
))
924 /* device layer returns values in device units
925 * therefore we have to convert them to logical */
927 #define WDPTOLP(x) ((x<0)? \
928 (-abs((x)*dc->wndExtX/dc->vportExtX)): \
929 (abs((x)*dc->wndExtX/dc->vportExtX)))
930 #define HDPTOLP(y) ((y<0)? \
931 (-abs((y)*dc->wndExtY/dc->vportExtY)): \
932 (abs((y)*dc->wndExtY/dc->vportExtY)))
934 metrics
->tmHeight
= HDPTOLP(metrics
->tmHeight
);
935 metrics
->tmAscent
= HDPTOLP(metrics
->tmAscent
);
936 metrics
->tmDescent
= HDPTOLP(metrics
->tmDescent
);
937 metrics
->tmInternalLeading
= HDPTOLP(metrics
->tmInternalLeading
);
938 metrics
->tmExternalLeading
= HDPTOLP(metrics
->tmExternalLeading
);
939 metrics
->tmAveCharWidth
= WDPTOLP(metrics
->tmAveCharWidth
);
940 metrics
->tmMaxCharWidth
= WDPTOLP(metrics
->tmMaxCharWidth
);
941 metrics
->tmOverhang
= WDPTOLP(metrics
->tmOverhang
);
943 TRACE(font
,"text metrics:
944 Weight = %03i\t FirstChar = %03i\t AveCharWidth = %i
945 Italic = % 3i\t LastChar = %03i\t\t MaxCharWidth = %i
946 UnderLined = %01i\t DefaultChar = %03i\t Overhang = %i
947 StruckOut = %01i\t BreakChar = %03i\t CharSet = %i
948 PitchAndFamily = %02x
954 metrics
->tmWeight
, metrics
->tmFirstChar
, metrics
->tmAveCharWidth
,
955 metrics
->tmItalic
, metrics
->tmLastChar
, metrics
->tmMaxCharWidth
,
956 metrics
->tmUnderlined
, metrics
->tmDefaultChar
, metrics
->tmOverhang
,
957 metrics
->tmStruckOut
, metrics
->tmBreakChar
, metrics
->tmCharSet
,
958 metrics
->tmPitchAndFamily
,
959 metrics
->tmInternalLeading
,
967 /***********************************************************************
968 * GetTextMetrics32W (GDI32.237)
970 BOOL32 WINAPI
GetTextMetrics32W( HDC32 hdc
, TEXTMETRIC32W
*metrics
)
973 if (!GetTextMetrics32A( (HDC16
)hdc
, &tm
)) return FALSE
;
974 FONT_TextMetric32Ato32W( &tm
, metrics
);
979 /***********************************************************************
980 * GetOutlineTextMetrics [GDI.308] Gets metrics for TrueType fonts.
983 * lpOTM should be LPOUTLINETEXTMETRIC
986 * Success: Non-zero or size of required buffer
989 UINT16 WINAPI
GetOutlineTextMetrics16(
990 HDC16 hdc
, /* [in] Handle of device context */
991 UINT16 cbData
, /* [in] Size of metric data array */
992 LPOUTLINETEXTMETRIC16 lpOTM
) /* [out] Address of metric data array */
994 FIXME(font
, "(%04x,%04x,%p): stub\n", hdc
,cbData
,lpOTM
);
999 /***********************************************************************
1000 * GetOutlineTextMetrics [GDI.207] Gets metrics for TrueType fonts.
1004 * Success: Non-zero or size of required buffer
1007 UINT32 WINAPI
GetOutlineTextMetrics32A(
1008 HDC32 hdc
, /* [in] Handle of device context */
1009 UINT32 cbData
, /* [in] Size of metric data array */
1010 LPOUTLINETEXTMETRIC32A lpOTM
) /* [out] Address of metric data array */
1015 LPTEXTMETRIC32A lptxtMetr
;
1022 lpOTM
= (LPOUTLINETEXTMETRIC32A
)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY
,sizeof(OUTLINETEXTMETRIC32A
));
1023 rtn
= sizeof(OUTLINETEXTMETRIC32A
);
1027 cbData
= sizeof(*lpOTM
);
1031 lpOTM
->otmSize
= cbData
;
1033 lptxtMetr
=HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY
,sizeof(TEXTMETRIC32A
));
1035 if (!GetTextMetrics32A(hdc
,lptxtMetr
))
1040 memcpy(&(lpOTM
->otmTextMetrics
),lptxtMetr
,sizeof(TEXTMETRIC32A
));
1043 HeapFree(GetProcessHeap(),HEAP_ZERO_MEMORY
,lptxtMetr
);
1045 lpOTM
->otmFilter
= 0;
1047 lpOTM
->otmPanoseNumber
.bFamilyType
= 0;
1048 lpOTM
->otmPanoseNumber
.bSerifStyle
= 0;
1049 lpOTM
->otmPanoseNumber
.bWeight
= 0;
1050 lpOTM
->otmPanoseNumber
.bProportion
= 0;
1051 lpOTM
->otmPanoseNumber
.bContrast
= 0;
1052 lpOTM
->otmPanoseNumber
.bStrokeVariation
= 0;
1053 lpOTM
->otmPanoseNumber
.bArmStyle
= 0;
1054 lpOTM
->otmPanoseNumber
.bLetterform
= 0;
1055 lpOTM
->otmPanoseNumber
.bMidline
= 0;
1056 lpOTM
->otmPanoseNumber
.bXHeight
= 0;
1058 lpOTM
->otmfsSelection
= 0;
1059 lpOTM
->otmfsType
= 0;
1062 Further fill of the structure not implemented,
1063 Needs real values for the structure members
1069 /***********************************************************************
1070 * GetOutlineTextMetrics32W [GDI32.208]
1072 UINT32 WINAPI
GetOutlineTextMetrics32W(
1073 HDC32 hdc
, /* [in] Handle of device context */
1074 UINT32 cbData
, /* [in] Size of metric data array */
1075 LPOUTLINETEXTMETRIC32W lpOTM
) /* [out] Address of metric data array */
1077 FIXME(font
, "(%d,%d,%p): stub\n", hdc
, cbData
, lpOTM
);
1081 /***********************************************************************
1082 * GetCharWidth16 (GDI.350)
1084 BOOL16 WINAPI
GetCharWidth16( HDC16 hdc
, UINT16 firstChar
, UINT16 lastChar
,
1087 BOOL32 retVal
= FALSE
;
1089 if( firstChar
!= lastChar
)
1091 LPINT32 buf32
= (LPINT32
)HeapAlloc(GetProcessHeap(), 0,
1092 sizeof(INT32
)*(1 + (lastChar
- firstChar
)));
1095 LPINT32 obuf32
= buf32
;
1098 retVal
= GetCharWidth32A(hdc
, firstChar
, lastChar
, buf32
);
1101 for (i
= firstChar
; i
<= lastChar
; i
++)
1102 *buffer
++ = *buf32
++;
1104 HeapFree(GetProcessHeap(), 0, obuf32
);
1107 else /* happens quite often to warrant a special treatment */
1110 retVal
= GetCharWidth32A(hdc
, firstChar
, lastChar
, &chWidth
);
1117 /***********************************************************************
1118 * GetCharWidth32A (GDI32.155)
1120 BOOL32 WINAPI
GetCharWidth32A( HDC32 hdc
, UINT32 firstChar
, UINT32 lastChar
,
1124 DC
* dc
= (DC
*) GDI_GetObjPtr( hdc
, DC_MAGIC
);
1127 if (!(dc
= (DC
*)GDI_GetObjPtr( hdc
, METAFILE_DC_MAGIC
)))
1131 if (!dc
->funcs
->pGetCharWidth
||
1132 !dc
->funcs
->pGetCharWidth( dc
, firstChar
, lastChar
, buffer
))
1135 /* convert device units to logical */
1137 extra
= dc
->vportExtX
>> 1;
1138 for( i
= firstChar
; i
<= lastChar
; i
++, buffer
++ )
1139 *buffer
= (*buffer
* dc
->wndExtX
+ extra
) / dc
->vportExtX
;
1145 /***********************************************************************
1146 * GetCharWidth32W (GDI32.158)
1148 BOOL32 WINAPI
GetCharWidth32W( HDC32 hdc
, UINT32 firstChar
, UINT32 lastChar
,
1151 return GetCharWidth32A( hdc
, firstChar
, lastChar
, buffer
);
1156 /* FIXME: all following APIs *******************************************
1159 * SetMapperFlags16 (GDI.349)
1161 DWORD WINAPI
SetMapperFlags16( HDC16 hDC
, DWORD dwFlag
)
1163 return SetMapperFlags32( hDC
, dwFlag
);
1167 /***********************************************************************
1168 * SetMapperFlags32 (GDI32.322)
1170 DWORD WINAPI
SetMapperFlags32( HDC32 hDC
, DWORD dwFlag
)
1172 FIXME(font
, "(0x%04x, 0x%08lx): stub - harmless\n", hDC
, dwFlag
);
1176 /***********************************************************************
1177 * GetAspectRatioFilterEx16 (GDI.486)
1179 BOOL16 WINAPI
GetAspectRatioFilterEx16( HDC16 hdc
, LPSIZE16 pAspectRatio
)
1181 FIXME(font
, "(%04x, %p): -- Empty Stub !\n",
1186 /***********************************************************************
1187 * GetAspectRatioFilterEx32 (GDI32.142)
1189 BOOL32 WINAPI
GetAspectRatioFilterEx32( HDC32 hdc
, LPSIZE32 pAspectRatio
)
1191 FIXME(font
, "(%04x, %p): -- Empty Stub !\n",
1196 /***********************************************************************
1197 * GetCharABCWidths16 (GDI.307)
1199 BOOL16 WINAPI
GetCharABCWidths16( HDC16 hdc
, UINT16 firstChar
, UINT16 lastChar
,
1203 if (!GetCharABCWidths32A( hdc
, firstChar
, lastChar
, &abc32
)) return FALSE
;
1204 abc
->abcA
= abc32
.abcA
;
1205 abc
->abcB
= abc32
.abcB
;
1206 abc
->abcC
= abc32
.abcC
;
1211 /***********************************************************************
1212 * GetCharABCWidths32A (GDI32.149)
1214 BOOL32 WINAPI
GetCharABCWidths32A(HDC32 hdc
, UINT32 firstChar
, UINT32 lastChar
,
1217 return GetCharABCWidths32W( hdc
, firstChar
, lastChar
, abc
);
1221 /******************************************************************************
1222 * GetCharABCWidths32W [GDI32.152] Retrieves widths of characters in range
1225 * hdc [I] Handle of device context
1226 * firstChar [I] First character in range to query
1227 * lastChar [I] Last character in range to query
1228 * abc [O] Address of character-width structure
1231 * Only works with TrueType fonts
1237 BOOL32 WINAPI
GetCharABCWidths32W( HDC32 hdc
, UINT32 firstChar
, UINT32 lastChar
,
1240 /* No TrueType fonts in Wine so far */
1241 FIXME(font
, "(%04x,%04x,%04x,%p): stub\n", hdc
, firstChar
, lastChar
, abc
);
1246 /***********************************************************************
1247 * GetGlyphOutline16 (GDI.309)
1249 DWORD WINAPI
GetGlyphOutline16( HDC16 hdc
, UINT16 uChar
, UINT16 fuFormat
,
1250 LPGLYPHMETRICS16 lpgm
, DWORD cbBuffer
,
1251 LPVOID lpBuffer
, const MAT2
*lpmat2
)
1253 FIXME(font
,"(%04x, '%c', %04x, %p, %ld, %p, %p): stub\n",
1254 hdc
, uChar
, fuFormat
, lpgm
, cbBuffer
, lpBuffer
, lpmat2
);
1255 return (DWORD
)-1; /* failure */
1259 /***********************************************************************
1260 * GetGlyphOutline32A (GDI32.186)
1262 DWORD WINAPI
GetGlyphOutline32A( HDC32 hdc
, UINT32 uChar
, UINT32 fuFormat
,
1263 LPGLYPHMETRICS32 lpgm
, DWORD cbBuffer
,
1264 LPVOID lpBuffer
, const MAT2
*lpmat2
)
1266 FIXME(font
,"(%04x, '%c', %04x, %p, %ld, %p, %p): stub\n",
1267 hdc
, uChar
, fuFormat
, lpgm
, cbBuffer
, lpBuffer
, lpmat2
);
1268 return (DWORD
)-1; /* failure */
1271 /***********************************************************************
1272 * GetGlyphOutline32W (GDI32.187)
1274 DWORD WINAPI
GetGlyphOutline32W( HDC32 hdc
, UINT32 uChar
, UINT32 fuFormat
,
1275 LPGLYPHMETRICS32 lpgm
, DWORD cbBuffer
,
1276 LPVOID lpBuffer
, const MAT2
*lpmat2
)
1278 FIXME(font
,"(%04x, '%c', %04x, %p, %ld, %p, %p): stub\n",
1279 hdc
, uChar
, fuFormat
, lpgm
, cbBuffer
, lpBuffer
, lpmat2
);
1280 return (DWORD
)-1; /* failure */
1283 /***********************************************************************
1284 * CreateScalableFontResource16 (GDI.310)
1286 BOOL16 WINAPI
CreateScalableFontResource16( UINT16 fHidden
,
1287 LPCSTR lpszResourceFile
,
1288 LPCSTR fontFile
, LPCSTR path
)
1290 return CreateScalableFontResource32A( fHidden
, lpszResourceFile
,
1294 /***********************************************************************
1295 * CreateScalableFontResource32A (GDI32.62)
1297 BOOL32 WINAPI
CreateScalableFontResource32A( DWORD fHidden
,
1298 LPCSTR lpszResourceFile
,
1299 LPCSTR lpszFontFile
,
1300 LPCSTR lpszCurrentPath
)
1302 /* fHidden=1 - only visible for the calling app, read-only, not
1303 * enumbered with EnumFonts/EnumFontFamilies
1304 * lpszCurrentPath can be NULL
1306 FIXME(font
,"(%ld,%s,%s,%s): stub\n",
1307 fHidden
, lpszResourceFile
, lpszFontFile
, lpszCurrentPath
);
1308 return FALSE
; /* create failed */
1311 /***********************************************************************
1312 * CreateScalableFontResource32W (GDI32.63)
1314 BOOL32 WINAPI
CreateScalableFontResource32W( DWORD fHidden
,
1315 LPCWSTR lpszResourceFile
,
1316 LPCWSTR lpszFontFile
,
1317 LPCWSTR lpszCurrentPath
)
1319 FIXME(font
,"(%ld,%p,%p,%p): stub\n",
1320 fHidden
, lpszResourceFile
, lpszFontFile
, lpszCurrentPath
);
1321 return FALSE
; /* create failed */
1325 /*************************************************************************
1326 * GetRasterizerCaps16 (GDI.313)
1328 BOOL16 WINAPI
GetRasterizerCaps16( LPRASTERIZER_STATUS lprs
, UINT16 cbNumBytes
)
1330 return GetRasterizerCaps32( lprs
, cbNumBytes
);
1334 /*************************************************************************
1335 * GetRasterizerCaps32 (GDI32.216)
1337 BOOL32 WINAPI
GetRasterizerCaps32( LPRASTERIZER_STATUS lprs
, UINT32 cbNumBytes
)
1339 lprs
->nSize
= sizeof(RASTERIZER_STATUS
);
1340 lprs
->wFlags
= TT_AVAILABLE
|TT_ENABLED
;
1341 lprs
->nLanguageID
= 0;
1346 /*************************************************************************
1347 * GetKerningPairs16 (GDI.332)
1349 INT16 WINAPI
GetKerningPairs16( HDC16 hDC
, INT16 cPairs
,
1350 LPKERNINGPAIR16 lpKerningPairs
)
1352 /* At this time kerning is ignored (set to 0) */
1354 FIXME(font
,"(%x,%d,%p): almost empty stub!\n",
1355 hDC
, cPairs
, lpKerningPairs
);
1356 for (i
= 0; i
< cPairs
; i
++)
1357 lpKerningPairs
[i
].iKernAmount
= 0;
1363 /*************************************************************************
1364 * GetKerningPairs32A (GDI32.192)
1366 DWORD WINAPI
GetKerningPairs32A( HDC32 hDC
, DWORD cPairs
,
1367 LPKERNINGPAIR32 lpKerningPairs
)
1370 FIXME(font
,"(%x,%ld,%p): almost empty stub!\n",
1371 hDC
, cPairs
, lpKerningPairs
);
1372 for (i
= 0; i
< cPairs
; i
++)
1373 lpKerningPairs
[i
].iKernAmount
= 0;
1378 /*************************************************************************
1379 * GetKerningPairs32W (GDI32.193)
1381 DWORD WINAPI
GetKerningPairs32W( HDC32 hDC
, DWORD cPairs
,
1382 LPKERNINGPAIR32 lpKerningPairs
)
1384 return GetKerningPairs32A( hDC
, cPairs
, lpKerningPairs
);
1387 /*************************************************************************
1388 * TranslateCharsetInfo [GDI32.382]
1390 * Fills a CHARSETINFO structure for a character set, code page, or
1391 * font. This allows making the correspondance between different labelings
1392 * (character set, Windows, ANSI, and OEM codepages, and Unicode ranges)
1393 * of the same encoding.
1395 * Only one codepage will be set in lpCs->fs. If TCI_SRCFONTSIG is used,
1396 * only one codepage should be set in *lpSrc.
1399 * TRUE on success, FALSE on failure.
1402 BOOL32 WINAPI
TranslateCharsetInfo(
1404 if flags == TCI_SRCFONTSIG: pointer to fsCsb of a FONTSIGNATURE
1405 if flags == TCI_SRCCHARSET: a character set value
1406 if flags == TCI_SRCCODEPAGE: a code page value
1408 LPCHARSETINFO lpCs
, /* structure to receive charset information */
1409 DWORD flags
/* determines interpretation of lpSrc */
1413 case TCI_SRCFONTSIG
:
1414 while (!(*lpSrc
>>index
& 0x0001) && index
<MAXTCIINDEX
) index
++;
1416 case TCI_SRCCODEPAGE
:
1417 while ((UINT32
) (lpSrc
) != FONT_tci
[index
].ciACP
&& index
< MAXTCIINDEX
) index
++;
1419 case TCI_SRCCHARSET
:
1420 while ((UINT32
) (lpSrc
) != FONT_tci
[index
].ciCharset
&& index
< MAXTCIINDEX
) index
++;
1425 if (index
>= MAXTCIINDEX
|| FONT_tci
[index
].ciCharset
== DEFAULT_CHARSET
) return FALSE
;
1426 memcpy(lpCs
, &FONT_tci
[index
], sizeof(CHARSETINFO
));
1430 /*************************************************************************
1431 * GetFontLanguageInfo (GDI32.182)
1433 DWORD WINAPI
GetFontLanguageInfo32(HDC32 hdc
) {
1434 /* return value 0 is correct for most cases anyway */
1435 FIXME(font
,"(%x):stub!\n", hdc
);
1439 /*************************************************************************
1440 * GetFontLanguageInfo (GDI.616)
1442 DWORD WINAPI
GetFontLanguageInfo16(HDC16 hdc
) {
1443 /* return value 0 is correct for most cases anyway */
1444 FIXME(font
,"(%x):stub!\n",hdc
);
1448 /*************************************************************************
1449 * GetFontData32 [GDI32.181] Retrieve data for TrueType font
1453 * success: Number of bytes returned
1454 * failure: GDI_ERROR
1458 * Calls SetLastError()
1464 DWORD WINAPI
GetFontData32(HDC32 hdc
, DWORD table
, DWORD offset
,
1465 LPVOID buffer
, DWORD length
)
1467 FIXME(font
, "(%x,%ld,%ld,%p,%ld): stub\n",
1468 hdc
, table
, offset
, buffer
, length
);
1469 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1473 /*************************************************************************
1474 * GetCharacterPlacement32A [GDI32.160]
1477 GetCharacterPlacement32A(HDC32 hdc
, LPCSTR lpString
, INT32 uCount
,
1478 INT32 nMaxExtent
, GCP_RESULTS32A
*lpResults
,
1481 /* return value 0 is correct for most cases anyway */
1482 FIXME(font
,":stub!\n");
1486 /*************************************************************************
1487 * GetCharacterPlacement32W [GDI32.161]
1490 GetCharacterPlacement32W(HDC32 hdc
, LPCWSTR lpString
, INT32 uCount
,
1491 INT32 nMaxExtent
, GCP_RESULTS32W
*lpResults
,
1494 /* return value 0 is correct for most cases anyway */
1495 FIXME(font
,":stub!\n");
1499 /*************************************************************************
1500 * GetCharABCWidthsFloat32A [GDI32.150]
1502 BOOL32 WINAPI
GetCharABCWidthsFloat32A(HDC32 hdc
, UINT32 iFirstChar
, UINT32 iLastChar
,
1505 FIXME(gdi
, "GetCharABCWidthsFloatA, stub\n");
1509 /*************************************************************************
1510 * GetCharABCWidthsFloat32W [GDI32.151]
1512 BOOL32 WINAPI
GetCharABCWidthsFloat32W(HDC32 hdc
, UINT32 iFirstChar
,
1513 UINT32 iLastChar
, LPABCFLOAT lpABCF
)
1515 FIXME(gdi
, "GetCharABCWidthsFloatW, stub\n");
1519 /*************************************************************************
1520 * GetCharWidthFloat32A [GDI32.156]
1522 BOOL32 WINAPI
GetCharWidthFloat32A(HDC32 hdc
, UINT32 iFirstChar
,
1523 UINT32 iLastChar
, PFLOAT pxBuffer
)
1525 FIXME(gdi
, "GetCharWidthFloatA, stub\n");
1529 /*************************************************************************
1530 * GetCharWidthFloat32W [GDI32.157]
1532 BOOL32 WINAPI
GetCharWidthFloat32W(HDC32 hdc
, UINT32 iFirstChar
,
1533 UINT32 iLastChar
, PFLOAT pxBuffer
)
1535 FIXME(gdi
, "GetCharWidthFloatW, stub\n");