4 * Copyright 1993 Alexandre Julliard
10 #include "wine/winestring.h"
15 #include "debugtools.h"
19 DECLARE_DEBUG_CHANNEL(font
)
20 DECLARE_DEBUG_CHANNEL(gdi
)
22 #define ENUM_UNICODE 0x00000001
26 LPLOGFONT16 lpLogFontParam
;
27 FONTENUMPROCEX16 lpEnumFunc
;
30 LPNEWTEXTMETRICEX16 lpTextMetric
;
31 LPENUMLOGFONTEX16 lpLogFont
;
38 LPLOGFONTW lpLogFontParam
;
39 FONTENUMPROCEXW lpEnumFunc
;
42 LPNEWTEXTMETRICEXW lpTextMetric
;
43 LPENUMLOGFONTEXW lpLogFont
;
48 * For TranslateCharsetInfo
50 #define FS(x) {{0,0,0,0},{0x1<<(x),0}}
51 #define MAXTCIINDEX 32
52 static CHARSETINFO FONT_tci
[MAXTCIINDEX
] = {
54 { ANSI_CHARSET
, 1252, FS(0)},
55 { EASTEUROPE_CHARSET
, 1250, FS(1)},
56 { RUSSIAN_CHARSET
, 1251, FS(2)},
57 { GREEK_CHARSET
, 1253, FS(3)},
58 { TURKISH_CHARSET
, 1254, FS(4)},
59 { HEBREW_CHARSET
, 1255, FS(5)},
60 { ARABIC_CHARSET
, 1256, FS(6)},
61 { BALTIC_CHARSET
, 1257, FS(7)},
62 /* reserved by ANSI */
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 { DEFAULT_CHARSET
, 0, FS(0)},
72 { THAI_CHARSET
, 874, FS(16)},
73 { SHIFTJIS_CHARSET
, 932, FS(17)},
74 { GB2312_CHARSET
, 936, FS(18)},
75 { HANGEUL_CHARSET
, 949, FS(19)},
76 { CHINESEBIG5_CHARSET
, 950, FS(20)},
77 { JOHAB_CHARSET
, 1361, FS(21)},
78 /* reserved for alternate ANSI and OEM */
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 { DEFAULT_CHARSET
, 0, FS(0)},
87 /* reserved for system */
88 { DEFAULT_CHARSET
, 0, FS(0)},
89 { DEFAULT_CHARSET
, 0, FS(0)},
92 /***********************************************************************
93 * LOGFONT conversion functions.
95 static void __logfont32to16( INT16
* plf16
, const INT
* plf32
)
98 for( i
= 0; i
< 5; i
++ ) *plf16
++ = *plf32
++;
99 *((INT
*)plf16
)++ = *plf32
++;
100 *((INT
*)plf16
) = *plf32
;
103 static void __logfont16to32( INT
* plf32
, const INT16
* plf16
)
106 for( i
= 0; i
< 5; i
++ ) *plf32
++ = *plf16
++;
107 *plf32
++ = *((INT
*)plf16
)++;
108 *plf32
= *((INT
*)plf16
);
111 void FONT_LogFont32ATo16( const LOGFONTA
* font32
, LPLOGFONT16 font16
)
113 __logfont32to16( (INT16
*)font16
, (const INT
*)font32
);
114 lstrcpynA( font16
->lfFaceName
, font32
->lfFaceName
, LF_FACESIZE
);
117 void FONT_LogFont32WTo16( const LOGFONTW
* font32
, LPLOGFONT16 font16
)
119 __logfont32to16( (INT16
*)font16
, (const INT
*)font32
);
120 lstrcpynWtoA( font16
->lfFaceName
, font32
->lfFaceName
, LF_FACESIZE
);
123 void FONT_LogFont16To32A( const LPLOGFONT16 font16
, LPLOGFONTA font32
)
125 __logfont16to32( (INT
*)font32
, (const INT16
*)font16
);
126 lstrcpynA( font32
->lfFaceName
, font16
->lfFaceName
, LF_FACESIZE
);
129 void FONT_LogFont16To32W( const LPLOGFONT16 font16
, LPLOGFONTW font32
)
131 __logfont16to32( (INT
*)font32
, (const INT16
*)font16
);
132 lstrcpynAtoW( font32
->lfFaceName
, font16
->lfFaceName
, LF_FACESIZE
);
135 void FONT_EnumLogFontEx16To32A( const LPENUMLOGFONTEX16 font16
, LPENUMLOGFONTEXA font32
)
137 FONT_LogFont16To32A( (LPLOGFONT16
)font16
, (LPLOGFONTA
)font32
);
138 lstrcpynA( font32
->elfFullName
, font16
->elfFullName
, LF_FULLFACESIZE
);
139 lstrcpynA( font32
->elfStyle
, font16
->elfStyle
, LF_FACESIZE
);
140 lstrcpynA( font32
->elfScript
, font16
->elfScript
, LF_FACESIZE
);
143 void FONT_EnumLogFontEx16To32W( const LPENUMLOGFONTEX16 font16
, LPENUMLOGFONTEXW font32
)
145 FONT_LogFont16To32W( (LPLOGFONT16
)font16
, (LPLOGFONTW
)font32
);
146 lstrcpynAtoW( font32
->elfFullName
, font16
->elfFullName
, LF_FULLFACESIZE
);
147 lstrcpynAtoW( font32
->elfStyle
, font16
->elfStyle
, LF_FACESIZE
);
148 lstrcpynAtoW( font32
->elfScript
, font16
->elfScript
, LF_FACESIZE
);
151 /***********************************************************************
152 * TEXTMETRIC conversion functions.
154 void FONT_TextMetric32Ato16(const LPTEXTMETRICA ptm32
, LPTEXTMETRIC16 ptm16
)
156 ptm16
->tmHeight
= ptm32
->tmHeight
;
157 ptm16
->tmAscent
= ptm32
->tmAscent
;
158 ptm16
->tmDescent
= ptm32
->tmDescent
;
159 ptm16
->tmInternalLeading
= ptm32
->tmInternalLeading
;
160 ptm16
->tmExternalLeading
= ptm32
->tmExternalLeading
;
161 ptm16
->tmAveCharWidth
= ptm32
->tmAveCharWidth
;
162 ptm16
->tmMaxCharWidth
= ptm32
->tmMaxCharWidth
;
163 ptm16
->tmWeight
= ptm32
->tmWeight
;
164 ptm16
->tmOverhang
= ptm32
->tmOverhang
;
165 ptm16
->tmDigitizedAspectX
= ptm32
->tmDigitizedAspectX
;
166 ptm16
->tmDigitizedAspectY
= ptm32
->tmDigitizedAspectY
;
167 ptm16
->tmFirstChar
= ptm32
->tmFirstChar
;
168 ptm16
->tmLastChar
= ptm32
->tmLastChar
;
169 ptm16
->tmDefaultChar
= ptm32
->tmDefaultChar
;
170 ptm16
->tmBreakChar
= ptm32
->tmBreakChar
;
171 ptm16
->tmItalic
= ptm32
->tmItalic
;
172 ptm16
->tmUnderlined
= ptm32
->tmUnderlined
;
173 ptm16
->tmStruckOut
= ptm32
->tmStruckOut
;
174 ptm16
->tmPitchAndFamily
= ptm32
->tmPitchAndFamily
;
175 ptm16
->tmCharSet
= ptm32
->tmCharSet
;
178 void FONT_TextMetric32Wto16(const LPTEXTMETRICW ptm32
, LPTEXTMETRIC16 ptm16
)
180 ptm16
->tmHeight
= ptm32
->tmHeight
;
181 ptm16
->tmAscent
= ptm32
->tmAscent
;
182 ptm16
->tmDescent
= ptm32
->tmDescent
;
183 ptm16
->tmInternalLeading
= ptm32
->tmInternalLeading
;
184 ptm16
->tmExternalLeading
= ptm32
->tmExternalLeading
;
185 ptm16
->tmAveCharWidth
= ptm32
->tmAveCharWidth
;
186 ptm16
->tmMaxCharWidth
= ptm32
->tmMaxCharWidth
;
187 ptm16
->tmWeight
= ptm32
->tmWeight
;
188 ptm16
->tmOverhang
= ptm32
->tmOverhang
;
189 ptm16
->tmDigitizedAspectX
= ptm32
->tmDigitizedAspectX
;
190 ptm16
->tmDigitizedAspectY
= ptm32
->tmDigitizedAspectY
;
191 ptm16
->tmFirstChar
= ptm32
->tmFirstChar
;
192 ptm16
->tmLastChar
= ptm32
->tmLastChar
;
193 ptm16
->tmDefaultChar
= ptm32
->tmDefaultChar
;
194 ptm16
->tmBreakChar
= ptm32
->tmBreakChar
;
195 ptm16
->tmItalic
= ptm32
->tmItalic
;
196 ptm16
->tmUnderlined
= ptm32
->tmUnderlined
;
197 ptm16
->tmStruckOut
= ptm32
->tmStruckOut
;
198 ptm16
->tmPitchAndFamily
= ptm32
->tmPitchAndFamily
;
199 ptm16
->tmCharSet
= ptm32
->tmCharSet
;
202 void FONT_TextMetric16to32A(const LPTEXTMETRIC16 ptm16
, LPTEXTMETRICA ptm32
)
204 ptm32
->tmHeight
= ptm16
->tmHeight
;
205 ptm32
->tmAscent
= ptm16
->tmAscent
;
206 ptm32
->tmDescent
= ptm16
->tmDescent
;
207 ptm32
->tmInternalLeading
= ptm16
->tmInternalLeading
;
208 ptm32
->tmExternalLeading
= ptm16
->tmExternalLeading
;
209 ptm32
->tmAveCharWidth
= ptm16
->tmAveCharWidth
;
210 ptm32
->tmMaxCharWidth
= ptm16
->tmMaxCharWidth
;
211 ptm32
->tmWeight
= ptm16
->tmWeight
;
212 ptm32
->tmOverhang
= ptm16
->tmOverhang
;
213 ptm32
->tmDigitizedAspectX
= ptm16
->tmDigitizedAspectX
;
214 ptm32
->tmDigitizedAspectY
= ptm16
->tmDigitizedAspectY
;
215 ptm32
->tmFirstChar
= ptm16
->tmFirstChar
;
216 ptm32
->tmLastChar
= ptm16
->tmLastChar
;
217 ptm32
->tmDefaultChar
= ptm16
->tmDefaultChar
;
218 ptm32
->tmBreakChar
= ptm16
->tmBreakChar
;
219 ptm32
->tmItalic
= ptm16
->tmItalic
;
220 ptm32
->tmUnderlined
= ptm16
->tmUnderlined
;
221 ptm32
->tmStruckOut
= ptm16
->tmStruckOut
;
222 ptm32
->tmPitchAndFamily
= ptm16
->tmPitchAndFamily
;
223 ptm32
->tmCharSet
= ptm16
->tmCharSet
;
226 void FONT_TextMetric16to32W(const LPTEXTMETRIC16 ptm16
, LPTEXTMETRICW ptm32
)
228 ptm32
->tmHeight
= ptm16
->tmHeight
;
229 ptm32
->tmAscent
= ptm16
->tmAscent
;
230 ptm32
->tmDescent
= ptm16
->tmDescent
;
231 ptm32
->tmInternalLeading
= ptm16
->tmInternalLeading
;
232 ptm32
->tmExternalLeading
= ptm16
->tmExternalLeading
;
233 ptm32
->tmAveCharWidth
= ptm16
->tmAveCharWidth
;
234 ptm32
->tmMaxCharWidth
= ptm16
->tmMaxCharWidth
;
235 ptm32
->tmWeight
= ptm16
->tmWeight
;
236 ptm32
->tmOverhang
= ptm16
->tmOverhang
;
237 ptm32
->tmDigitizedAspectX
= ptm16
->tmDigitizedAspectX
;
238 ptm32
->tmDigitizedAspectY
= ptm16
->tmDigitizedAspectY
;
239 ptm32
->tmFirstChar
= ptm16
->tmFirstChar
;
240 ptm32
->tmLastChar
= ptm16
->tmLastChar
;
241 ptm32
->tmDefaultChar
= ptm16
->tmDefaultChar
;
242 ptm32
->tmBreakChar
= ptm16
->tmBreakChar
;
243 ptm32
->tmItalic
= ptm16
->tmItalic
;
244 ptm32
->tmUnderlined
= ptm16
->tmUnderlined
;
245 ptm32
->tmStruckOut
= ptm16
->tmStruckOut
;
246 ptm32
->tmPitchAndFamily
= ptm16
->tmPitchAndFamily
;
247 ptm32
->tmCharSet
= ptm16
->tmCharSet
;
250 void FONT_TextMetric32Ato32W(const LPTEXTMETRICA ptm32A
, LPTEXTMETRICW ptm32W
)
252 ptm32W
->tmHeight
= ptm32A
->tmHeight
;
253 ptm32W
->tmAscent
= ptm32A
->tmAscent
;
254 ptm32W
->tmDescent
= ptm32A
->tmDescent
;
255 ptm32W
->tmInternalLeading
= ptm32A
->tmInternalLeading
;
256 ptm32W
->tmExternalLeading
= ptm32A
->tmExternalLeading
;
257 ptm32W
->tmAveCharWidth
= ptm32A
->tmAveCharWidth
;
258 ptm32W
->tmMaxCharWidth
= ptm32A
->tmMaxCharWidth
;
259 ptm32W
->tmWeight
= ptm32A
->tmWeight
;
260 ptm32W
->tmOverhang
= ptm32A
->tmOverhang
;
261 ptm32W
->tmDigitizedAspectX
= ptm32A
->tmDigitizedAspectX
;
262 ptm32W
->tmDigitizedAspectY
= ptm32A
->tmDigitizedAspectY
;
263 ptm32W
->tmFirstChar
= ptm32A
->tmFirstChar
;
264 ptm32W
->tmLastChar
= ptm32A
->tmLastChar
;
265 ptm32W
->tmDefaultChar
= ptm32A
->tmDefaultChar
;
266 ptm32W
->tmBreakChar
= ptm32A
->tmBreakChar
;
267 ptm32W
->tmItalic
= ptm32A
->tmItalic
;
268 ptm32W
->tmUnderlined
= ptm32A
->tmUnderlined
;
269 ptm32W
->tmStruckOut
= ptm32A
->tmStruckOut
;
270 ptm32W
->tmPitchAndFamily
= ptm32A
->tmPitchAndFamily
;
271 ptm32W
->tmCharSet
= ptm32A
->tmCharSet
;
274 /***********************************************************************
275 * CreateFontIndirect16 (GDI.57)
277 HFONT16 WINAPI
CreateFontIndirect16( const LOGFONT16
*font
)
283 hFont
= GDI_AllocObject( sizeof(FONTOBJ
), FONT_MAGIC
);
287 fontPtr
= (FONTOBJ
*) GDI_HEAP_LOCK( hFont
);
288 memcpy( &fontPtr
->logfont
, font
, sizeof(LOGFONT16
) );
290 TRACE_(font
)("(%i %i %i %i) '%s' %s %s => %04x\n",
291 font
->lfHeight
, font
->lfWidth
,
292 font
->lfEscapement
, font
->lfOrientation
,
293 font
->lfFaceName
? font
->lfFaceName
: "NULL",
294 font
->lfWeight
> 400 ? "Bold" : "",
295 font
->lfItalic
? "Italic" : "",
298 if (font
->lfEscapement
!= font
->lfOrientation
) {
299 /* this should really depend on whether GM_ADVANCED is set */
300 fontPtr
->logfont
.lfOrientation
= fontPtr
->logfont
.lfEscapement
;
302 "orientation angle %f set to escapement angle %f for new font %04x\n",
303 font
->lfOrientation
/10., font
->lfEscapement
/10., hFont
);
305 GDI_HEAP_UNLOCK( hFont
);
308 else WARN_(font
)("(NULL) => NULL\n");
313 /***********************************************************************
314 * CreateFontIndirectA (GDI32.44)
316 HFONT WINAPI
CreateFontIndirectA( const LOGFONTA
*font
)
320 FONT_LogFont32ATo16( font
, &font16
);
321 return CreateFontIndirect16( &font16
);
324 /***********************************************************************
325 * CreateFontIndirectW (GDI32.45)
327 HFONT WINAPI
CreateFontIndirectW( const LOGFONTW
*font
)
331 FONT_LogFont32WTo16( font
, &font16
);
332 return CreateFontIndirect16( &font16
);
335 /***********************************************************************
336 * CreateFont16 (GDI.56)
338 HFONT16 WINAPI
CreateFont16(INT16 height
, INT16 width
, INT16 esc
, INT16 orient
,
339 INT16 weight
, BYTE italic
, BYTE underline
,
340 BYTE strikeout
, BYTE charset
, BYTE outpres
,
341 BYTE clippres
, BYTE quality
, BYTE pitch
,
346 TRACE_(font
)("('%s',%d,%d)\n",
347 (name
? name
: "(null)") , height
, width
);
349 logfont
.lfHeight
= height
;
350 logfont
.lfWidth
= width
;
351 logfont
.lfEscapement
= esc
;
352 logfont
.lfOrientation
= orient
;
353 logfont
.lfWeight
= weight
;
354 logfont
.lfItalic
= italic
;
355 logfont
.lfUnderline
= underline
;
356 logfont
.lfStrikeOut
= strikeout
;
357 logfont
.lfCharSet
= charset
;
358 logfont
.lfOutPrecision
= outpres
;
359 logfont
.lfClipPrecision
= clippres
;
360 logfont
.lfQuality
= quality
;
361 logfont
.lfPitchAndFamily
= pitch
;
364 lstrcpynA(logfont
.lfFaceName
,name
,sizeof(logfont
.lfFaceName
));
366 logfont
.lfFaceName
[0] = '\0';
368 return CreateFontIndirect16( &logfont
);
371 /*************************************************************************
372 * CreateFontA (GDI32.43)
374 HFONT WINAPI
CreateFontA( INT height
, INT width
, INT esc
,
375 INT orient
, INT weight
, DWORD italic
,
376 DWORD underline
, DWORD strikeout
, DWORD charset
,
377 DWORD outpres
, DWORD clippres
, DWORD quality
,
378 DWORD pitch
, LPCSTR name
)
380 return (HFONT
)CreateFont16( height
, width
, esc
, orient
, weight
, italic
,
381 underline
, strikeout
, charset
, outpres
,
382 clippres
, quality
, pitch
, name
);
385 /*************************************************************************
386 * CreateFontW (GDI32.46)
388 HFONT WINAPI
CreateFontW( INT height
, INT width
, INT esc
,
389 INT orient
, INT weight
, DWORD italic
,
390 DWORD underline
, DWORD strikeout
, DWORD charset
,
391 DWORD outpres
, DWORD clippres
, DWORD quality
,
392 DWORD pitch
, LPCWSTR name
)
394 LPSTR namea
= HEAP_strdupWtoA( GetProcessHeap(), 0, name
);
395 HFONT ret
= (HFONT
)CreateFont16( height
, width
, esc
, orient
, weight
,
396 italic
, underline
, strikeout
, charset
,
397 outpres
, clippres
, quality
, pitch
,
399 if (namea
) HeapFree( GetProcessHeap(), 0, namea
);
404 /***********************************************************************
407 INT16
FONT_GetObject16( FONTOBJ
* font
, INT16 count
, LPSTR buffer
)
409 if (count
> sizeof(LOGFONT16
)) count
= sizeof(LOGFONT16
);
410 memcpy( buffer
, &font
->logfont
, count
);
414 /***********************************************************************
417 INT
FONT_GetObjectA( FONTOBJ
*font
, INT count
, LPSTR buffer
)
421 FONT_LogFont16To32A( &font
->logfont
, &fnt32
);
423 if (count
> sizeof(fnt32
)) count
= sizeof(fnt32
);
424 memcpy( buffer
, &fnt32
, count
);
427 /***********************************************************************
430 INT
FONT_GetObjectW( FONTOBJ
*font
, INT count
, LPSTR buffer
)
434 FONT_LogFont16To32W( &font
->logfont
, &fnt32
);
436 if (count
> sizeof(fnt32
)) count
= sizeof(fnt32
);
437 memcpy( buffer
, &fnt32
, count
);
442 /***********************************************************************
443 * FONT_EnumInstance16
445 * Called by the device driver layer to pass font info
446 * down to the application.
448 static INT
FONT_EnumInstance16( LPENUMLOGFONTEX16 plf
,
449 LPNEWTEXTMETRIC16 ptm
, UINT16 fType
, LPARAM lp
)
451 #define pfe ((fontEnum16*)lp)
452 if( pfe
->lpLogFontParam
->lfCharSet
== DEFAULT_CHARSET
||
453 pfe
->lpLogFontParam
->lfCharSet
== plf
->elfLogFont
.lfCharSet
)
455 memcpy( pfe
->lpLogFont
, plf
, sizeof(ENUMLOGFONT16
) );
456 memcpy( pfe
->lpTextMetric
, ptm
, sizeof(NEWTEXTMETRIC16
) );
458 return pfe
->lpEnumFunc( pfe
->segLogFont
, pfe
->segTextMetric
, fType
, (LPARAM
)(pfe
->lpData
) );
464 /***********************************************************************
467 static INT
FONT_EnumInstance( LPENUMLOGFONTEX16 plf
,
468 LPNEWTEXTMETRIC16 ptm
, UINT16 fType
, LPARAM lp
)
470 /* lfCharSet is at the same offset in both LOGFONT32A and LOGFONT32W */
472 #define pfe ((fontEnum32*)lp)
473 if( pfe
->lpLogFontParam
->lfCharSet
== DEFAULT_CHARSET
||
474 pfe
->lpLogFontParam
->lfCharSet
== plf
->elfLogFont
.lfCharSet
)
476 /* convert font metrics */
478 if( pfe
->dwFlags
& ENUM_UNICODE
)
480 FONT_EnumLogFontEx16To32W( plf
, pfe
->lpLogFont
);
481 FONT_TextMetric16to32W( (LPTEXTMETRIC16
)ptm
, (LPTEXTMETRICW
)(pfe
->lpTextMetric
) );
483 return pfe
->lpEnumFunc( pfe
->lpLogFont
, pfe
->lpTextMetric
, fType
, pfe
->lpData
);
487 ENUMLOGFONTEXA logfont
;
489 FONT_EnumLogFontEx16To32A( plf
, &logfont
);
490 FONT_TextMetric16to32A( (LPTEXTMETRIC16
)ptm
, (LPTEXTMETRICA
)pfe
->lpTextMetric
);
492 return pfe
->lpEnumFunc( (LPENUMLOGFONTEXW
)&logfont
,
493 pfe
->lpTextMetric
, fType
, pfe
->lpData
);
500 /***********************************************************************
501 * EnumFontFamiliesEx16 (GDI.613)
503 INT16 WINAPI
EnumFontFamiliesEx16( HDC16 hDC
, LPLOGFONT16 plf
,
504 FONTENUMPROCEX16 efproc
, LPARAM lParam
,
508 DC
* dc
= (DC
*) GDI_GetObjPtr( hDC
, DC_MAGIC
);
510 if( dc
&& dc
->funcs
->pEnumDeviceFonts
)
512 LPNEWTEXTMETRICEX16 lptm16
= SEGPTR_ALLOC( sizeof(NEWTEXTMETRICEX16
) );
515 LPENUMLOGFONTEX16 lplf16
= SEGPTR_ALLOC( sizeof(ENUMLOGFONTEX16
) );
520 fe16
.lpLogFontParam
= plf
;
521 fe16
.lpEnumFunc
= efproc
;
522 fe16
.lpData
= lParam
;
524 fe16
.lpTextMetric
= lptm16
;
525 fe16
.lpLogFont
= lplf16
;
526 fe16
.segTextMetric
= SEGPTR_GET(lptm16
);
527 fe16
.segLogFont
= SEGPTR_GET(lplf16
);
529 retVal
= dc
->funcs
->pEnumDeviceFonts( dc
, plf
, FONT_EnumInstance16
, (LPARAM
)&fe16
);
539 /***********************************************************************
540 * FONT_EnumFontFamiliesEx
542 static INT
FONT_EnumFontFamiliesEx( HDC hDC
, LPLOGFONTW plf
, FONTENUMPROCEXW efproc
,
543 LPARAM lParam
, DWORD dwUnicode
)
545 DC
* dc
= (DC
*) GDI_GetObjPtr( hDC
, DC_MAGIC
);
547 if( dc
&& dc
->funcs
->pEnumDeviceFonts
)
550 NEWTEXTMETRICEXW tm32w
;
551 ENUMLOGFONTEXW lf32w
;
554 fe32
.lpLogFontParam
= plf
;
555 fe32
.lpEnumFunc
= efproc
;
556 fe32
.lpData
= lParam
;
558 fe32
.lpTextMetric
= &tm32w
;
559 fe32
.lpLogFont
= &lf32w
;
560 fe32
.dwFlags
= dwUnicode
;
562 /* the only difference between LOGFONT32A and LOGFONT32W is in the lfFaceName */
564 if( plf
->lfFaceName
[0] )
567 lstrcpynWtoA( lf16
.lfFaceName
, plf
->lfFaceName
, LF_FACESIZE
);
569 lstrcpynA( lf16
.lfFaceName
, (LPCSTR
)plf
->lfFaceName
, LF_FACESIZE
);
571 else lf16
.lfFaceName
[0] = '\0';
572 lf16
.lfCharSet
= plf
->lfCharSet
;
574 return dc
->funcs
->pEnumDeviceFonts( dc
, &lf16
, FONT_EnumInstance
, (LPARAM
)&fe32
);
579 /***********************************************************************
580 * EnumFontFamiliesExW (GDI32.82)
582 INT WINAPI
EnumFontFamiliesExW( HDC hDC
, LPLOGFONTW plf
,
583 FONTENUMPROCEXW efproc
,
584 LPARAM lParam
, DWORD dwFlags
)
586 return FONT_EnumFontFamiliesEx( hDC
, plf
, efproc
, lParam
, ENUM_UNICODE
);
589 /***********************************************************************
590 * EnumFontFamiliesExA (GDI32.81)
592 INT WINAPI
EnumFontFamiliesExA( HDC hDC
, LPLOGFONTA plf
,
593 FONTENUMPROCEXA efproc
,
594 LPARAM lParam
, DWORD dwFlags
)
596 return FONT_EnumFontFamiliesEx( hDC
, (LPLOGFONTW
)plf
,
597 (FONTENUMPROCEXW
)efproc
, lParam
, 0);
600 /***********************************************************************
601 * EnumFontFamilies16 (GDI.330)
603 INT16 WINAPI
EnumFontFamilies16( HDC16 hDC
, LPCSTR lpFamily
,
604 FONTENUMPROC16 efproc
, LPARAM lpData
)
608 lf
.lfCharSet
= DEFAULT_CHARSET
;
609 if( lpFamily
) lstrcpynA( lf
.lfFaceName
, lpFamily
, LF_FACESIZE
);
610 else lf
.lfFaceName
[0] = '\0';
612 return EnumFontFamiliesEx16( hDC
, &lf
, (FONTENUMPROCEX16
)efproc
, lpData
, 0 );
615 /***********************************************************************
616 * EnumFontFamiliesA (GDI32.80)
618 INT WINAPI
EnumFontFamiliesA( HDC hDC
, LPCSTR lpFamily
,
619 FONTENUMPROCA efproc
, LPARAM lpData
)
623 lf
.lfCharSet
= DEFAULT_CHARSET
;
624 if( lpFamily
) lstrcpynA( lf
.lfFaceName
, lpFamily
, LF_FACESIZE
);
625 else lf
.lfFaceName
[0] = lf
.lfFaceName
[1] = '\0';
627 return FONT_EnumFontFamiliesEx( hDC
, (LPLOGFONTW
)&lf
,
628 (FONTENUMPROCEXW
)efproc
, lpData
, 0 );
631 /***********************************************************************
632 * EnumFontFamiliesW (GDI32.83)
634 INT WINAPI
EnumFontFamiliesW( HDC hDC
, LPCWSTR lpFamily
,
635 FONTENUMPROCW efproc
, LPARAM lpData
)
639 lf
.lfCharSet
= DEFAULT_CHARSET
;
640 if( lpFamily
) lstrcpynW( lf
.lfFaceName
, lpFamily
, LF_FACESIZE
);
641 else lf
.lfFaceName
[0] = 0;
643 return FONT_EnumFontFamiliesEx( hDC
, &lf
, (FONTENUMPROCEXW
)efproc
,
644 lpData
, ENUM_UNICODE
);
647 /***********************************************************************
648 * EnumFonts16 (GDI.70)
650 INT16 WINAPI
EnumFonts16( HDC16 hDC
, LPCSTR lpName
, FONTENUMPROC16 efproc
,
653 return EnumFontFamilies16( hDC
, lpName
, (FONTENUMPROCEX16
)efproc
, lpData
);
656 /***********************************************************************
657 * EnumFontsA (GDI32.84)
659 INT WINAPI
EnumFontsA( HDC hDC
, LPCSTR lpName
, FONTENUMPROCA efproc
,
662 return EnumFontFamiliesA( hDC
, lpName
, efproc
, lpData
);
665 /***********************************************************************
666 * EnumFontsW (GDI32.85)
668 INT WINAPI
EnumFontsW( HDC hDC
, LPCWSTR lpName
, FONTENUMPROCW efproc
,
671 return EnumFontFamiliesW( hDC
, lpName
, efproc
, lpData
);
675 /***********************************************************************
676 * GetTextCharacterExtra16 (GDI.89)
678 INT16 WINAPI
GetTextCharacterExtra16( HDC16 hdc
)
680 DC
* dc
= (DC
*) GDI_GetObjPtr( hdc
, DC_MAGIC
);
682 return abs( (dc
->w
.charExtra
* dc
->wndExtX
+ dc
->vportExtX
/ 2)
687 /***********************************************************************
688 * GetTextCharacterExtra (GDI32.225)
690 INT WINAPI
GetTextCharacterExtra( HDC hdc
)
692 DC
* dc
= (DC
*) GDI_GetObjPtr( hdc
, DC_MAGIC
);
694 return abs( (dc
->w
.charExtra
* dc
->wndExtX
+ dc
->vportExtX
/ 2)
699 /***********************************************************************
700 * SetTextCharacterExtra16 (GDI.8)
702 INT16 WINAPI
SetTextCharacterExtra16( HDC16 hdc
, INT16 extra
)
704 return (INT16
)SetTextCharacterExtra( hdc
, extra
);
708 /***********************************************************************
709 * SetTextCharacterExtra (GDI32.337)
711 INT WINAPI
SetTextCharacterExtra( HDC hdc
, INT extra
)
714 DC
* dc
= DC_GetDCPtr( hdc
);
716 if (dc
->funcs
->pSetTextCharacterExtra
)
717 return dc
->funcs
->pSetTextCharacterExtra( dc
, extra
);
718 extra
= (extra
* dc
->vportExtX
+ dc
->wndExtX
/ 2) / dc
->wndExtX
;
719 prev
= dc
->w
.charExtra
;
720 dc
->w
.charExtra
= abs(extra
);
721 return (prev
* dc
->wndExtX
+ dc
->vportExtX
/ 2) / dc
->vportExtX
;
725 /***********************************************************************
726 * SetTextJustification16 (GDI.10)
728 INT16 WINAPI
SetTextJustification16( HDC16 hdc
, INT16 extra
, INT16 breaks
)
730 return SetTextJustification( hdc
, extra
, breaks
);
734 /***********************************************************************
735 * SetTextJustification (GDI32.339)
737 BOOL WINAPI
SetTextJustification( HDC hdc
, INT extra
, INT breaks
)
739 DC
* dc
= DC_GetDCPtr( hdc
);
741 if (dc
->funcs
->pSetTextJustification
)
742 return dc
->funcs
->pSetTextJustification( dc
, extra
, breaks
);
744 extra
= abs((extra
* dc
->vportExtX
+ dc
->wndExtX
/ 2) / dc
->wndExtX
);
745 if (!extra
) breaks
= 0;
746 dc
->w
.breakTotalExtra
= extra
;
747 dc
->w
.breakCount
= breaks
;
750 dc
->w
.breakExtra
= extra
/ breaks
;
751 dc
->w
.breakRem
= extra
- (dc
->w
.breakCount
* dc
->w
.breakExtra
);
755 dc
->w
.breakExtra
= 0;
762 /***********************************************************************
763 * GetTextFace16 (GDI.92)
765 INT16 WINAPI
GetTextFace16( HDC16 hdc
, INT16 count
, LPSTR name
)
767 return GetTextFaceA(hdc
,count
,name
);
770 /***********************************************************************
771 * GetTextFaceA (GDI32.234)
773 INT WINAPI
GetTextFaceA( HDC hdc
, INT count
, LPSTR name
)
777 DC
* dc
= (DC
*) GDI_GetObjPtr( hdc
, DC_MAGIC
);
779 if (!(font
= (FONTOBJ
*) GDI_GetObjPtr( dc
->w
.hFont
, FONT_MAGIC
)))
782 lstrcpynA( name
, font
->logfont
.lfFaceName
, count
);
783 GDI_HEAP_UNLOCK( dc
->w
.hFont
);
787 return strlen(font
->logfont
.lfFaceName
) + 1;
790 /***********************************************************************
791 * GetTextFaceW (GDI32.235)
793 INT WINAPI
GetTextFaceW( HDC hdc
, INT count
, LPWSTR name
)
795 LPSTR nameA
= HeapAlloc( GetProcessHeap(), 0, count
);
796 INT res
= GetTextFaceA(hdc
,count
,nameA
);
797 lstrcpyAtoW( name
, nameA
);
798 HeapFree( GetProcessHeap(), 0, nameA
);
803 /***********************************************************************
804 * GetTextExtent16 (GDI.91)
806 DWORD WINAPI
GetTextExtent16( HDC16 hdc
, LPCSTR str
, INT16 count
)
809 if (!GetTextExtentPoint16( hdc
, str
, count
, &size
)) return 0;
810 return MAKELONG( size
.cx
, size
.cy
);
814 /***********************************************************************
815 * GetTextExtentPoint16 (GDI.471)
817 * FIXME: Should this have a bug for compatibility?
818 * Original Windows versions of GetTextExtentPoint{A,W} have documented
819 * bugs (-> MSDN KB q147647.txt).
821 BOOL16 WINAPI
GetTextExtentPoint16( HDC16 hdc
, LPCSTR str
, INT16 count
,
825 BOOL ret
= GetTextExtentPoint32A( hdc
, str
, count
, &size32
);
826 CONV_SIZE32TO16( &size32
, size
);
831 /***********************************************************************
832 * GetTextExtentPoint32A (GDI32.230)
834 BOOL WINAPI
GetTextExtentPoint32A( HDC hdc
, LPCSTR str
, INT count
,
837 DC
* dc
= (DC
*) GDI_GetObjPtr( hdc
, DC_MAGIC
);
840 if (!(dc
= (DC
*)GDI_GetObjPtr( hdc
, METAFILE_DC_MAGIC
)))
844 if (!dc
->funcs
->pGetTextExtentPoint
||
845 !dc
->funcs
->pGetTextExtentPoint( dc
, str
, count
, size
))
848 TRACE_(font
)("(%08x %s %d %p): returning %d,%d\n",
849 hdc
, debugstr_an (str
, count
), count
,
850 size
, size
->cx
, size
->cy
);
855 /***********************************************************************
856 * GetTextExtentPoint32W [GDI32.231] Computes width/height for a string
858 * Computes width and height of the specified string.
864 BOOL WINAPI
GetTextExtentPoint32W(
865 HDC hdc
, /* [in] Handle of device context */
866 LPCWSTR str
, /* [in] Address of text string */
867 INT count
, /* [in] Number of characters in string */
868 LPSIZE size
) /* [out] Address of structure for string size */
873 /* str may not be 0 terminated so we can't use HEAP_strdupWtoA.
874 * We allocate one more than we need so that lstrcpynWtoA can write a
875 * trailing 0 if it wants.
878 if(!count
) count
= lstrlenW(str
);
879 p
= HeapAlloc( GetProcessHeap(), 0, count
+1 );
880 lstrcpynWtoA(p
, str
, count
+1);
881 ret
= GetTextExtentPoint32A( hdc
, p
, count
, size
);
882 HeapFree( GetProcessHeap(), 0, p
);
887 /***********************************************************************
888 * GetTextExtentPointA (GDI32.232)
890 BOOL WINAPI
GetTextExtentPointA( HDC hdc
, LPCSTR str
, INT count
,
893 TRACE_(font
)("not bug compatible.\n");
894 return GetTextExtentPoint32A( hdc
, str
, count
, size
);
897 /***********************************************************************
898 * GetTextExtentPointW (GDI32.233)
900 BOOL WINAPI
GetTextExtentPointW( HDC hdc
, LPCWSTR str
, INT count
,
903 TRACE_(font
)("not bug compatible.\n");
904 return GetTextExtentPoint32W( hdc
, str
, count
, size
);
908 /***********************************************************************
909 * GetTextExtentExPointA (GDI32.228)
911 BOOL WINAPI
GetTextExtentExPointA( HDC hdc
, LPCSTR str
, INT count
,
912 INT maxExt
, LPINT lpnFit
,
913 LPINT alpDx
, LPSIZE size
)
915 int index
, nFit
, extent
;
917 DC
* dc
= (DC
*) GDI_GetObjPtr( hdc
, DC_MAGIC
);
921 if (!(dc
= (DC
*)GDI_GetObjPtr( hdc
, METAFILE_DC_MAGIC
)))
924 if (!dc
->funcs
->pGetTextExtentPoint
) return FALSE
;
926 size
->cx
= size
->cy
= nFit
= extent
= 0;
927 for(index
= 0; index
< count
; index
++)
929 if(!dc
->funcs
->pGetTextExtentPoint( dc
, str
, 1, &tSize
)) return FALSE
;
930 if( extent
+tSize
.cx
< maxExt
)
935 if( alpDx
) alpDx
[index
] = extent
;
936 if( tSize
.cy
> size
->cy
) size
->cy
= tSize
.cy
;
943 TRACE_(font
)("(%08x '%.*s' %d) returning %d %d %d\n",
944 hdc
,count
,str
,maxExt
,nFit
, size
->cx
,size
->cy
);
949 /***********************************************************************
950 * GetTextExtentExPointW (GDI32.229)
953 BOOL WINAPI
GetTextExtentExPointW( HDC hdc
, LPCWSTR str
, INT count
,
954 INT maxExt
, LPINT lpnFit
,
955 LPINT alpDx
, LPSIZE size
)
960 /* Docs say str should be 0 terminated here, but we'll use count just in case
963 if(!count
) count
= lstrlenW(str
);
964 p
= HeapAlloc( GetProcessHeap(), 0, count
+1 );
965 lstrcpynWtoA(p
, str
, count
+1);
966 ret
= GetTextExtentExPointA( hdc
, p
, count
, maxExt
,
967 lpnFit
, alpDx
, size
);
968 HeapFree( GetProcessHeap(), 0, p
);
972 /***********************************************************************
973 * GetTextMetrics16 (GDI.93)
975 BOOL16 WINAPI
GetTextMetrics16( HDC16 hdc
, TEXTMETRIC16
*metrics
)
979 if (!GetTextMetricsA( (HDC
)hdc
, &tm32
)) return FALSE
;
980 FONT_TextMetric32Ato16( &tm32
, metrics
);
985 /***********************************************************************
986 * GetTextMetricsA (GDI32.236)
988 BOOL WINAPI
GetTextMetricsA( HDC hdc
, TEXTMETRICA
*metrics
)
990 DC
* dc
= (DC
*) GDI_GetObjPtr( hdc
, DC_MAGIC
);
993 if (!(dc
= (DC
*)GDI_GetObjPtr( hdc
, METAFILE_DC_MAGIC
)))
997 if (!dc
->funcs
->pGetTextMetrics
||
998 !dc
->funcs
->pGetTextMetrics( dc
, metrics
))
1001 /* device layer returns values in device units
1002 * therefore we have to convert them to logical */
1004 #define WDPTOLP(x) ((x<0)? \
1005 (-abs((x)*dc->wndExtX/dc->vportExtX)): \
1006 (abs((x)*dc->wndExtX/dc->vportExtX)))
1007 #define HDPTOLP(y) ((y<0)? \
1008 (-abs((y)*dc->wndExtY/dc->vportExtY)): \
1009 (abs((y)*dc->wndExtY/dc->vportExtY)))
1011 metrics
->tmHeight
= HDPTOLP(metrics
->tmHeight
);
1012 metrics
->tmAscent
= HDPTOLP(metrics
->tmAscent
);
1013 metrics
->tmDescent
= HDPTOLP(metrics
->tmDescent
);
1014 metrics
->tmInternalLeading
= HDPTOLP(metrics
->tmInternalLeading
);
1015 metrics
->tmExternalLeading
= HDPTOLP(metrics
->tmExternalLeading
);
1016 metrics
->tmAveCharWidth
= WDPTOLP(metrics
->tmAveCharWidth
);
1017 metrics
->tmMaxCharWidth
= WDPTOLP(metrics
->tmMaxCharWidth
);
1018 metrics
->tmOverhang
= WDPTOLP(metrics
->tmOverhang
);
1020 TRACE_(font
)("text metrics:\n"
1021 " Weight = %03li\t FirstChar = %03i\t AveCharWidth = %li\n"
1022 " Italic = % 3i\t LastChar = %03i\t\t MaxCharWidth = %li\n"
1023 " UnderLined = %01i\t DefaultChar = %03i\t Overhang = %li\n"
1024 " StruckOut = %01i\t BreakChar = %03i\t CharSet = %i\n"
1025 " PitchAndFamily = %02x\n"
1026 " --------------------\n"
1027 " InternalLeading = %li\n"
1031 metrics
->tmWeight
, metrics
->tmFirstChar
, metrics
->tmAveCharWidth
,
1032 metrics
->tmItalic
, metrics
->tmLastChar
, metrics
->tmMaxCharWidth
,
1033 metrics
->tmUnderlined
, metrics
->tmDefaultChar
, metrics
->tmOverhang
,
1034 metrics
->tmStruckOut
, metrics
->tmBreakChar
, metrics
->tmCharSet
,
1035 metrics
->tmPitchAndFamily
,
1036 metrics
->tmInternalLeading
,
1039 metrics
->tmHeight
);
1044 /***********************************************************************
1045 * GetTextMetricsW (GDI32.237)
1047 BOOL WINAPI
GetTextMetricsW( HDC hdc
, TEXTMETRICW
*metrics
)
1050 if (!GetTextMetricsA( (HDC16
)hdc
, &tm
)) return FALSE
;
1051 FONT_TextMetric32Ato32W( &tm
, metrics
);
1056 /***********************************************************************
1057 * GetOutlineTextMetrics16 [GDI.308] Gets metrics for TrueType fonts.
1060 * lpOTM should be LPOUTLINETEXTMETRIC
1063 * Success: Non-zero or size of required buffer
1066 UINT16 WINAPI
GetOutlineTextMetrics16(
1067 HDC16 hdc
, /* [in] Handle of device context */
1068 UINT16 cbData
, /* [in] Size of metric data array */
1069 LPOUTLINETEXTMETRIC16 lpOTM
) /* [out] Address of metric data array */
1071 FIXME_(font
)("(%04x,%04x,%p): stub\n", hdc
,cbData
,lpOTM
);
1076 /***********************************************************************
1077 * GetOutlineTextMetricsA [GDI.207] Gets metrics for TrueType fonts.
1081 * Success: Non-zero or size of required buffer
1084 UINT WINAPI
GetOutlineTextMetricsA(
1085 HDC hdc
, /* [in] Handle of device context */
1086 UINT cbData
, /* [in] Size of metric data array */
1087 LPOUTLINETEXTMETRICA lpOTM
) /* [out] Address of metric data array */
1092 LPTEXTMETRICA lptxtMetr
;
1099 lpOTM
= (LPOUTLINETEXTMETRICA
)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY
,sizeof(OUTLINETEXTMETRICA
));
1100 rtn
= sizeof(OUTLINETEXTMETRICA
);
1104 cbData
= sizeof(*lpOTM
);
1108 lpOTM
->otmSize
= cbData
;
1110 lptxtMetr
=HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY
,sizeof(TEXTMETRICA
));
1112 if (!GetTextMetricsA(hdc
,lptxtMetr
))
1117 memcpy(&(lpOTM
->otmTextMetrics
),lptxtMetr
,sizeof(TEXTMETRICA
));
1120 HeapFree(GetProcessHeap(),HEAP_ZERO_MEMORY
,lptxtMetr
);
1122 lpOTM
->otmFilter
= 0;
1124 lpOTM
->otmPanoseNumber
.bFamilyType
= 0;
1125 lpOTM
->otmPanoseNumber
.bSerifStyle
= 0;
1126 lpOTM
->otmPanoseNumber
.bWeight
= 0;
1127 lpOTM
->otmPanoseNumber
.bProportion
= 0;
1128 lpOTM
->otmPanoseNumber
.bContrast
= 0;
1129 lpOTM
->otmPanoseNumber
.bStrokeVariation
= 0;
1130 lpOTM
->otmPanoseNumber
.bArmStyle
= 0;
1131 lpOTM
->otmPanoseNumber
.bLetterform
= 0;
1132 lpOTM
->otmPanoseNumber
.bMidline
= 0;
1133 lpOTM
->otmPanoseNumber
.bXHeight
= 0;
1135 lpOTM
->otmfsSelection
= 0;
1136 lpOTM
->otmfsType
= 0;
1139 Further fill of the structure not implemented,
1140 Needs real values for the structure members
1146 /***********************************************************************
1147 * GetOutlineTextMetricsW [GDI32.208]
1149 UINT WINAPI
GetOutlineTextMetricsW(
1150 HDC hdc
, /* [in] Handle of device context */
1151 UINT cbData
, /* [in] Size of metric data array */
1152 LPOUTLINETEXTMETRICW lpOTM
) /* [out] Address of metric data array */
1154 FIXME_(font
)("(%d,%d,%p): stub\n", hdc
, cbData
, lpOTM
);
1158 /***********************************************************************
1159 * GetCharWidth16 (GDI.350)
1161 BOOL16 WINAPI
GetCharWidth16( HDC16 hdc
, UINT16 firstChar
, UINT16 lastChar
,
1164 BOOL retVal
= FALSE
;
1166 if( firstChar
!= lastChar
)
1168 LPINT buf32
= (LPINT
)HeapAlloc(GetProcessHeap(), 0,
1169 sizeof(INT
)*(1 + (lastChar
- firstChar
)));
1172 LPINT obuf32
= buf32
;
1175 retVal
= GetCharWidth32A(hdc
, firstChar
, lastChar
, buf32
);
1178 for (i
= firstChar
; i
<= lastChar
; i
++)
1179 *buffer
++ = *buf32
++;
1181 HeapFree(GetProcessHeap(), 0, obuf32
);
1184 else /* happens quite often to warrant a special treatment */
1187 retVal
= GetCharWidth32A(hdc
, firstChar
, lastChar
, &chWidth
);
1194 /***********************************************************************
1195 * GetCharWidth32A (GDI32.155)
1197 BOOL WINAPI
GetCharWidth32A( HDC hdc
, UINT firstChar
, UINT lastChar
,
1201 DC
* dc
= (DC
*) GDI_GetObjPtr( hdc
, DC_MAGIC
);
1204 if (!(dc
= (DC
*)GDI_GetObjPtr( hdc
, METAFILE_DC_MAGIC
)))
1208 if (!dc
->funcs
->pGetCharWidth
||
1209 !dc
->funcs
->pGetCharWidth( dc
, firstChar
, lastChar
, buffer
))
1212 /* convert device units to logical */
1214 extra
= dc
->vportExtX
>> 1;
1215 for( i
= firstChar
; i
<= lastChar
; i
++, buffer
++ )
1216 *buffer
= (*buffer
* dc
->wndExtX
+ extra
) / dc
->vportExtX
;
1222 /***********************************************************************
1223 * GetCharWidth32W (GDI32.158)
1225 BOOL WINAPI
GetCharWidth32W( HDC hdc
, UINT firstChar
, UINT lastChar
,
1228 return GetCharWidth32A( hdc
, firstChar
, lastChar
, buffer
);
1233 /* FIXME: all following APIs *******************************************
1236 * SetMapperFlags16 (GDI.349)
1238 DWORD WINAPI
SetMapperFlags16( HDC16 hDC
, DWORD dwFlag
)
1240 return SetMapperFlags( hDC
, dwFlag
);
1244 /***********************************************************************
1245 * SetMapperFlags (GDI32.322)
1247 DWORD WINAPI
SetMapperFlags( HDC hDC
, DWORD dwFlag
)
1249 DC
*dc
= DC_GetDCPtr( hDC
);
1252 if(dc
->funcs
->pSetMapperFlags
)
1253 ret
= dc
->funcs
->pSetMapperFlags( dc
, dwFlag
);
1255 FIXME_(font
)("(0x%04x, 0x%08lx): stub - harmless\n", hDC
, dwFlag
);
1256 GDI_HEAP_UNLOCK( hDC
);
1260 /***********************************************************************
1261 * GetAspectRatioFilterEx16 (GDI.486)
1263 BOOL16 WINAPI
GetAspectRatioFilterEx16( HDC16 hdc
, LPSIZE16 pAspectRatio
)
1265 FIXME_(font
)("(%04x, %p): -- Empty Stub !\n",
1270 /***********************************************************************
1271 * GetAspectRatioFilterEx (GDI32.142)
1273 BOOL WINAPI
GetAspectRatioFilterEx( HDC hdc
, LPSIZE pAspectRatio
)
1275 FIXME_(font
)("(%04x, %p): -- Empty Stub !\n",
1280 /***********************************************************************
1281 * GetCharABCWidths16 (GDI.307)
1283 BOOL16 WINAPI
GetCharABCWidths16( HDC16 hdc
, UINT16 firstChar
, UINT16 lastChar
,
1287 if (!GetCharABCWidthsA( hdc
, firstChar
, lastChar
, &abc32
)) return FALSE
;
1288 abc
->abcA
= abc32
.abcA
;
1289 abc
->abcB
= abc32
.abcB
;
1290 abc
->abcC
= abc32
.abcC
;
1295 /***********************************************************************
1296 * GetCharABCWidthsA (GDI32.149)
1298 BOOL WINAPI
GetCharABCWidthsA(HDC hdc
, UINT firstChar
, UINT lastChar
,
1301 return GetCharABCWidthsW( hdc
, firstChar
, lastChar
, abc
);
1305 /******************************************************************************
1306 * GetCharABCWidthsW [GDI32.152] Retrieves widths of characters in range
1309 * hdc [I] Handle of device context
1310 * firstChar [I] First character in range to query
1311 * lastChar [I] Last character in range to query
1312 * abc [O] Address of character-width structure
1315 * Only works with TrueType fonts
1321 BOOL WINAPI
GetCharABCWidthsW( HDC hdc
, UINT firstChar
, UINT lastChar
,
1324 /* No TrueType fonts in Wine so far */
1325 FIXME_(font
)("(%04x,%04x,%04x,%p): stub\n", hdc
, firstChar
, lastChar
, abc
);
1330 /***********************************************************************
1331 * GetGlyphOutline16 (GDI.309)
1333 DWORD WINAPI
GetGlyphOutline16( HDC16 hdc
, UINT16 uChar
, UINT16 fuFormat
,
1334 LPGLYPHMETRICS16 lpgm
, DWORD cbBuffer
,
1335 LPVOID lpBuffer
, const MAT2
*lpmat2
)
1337 FIXME_(font
)("(%04x, '%c', %04x, %p, %ld, %p, %p): stub\n",
1338 hdc
, uChar
, fuFormat
, lpgm
, cbBuffer
, lpBuffer
, lpmat2
);
1339 return (DWORD
)-1; /* failure */
1343 /***********************************************************************
1344 * GetGlyphOutlineA (GDI32.186)
1346 DWORD WINAPI
GetGlyphOutlineA( HDC hdc
, UINT uChar
, UINT fuFormat
,
1347 LPGLYPHMETRICS lpgm
, DWORD cbBuffer
,
1348 LPVOID lpBuffer
, const MAT2
*lpmat2
)
1350 FIXME_(font
)("(%04x, '%c', %04x, %p, %ld, %p, %p): stub\n",
1351 hdc
, uChar
, fuFormat
, lpgm
, cbBuffer
, lpBuffer
, lpmat2
);
1352 return (DWORD
)-1; /* failure */
1355 /***********************************************************************
1356 * GetGlyphOutlineW (GDI32.187)
1358 DWORD WINAPI
GetGlyphOutlineW( HDC hdc
, UINT uChar
, UINT fuFormat
,
1359 LPGLYPHMETRICS lpgm
, DWORD cbBuffer
,
1360 LPVOID lpBuffer
, const MAT2
*lpmat2
)
1362 FIXME_(font
)("(%04x, '%c', %04x, %p, %ld, %p, %p): stub\n",
1363 hdc
, uChar
, fuFormat
, lpgm
, cbBuffer
, lpBuffer
, lpmat2
);
1364 return (DWORD
)-1; /* failure */
1367 /***********************************************************************
1368 * CreateScalableFontResource16 (GDI.310)
1370 BOOL16 WINAPI
CreateScalableFontResource16( UINT16 fHidden
,
1371 LPCSTR lpszResourceFile
,
1372 LPCSTR fontFile
, LPCSTR path
)
1374 return CreateScalableFontResourceA( fHidden
, lpszResourceFile
,
1378 /***********************************************************************
1379 * CreateScalableFontResourceA (GDI32.62)
1381 BOOL WINAPI
CreateScalableFontResourceA( DWORD fHidden
,
1382 LPCSTR lpszResourceFile
,
1383 LPCSTR lpszFontFile
,
1384 LPCSTR lpszCurrentPath
)
1386 /* fHidden=1 - only visible for the calling app, read-only, not
1387 * enumbered with EnumFonts/EnumFontFamilies
1388 * lpszCurrentPath can be NULL
1390 FIXME_(font
)("(%ld,%s,%s,%s): stub\n",
1391 fHidden
, lpszResourceFile
, lpszFontFile
, lpszCurrentPath
);
1392 return FALSE
; /* create failed */
1395 /***********************************************************************
1396 * CreateScalableFontResourceW (GDI32.63)
1398 BOOL WINAPI
CreateScalableFontResourceW( DWORD fHidden
,
1399 LPCWSTR lpszResourceFile
,
1400 LPCWSTR lpszFontFile
,
1401 LPCWSTR lpszCurrentPath
)
1403 FIXME_(font
)("(%ld,%p,%p,%p): stub\n",
1404 fHidden
, lpszResourceFile
, lpszFontFile
, lpszCurrentPath
);
1405 return FALSE
; /* create failed */
1409 /*************************************************************************
1410 * GetRasterizerCaps16 (GDI.313)
1412 BOOL16 WINAPI
GetRasterizerCaps16( LPRASTERIZER_STATUS lprs
, UINT16 cbNumBytes
)
1414 return GetRasterizerCaps( lprs
, cbNumBytes
);
1418 /*************************************************************************
1419 * GetRasterizerCaps (GDI32.216)
1421 BOOL WINAPI
GetRasterizerCaps( LPRASTERIZER_STATUS lprs
, UINT cbNumBytes
)
1423 lprs
->nSize
= sizeof(RASTERIZER_STATUS
);
1424 lprs
->wFlags
= TT_AVAILABLE
|TT_ENABLED
;
1425 lprs
->nLanguageID
= 0;
1430 /*************************************************************************
1431 * GetKerningPairs16 (GDI.332)
1433 INT16 WINAPI
GetKerningPairs16( HDC16 hDC
, INT16 cPairs
,
1434 LPKERNINGPAIR16 lpKerningPairs
)
1436 /* At this time kerning is ignored (set to 0) */
1438 FIXME_(font
)("(%x,%d,%p): almost empty stub!\n",
1439 hDC
, cPairs
, lpKerningPairs
);
1440 for (i
= 0; i
< cPairs
; i
++)
1441 lpKerningPairs
[i
].iKernAmount
= 0;
1447 /*************************************************************************
1448 * GetKerningPairsA (GDI32.192)
1450 DWORD WINAPI
GetKerningPairsA( HDC hDC
, DWORD cPairs
,
1451 LPKERNINGPAIR lpKerningPairs
)
1454 FIXME_(font
)("(%x,%ld,%p): almost empty stub!\n",
1455 hDC
, cPairs
, lpKerningPairs
);
1456 for (i
= 0; i
< cPairs
; i
++)
1457 lpKerningPairs
[i
].iKernAmount
= 0;
1462 /*************************************************************************
1463 * GetKerningPairsW (GDI32.193)
1465 DWORD WINAPI
GetKerningPairsW( HDC hDC
, DWORD cPairs
,
1466 LPKERNINGPAIR lpKerningPairs
)
1468 return GetKerningPairsA( hDC
, cPairs
, lpKerningPairs
);
1471 /*************************************************************************
1472 * TranslateCharsetInfo [GDI32.382]
1474 * Fills a CHARSETINFO structure for a character set, code page, or
1475 * font. This allows making the correspondance between different labelings
1476 * (character set, Windows, ANSI, and OEM codepages, and Unicode ranges)
1477 * of the same encoding.
1479 * Only one codepage will be set in lpCs->fs. If TCI_SRCFONTSIG is used,
1480 * only one codepage should be set in *lpSrc.
1483 * TRUE on success, FALSE on failure.
1486 BOOL WINAPI
TranslateCharsetInfo(
1488 if flags == TCI_SRCFONTSIG: pointer to fsCsb of a FONTSIGNATURE
1489 if flags == TCI_SRCCHARSET: a character set value
1490 if flags == TCI_SRCCODEPAGE: a code page value
1492 LPCHARSETINFO lpCs
, /* structure to receive charset information */
1493 DWORD flags
/* determines interpretation of lpSrc */
1497 case TCI_SRCFONTSIG
:
1498 while (!(*lpSrc
>>index
& 0x0001) && index
<MAXTCIINDEX
) index
++;
1500 case TCI_SRCCODEPAGE
:
1501 while ((UINT
) (lpSrc
) != FONT_tci
[index
].ciACP
&& index
< MAXTCIINDEX
) index
++;
1503 case TCI_SRCCHARSET
:
1504 while ((UINT
) (lpSrc
) != FONT_tci
[index
].ciCharset
&& index
< MAXTCIINDEX
) index
++;
1509 if (index
>= MAXTCIINDEX
|| FONT_tci
[index
].ciCharset
== DEFAULT_CHARSET
) return FALSE
;
1510 memcpy(lpCs
, &FONT_tci
[index
], sizeof(CHARSETINFO
));
1514 /*************************************************************************
1515 * GetFontLanguageInfo (GDI32.182)
1517 DWORD WINAPI
GetFontLanguageInfo(HDC hdc
) {
1518 /* return value 0 is correct for most cases anyway */
1519 FIXME_(font
)("(%x):stub!\n", hdc
);
1523 /*************************************************************************
1524 * GetFontLanguageInfo (GDI.616)
1526 DWORD WINAPI
GetFontLanguageInfo16(HDC16 hdc
) {
1527 /* return value 0 is correct for most cases anyway */
1528 FIXME_(font
)("(%x):stub!\n",hdc
);
1532 /*************************************************************************
1533 * GetFontData [GDI32.181] Retrieve data for TrueType font
1537 * success: Number of bytes returned
1538 * failure: GDI_ERROR
1542 * Calls SetLastError()
1548 DWORD WINAPI
GetFontData(HDC hdc
, DWORD table
, DWORD offset
,
1549 LPVOID buffer
, DWORD length
)
1551 FIXME_(font
)("(%x,%ld,%ld,%p,%ld): stub\n",
1552 hdc
, table
, offset
, buffer
, length
);
1553 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1557 /*************************************************************************
1558 * GetCharacterPlacementA [GDI32.160]
1561 * the web browser control of ie4 calls this with dwFlags=0
1564 GetCharacterPlacementA(HDC hdc
, LPCSTR lpString
, INT uCount
,
1565 INT nMaxExtent
, GCP_RESULTSA
*lpResults
,
1571 TRACE_(font
)("%s 0x%08x 0x%08x 0x%08lx:stub!\n",
1572 debugstr_a(lpString
), uCount
, nMaxExtent
, dwFlags
);
1574 TRACE_(font
)("lpOrder=%p lpDx=%p lpCaretPos=%p lpClass=%p lpOutString=%p lpGlyphs=%p\n",
1575 lpResults
->lpOrder
, lpResults
->lpDx
, lpResults
->lpCaretPos
, lpResults
->lpClass
,
1576 lpResults
->lpOutString
, lpResults
->lpGlyphs
);
1578 if(dwFlags
) FIXME_(font
)("flags 0x%08lx ignored\n", dwFlags
);
1579 if(lpResults
->lpOrder
) FIXME_(font
)("reordering not implemented\n");
1580 if(lpResults
->lpCaretPos
) FIXME_(font
)("caret positions not implemented\n");
1581 if(lpResults
->lpClass
) FIXME_(font
)("classes not implemented\n");
1582 if(lpResults
->lpGlyphs
) FIXME_(font
)("glyphs not implemented\n");
1584 /* copy will do if the GCP_REORDER flag is not set */
1585 if(lpResults
->lpOutString
)
1587 lstrcpynA(lpResults
->lpOutString
, lpString
, uCount
);
1590 if (lpResults
->lpDx
)
1593 for (i
=0; i
<uCount
;i
++)
1595 if (GetCharWidth32A(hdc
, lpString
[i
], lpString
[i
], &c
))
1596 lpResults
->lpDx
[i
]= c
;
1600 if (GetTextExtentPoint32A(hdc
, lpString
, uCount
, &size
))
1601 ret
= MAKELONG(size
.cx
, size
.cy
);
1606 /*************************************************************************
1607 * GetCharacterPlacementW [GDI32.161]
1610 GetCharacterPlacementW(HDC hdc
, LPCWSTR lpString
, INT uCount
,
1611 INT nMaxExtent
, GCP_RESULTSW
*lpResults
,
1614 /* return value 0 is correct for most cases anyway */
1615 FIXME_(font
)(":stub!\n");
1619 /*************************************************************************
1620 * GetCharABCWidthsFloatA [GDI32.150]
1622 BOOL WINAPI
GetCharABCWidthsFloatA(HDC hdc
, UINT iFirstChar
, UINT iLastChar
,
1625 FIXME_(gdi
)("GetCharABCWidthsFloatA, stub\n");
1629 /*************************************************************************
1630 * GetCharABCWidthsFloatW [GDI32.151]
1632 BOOL WINAPI
GetCharABCWidthsFloatW(HDC hdc
, UINT iFirstChar
,
1633 UINT iLastChar
, LPABCFLOAT lpABCF
)
1635 FIXME_(gdi
)("GetCharABCWidthsFloatW, stub\n");
1639 /*************************************************************************
1640 * GetCharWidthFloatA [GDI32.156]
1642 BOOL WINAPI
GetCharWidthFloatA(HDC hdc
, UINT iFirstChar
,
1643 UINT iLastChar
, PFLOAT pxBuffer
)
1645 FIXME_(gdi
)("GetCharWidthFloatA, stub\n");
1649 /*************************************************************************
1650 * GetCharWidthFloatW [GDI32.157]
1652 BOOL WINAPI
GetCharWidthFloatW(HDC hdc
, UINT iFirstChar
,
1653 UINT iLastChar
, PFLOAT pxBuffer
)
1655 FIXME_(gdi
)("GetCharWidthFloatW, stub\n");