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 FONTENUMPROCW 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 /***********************************************************************
136 * TEXTMETRIC conversion functions.
138 void FONT_TextMetric32Ato16(const LPTEXTMETRICA ptm32
, LPTEXTMETRIC16 ptm16
)
140 ptm16
->tmHeight
= ptm32
->tmHeight
;
141 ptm16
->tmAscent
= ptm32
->tmAscent
;
142 ptm16
->tmDescent
= ptm32
->tmDescent
;
143 ptm16
->tmInternalLeading
= ptm32
->tmInternalLeading
;
144 ptm16
->tmExternalLeading
= ptm32
->tmExternalLeading
;
145 ptm16
->tmAveCharWidth
= ptm32
->tmAveCharWidth
;
146 ptm16
->tmMaxCharWidth
= ptm32
->tmMaxCharWidth
;
147 ptm16
->tmWeight
= ptm32
->tmWeight
;
148 ptm16
->tmOverhang
= ptm32
->tmOverhang
;
149 ptm16
->tmDigitizedAspectX
= ptm32
->tmDigitizedAspectX
;
150 ptm16
->tmDigitizedAspectY
= ptm32
->tmDigitizedAspectY
;
151 ptm16
->tmFirstChar
= ptm32
->tmFirstChar
;
152 ptm16
->tmLastChar
= ptm32
->tmLastChar
;
153 ptm16
->tmDefaultChar
= ptm32
->tmDefaultChar
;
154 ptm16
->tmBreakChar
= ptm32
->tmBreakChar
;
155 ptm16
->tmItalic
= ptm32
->tmItalic
;
156 ptm16
->tmUnderlined
= ptm32
->tmUnderlined
;
157 ptm16
->tmStruckOut
= ptm32
->tmStruckOut
;
158 ptm16
->tmPitchAndFamily
= ptm32
->tmPitchAndFamily
;
159 ptm16
->tmCharSet
= ptm32
->tmCharSet
;
162 void FONT_TextMetric32Wto16(const LPTEXTMETRICW ptm32
, LPTEXTMETRIC16 ptm16
)
164 ptm16
->tmHeight
= ptm32
->tmHeight
;
165 ptm16
->tmAscent
= ptm32
->tmAscent
;
166 ptm16
->tmDescent
= ptm32
->tmDescent
;
167 ptm16
->tmInternalLeading
= ptm32
->tmInternalLeading
;
168 ptm16
->tmExternalLeading
= ptm32
->tmExternalLeading
;
169 ptm16
->tmAveCharWidth
= ptm32
->tmAveCharWidth
;
170 ptm16
->tmMaxCharWidth
= ptm32
->tmMaxCharWidth
;
171 ptm16
->tmWeight
= ptm32
->tmWeight
;
172 ptm16
->tmOverhang
= ptm32
->tmOverhang
;
173 ptm16
->tmDigitizedAspectX
= ptm32
->tmDigitizedAspectX
;
174 ptm16
->tmDigitizedAspectY
= ptm32
->tmDigitizedAspectY
;
175 ptm16
->tmFirstChar
= ptm32
->tmFirstChar
;
176 ptm16
->tmLastChar
= ptm32
->tmLastChar
;
177 ptm16
->tmDefaultChar
= ptm32
->tmDefaultChar
;
178 ptm16
->tmBreakChar
= ptm32
->tmBreakChar
;
179 ptm16
->tmItalic
= ptm32
->tmItalic
;
180 ptm16
->tmUnderlined
= ptm32
->tmUnderlined
;
181 ptm16
->tmStruckOut
= ptm32
->tmStruckOut
;
182 ptm16
->tmPitchAndFamily
= ptm32
->tmPitchAndFamily
;
183 ptm16
->tmCharSet
= ptm32
->tmCharSet
;
186 void FONT_TextMetric16to32A(const LPTEXTMETRIC16 ptm16
, LPTEXTMETRICA ptm32
)
188 ptm32
->tmHeight
= ptm16
->tmHeight
;
189 ptm32
->tmAscent
= ptm16
->tmAscent
;
190 ptm32
->tmDescent
= ptm16
->tmDescent
;
191 ptm32
->tmInternalLeading
= ptm16
->tmInternalLeading
;
192 ptm32
->tmExternalLeading
= ptm16
->tmExternalLeading
;
193 ptm32
->tmAveCharWidth
= ptm16
->tmAveCharWidth
;
194 ptm32
->tmMaxCharWidth
= ptm16
->tmMaxCharWidth
;
195 ptm32
->tmWeight
= ptm16
->tmWeight
;
196 ptm32
->tmOverhang
= ptm16
->tmOverhang
;
197 ptm32
->tmDigitizedAspectX
= ptm16
->tmDigitizedAspectX
;
198 ptm32
->tmDigitizedAspectY
= ptm16
->tmDigitizedAspectY
;
199 ptm32
->tmFirstChar
= ptm16
->tmFirstChar
;
200 ptm32
->tmLastChar
= ptm16
->tmLastChar
;
201 ptm32
->tmDefaultChar
= ptm16
->tmDefaultChar
;
202 ptm32
->tmBreakChar
= ptm16
->tmBreakChar
;
203 ptm32
->tmItalic
= ptm16
->tmItalic
;
204 ptm32
->tmUnderlined
= ptm16
->tmUnderlined
;
205 ptm32
->tmStruckOut
= ptm16
->tmStruckOut
;
206 ptm32
->tmPitchAndFamily
= ptm16
->tmPitchAndFamily
;
207 ptm32
->tmCharSet
= ptm16
->tmCharSet
;
210 void FONT_TextMetric16to32W(const LPTEXTMETRIC16 ptm16
, LPTEXTMETRICW ptm32
)
212 ptm32
->tmHeight
= ptm16
->tmHeight
;
213 ptm32
->tmAscent
= ptm16
->tmAscent
;
214 ptm32
->tmDescent
= ptm16
->tmDescent
;
215 ptm32
->tmInternalLeading
= ptm16
->tmInternalLeading
;
216 ptm32
->tmExternalLeading
= ptm16
->tmExternalLeading
;
217 ptm32
->tmAveCharWidth
= ptm16
->tmAveCharWidth
;
218 ptm32
->tmMaxCharWidth
= ptm16
->tmMaxCharWidth
;
219 ptm32
->tmWeight
= ptm16
->tmWeight
;
220 ptm32
->tmOverhang
= ptm16
->tmOverhang
;
221 ptm32
->tmDigitizedAspectX
= ptm16
->tmDigitizedAspectX
;
222 ptm32
->tmDigitizedAspectY
= ptm16
->tmDigitizedAspectY
;
223 ptm32
->tmFirstChar
= ptm16
->tmFirstChar
;
224 ptm32
->tmLastChar
= ptm16
->tmLastChar
;
225 ptm32
->tmDefaultChar
= ptm16
->tmDefaultChar
;
226 ptm32
->tmBreakChar
= ptm16
->tmBreakChar
;
227 ptm32
->tmItalic
= ptm16
->tmItalic
;
228 ptm32
->tmUnderlined
= ptm16
->tmUnderlined
;
229 ptm32
->tmStruckOut
= ptm16
->tmStruckOut
;
230 ptm32
->tmPitchAndFamily
= ptm16
->tmPitchAndFamily
;
231 ptm32
->tmCharSet
= ptm16
->tmCharSet
;
234 void FONT_TextMetric32Ato32W(const LPTEXTMETRICA ptm32A
, LPTEXTMETRICW ptm32W
)
236 ptm32W
->tmHeight
= ptm32A
->tmHeight
;
237 ptm32W
->tmAscent
= ptm32A
->tmAscent
;
238 ptm32W
->tmDescent
= ptm32A
->tmDescent
;
239 ptm32W
->tmInternalLeading
= ptm32A
->tmInternalLeading
;
240 ptm32W
->tmExternalLeading
= ptm32A
->tmExternalLeading
;
241 ptm32W
->tmAveCharWidth
= ptm32A
->tmAveCharWidth
;
242 ptm32W
->tmMaxCharWidth
= ptm32A
->tmMaxCharWidth
;
243 ptm32W
->tmWeight
= ptm32A
->tmWeight
;
244 ptm32W
->tmOverhang
= ptm32A
->tmOverhang
;
245 ptm32W
->tmDigitizedAspectX
= ptm32A
->tmDigitizedAspectX
;
246 ptm32W
->tmDigitizedAspectY
= ptm32A
->tmDigitizedAspectY
;
247 ptm32W
->tmFirstChar
= ptm32A
->tmFirstChar
;
248 ptm32W
->tmLastChar
= ptm32A
->tmLastChar
;
249 ptm32W
->tmDefaultChar
= ptm32A
->tmDefaultChar
;
250 ptm32W
->tmBreakChar
= ptm32A
->tmBreakChar
;
251 ptm32W
->tmItalic
= ptm32A
->tmItalic
;
252 ptm32W
->tmUnderlined
= ptm32A
->tmUnderlined
;
253 ptm32W
->tmStruckOut
= ptm32A
->tmStruckOut
;
254 ptm32W
->tmPitchAndFamily
= ptm32A
->tmPitchAndFamily
;
255 ptm32W
->tmCharSet
= ptm32A
->tmCharSet
;
258 /***********************************************************************
259 * CreateFontIndirect16 (GDI.57)
261 HFONT16 WINAPI
CreateFontIndirect16( const LOGFONT16
*font
)
267 hFont
= GDI_AllocObject( sizeof(FONTOBJ
), FONT_MAGIC
);
271 fontPtr
= (FONTOBJ
*) GDI_HEAP_LOCK( hFont
);
272 memcpy( &fontPtr
->logfont
, font
, sizeof(LOGFONT16
) );
274 TRACE_(font
)("(%i %i %i %i) '%s' %s %s => %04x\n",
275 font
->lfHeight
, font
->lfWidth
,
276 font
->lfEscapement
, font
->lfOrientation
,
277 font
->lfFaceName
? font
->lfFaceName
: "NULL",
278 font
->lfWeight
> 400 ? "Bold" : "",
279 font
->lfItalic
? "Italic" : "",
282 if (font
->lfEscapement
!= font
->lfOrientation
) {
283 /* this should really depend on whether GM_ADVANCED is set */
284 fontPtr
->logfont
.lfOrientation
= fontPtr
->logfont
.lfEscapement
;
286 "orientation angle %f set to escapement angle %f for new font %04x\n",
287 font
->lfOrientation
/10., font
->lfEscapement
/10., hFont
);
289 GDI_HEAP_UNLOCK( hFont
);
292 else WARN_(font
)("(NULL) => NULL\n");
297 /***********************************************************************
298 * CreateFontIndirect32A (GDI32.44)
300 HFONT WINAPI
CreateFontIndirectA( const LOGFONTA
*font
)
304 FONT_LogFont32ATo16( font
, &font16
);
305 return CreateFontIndirect16( &font16
);
308 /***********************************************************************
309 * CreateFontIndirect32W (GDI32.45)
311 HFONT WINAPI
CreateFontIndirectW( const LOGFONTW
*font
)
315 FONT_LogFont32WTo16( font
, &font16
);
316 return CreateFontIndirect16( &font16
);
319 /***********************************************************************
320 * CreateFont16 (GDI.56)
322 HFONT16 WINAPI
CreateFont16(INT16 height
, INT16 width
, INT16 esc
, INT16 orient
,
323 INT16 weight
, BYTE italic
, BYTE underline
,
324 BYTE strikeout
, BYTE charset
, BYTE outpres
,
325 BYTE clippres
, BYTE quality
, BYTE pitch
,
330 TRACE_(font
)("('%s',%d,%d)\n",
331 (name
? name
: "(null)") , height
, width
);
333 logfont
.lfHeight
= height
;
334 logfont
.lfWidth
= width
;
335 logfont
.lfEscapement
= esc
;
336 logfont
.lfOrientation
= orient
;
337 logfont
.lfWeight
= weight
;
338 logfont
.lfItalic
= italic
;
339 logfont
.lfUnderline
= underline
;
340 logfont
.lfStrikeOut
= strikeout
;
341 logfont
.lfCharSet
= charset
;
342 logfont
.lfOutPrecision
= outpres
;
343 logfont
.lfClipPrecision
= clippres
;
344 logfont
.lfQuality
= quality
;
345 logfont
.lfPitchAndFamily
= pitch
;
348 lstrcpynA(logfont
.lfFaceName
,name
,sizeof(logfont
.lfFaceName
));
350 logfont
.lfFaceName
[0] = '\0';
352 return CreateFontIndirect16( &logfont
);
355 /*************************************************************************
356 * CreateFont32A (GDI32.43)
358 HFONT WINAPI
CreateFontA( INT height
, INT width
, INT esc
,
359 INT orient
, INT weight
, DWORD italic
,
360 DWORD underline
, DWORD strikeout
, DWORD charset
,
361 DWORD outpres
, DWORD clippres
, DWORD quality
,
362 DWORD pitch
, LPCSTR name
)
364 return (HFONT
)CreateFont16( height
, width
, esc
, orient
, weight
, italic
,
365 underline
, strikeout
, charset
, outpres
,
366 clippres
, quality
, pitch
, name
);
369 /*************************************************************************
370 * CreateFont32W (GDI32.46)
372 HFONT WINAPI
CreateFontW( INT height
, INT width
, INT esc
,
373 INT orient
, INT weight
, DWORD italic
,
374 DWORD underline
, DWORD strikeout
, DWORD charset
,
375 DWORD outpres
, DWORD clippres
, DWORD quality
,
376 DWORD pitch
, LPCWSTR name
)
378 LPSTR namea
= HEAP_strdupWtoA( GetProcessHeap(), 0, name
);
379 HFONT ret
= (HFONT
)CreateFont16( height
, width
, esc
, orient
, weight
,
380 italic
, underline
, strikeout
, charset
,
381 outpres
, clippres
, quality
, pitch
,
383 if (namea
) HeapFree( GetProcessHeap(), 0, namea
);
388 /***********************************************************************
391 INT16
FONT_GetObject16( FONTOBJ
* font
, INT16 count
, LPSTR buffer
)
393 if (count
> sizeof(LOGFONT16
)) count
= sizeof(LOGFONT16
);
394 memcpy( buffer
, &font
->logfont
, count
);
398 /***********************************************************************
401 INT
FONT_GetObjectA( FONTOBJ
*font
, INT count
, LPSTR buffer
)
405 FONT_LogFont16To32A( &font
->logfont
, &fnt32
);
407 if (count
> sizeof(fnt32
)) count
= sizeof(fnt32
);
408 memcpy( buffer
, &fnt32
, count
);
411 /***********************************************************************
414 INT
FONT_GetObjectW( FONTOBJ
*font
, INT count
, LPSTR buffer
)
418 FONT_LogFont16To32W( &font
->logfont
, &fnt32
);
420 if (count
> sizeof(fnt32
)) count
= sizeof(fnt32
);
421 memcpy( buffer
, &fnt32
, count
);
426 /***********************************************************************
427 * FONT_EnumInstance16
429 * Called by the device driver layer to pass font info
430 * down to the application.
432 static INT
FONT_EnumInstance16( LPENUMLOGFONT16 plf
,
433 LPNEWTEXTMETRIC16 ptm
, UINT16 fType
, LPARAM lp
)
435 #define pfe ((fontEnum16*)lp)
436 if( pfe
->lpLogFontParam
->lfCharSet
== DEFAULT_CHARSET
||
437 pfe
->lpLogFontParam
->lfCharSet
== plf
->elfLogFont
.lfCharSet
)
439 memcpy( pfe
->lpLogFont
, plf
, sizeof(ENUMLOGFONT16
) );
440 memcpy( pfe
->lpTextMetric
, ptm
, sizeof(NEWTEXTMETRIC16
) );
442 return pfe
->lpEnumFunc( pfe
->segLogFont
, pfe
->segTextMetric
, fType
, (LPARAM
)(pfe
->lpData
) );
448 /***********************************************************************
449 * FONT_EnumInstance32
451 static INT
FONT_EnumInstance( LPENUMLOGFONT16 plf
,
452 LPNEWTEXTMETRIC16 ptm
, UINT16 fType
, LPARAM lp
)
454 /* lfCharSet is at the same offset in both LOGFONT32A and LOGFONT32W */
456 #define pfe ((fontEnum32*)lp)
457 if( pfe
->lpLogFontParam
->lfCharSet
== DEFAULT_CHARSET
||
458 pfe
->lpLogFontParam
->lfCharSet
== plf
->elfLogFont
.lfCharSet
)
460 /* convert font metrics */
462 if( pfe
->dwFlags
& ENUM_UNICODE
)
464 FONT_LogFont16To32W( &plf
->elfLogFont
, (LPLOGFONTW
)(pfe
->lpLogFont
) );
465 FONT_TextMetric16to32W( (LPTEXTMETRIC16
)ptm
, (LPTEXTMETRICW
)(pfe
->lpTextMetric
) );
469 FONT_LogFont16To32A( &plf
->elfLogFont
, (LPLOGFONTA
)pfe
->lpLogFont
);
470 FONT_TextMetric16to32A( (LPTEXTMETRIC16
)ptm
, (LPTEXTMETRICA
)pfe
->lpTextMetric
);
473 return pfe
->lpEnumFunc( (LPENUMLOGFONTW
)pfe
->lpLogFont
,
474 (LPNEWTEXTMETRICW
)pfe
->lpTextMetric
, fType
, pfe
->lpData
);
480 /***********************************************************************
481 * EnumFontFamiliesEx16 (GDI.613)
483 INT16 WINAPI
EnumFontFamiliesEx16( HDC16 hDC
, LPLOGFONT16 plf
,
484 FONTENUMPROCEX16 efproc
, LPARAM lParam
,
488 DC
* dc
= (DC
*) GDI_GetObjPtr( hDC
, DC_MAGIC
);
490 if( dc
&& dc
->funcs
->pEnumDeviceFonts
)
492 LPNEWTEXTMETRICEX16 lptm16
= SEGPTR_ALLOC( sizeof(NEWTEXTMETRICEX16
) );
495 LPENUMLOGFONTEX16 lplf16
= SEGPTR_ALLOC( sizeof(ENUMLOGFONTEX16
) );
500 fe16
.lpLogFontParam
= plf
;
501 fe16
.lpEnumFunc
= efproc
;
502 fe16
.lpData
= lParam
;
504 fe16
.lpTextMetric
= lptm16
;
505 fe16
.lpLogFont
= lplf16
;
506 fe16
.segTextMetric
= SEGPTR_GET(lptm16
);
507 fe16
.segLogFont
= SEGPTR_GET(lplf16
);
509 retVal
= dc
->funcs
->pEnumDeviceFonts( dc
, plf
, FONT_EnumInstance16
, (LPARAM
)&fe16
);
519 /***********************************************************************
520 * FONT_EnumFontFamiliesEx32
522 static INT
FONT_EnumFontFamiliesEx( HDC hDC
, LPLOGFONTW plf
, FONTENUMPROCW efproc
,
523 LPARAM lParam
, DWORD dwUnicode
)
525 DC
* dc
= (DC
*) GDI_GetObjPtr( hDC
, DC_MAGIC
);
527 if( dc
&& dc
->funcs
->pEnumDeviceFonts
)
530 NEWTEXTMETRICEXW tm32w
;
531 ENUMLOGFONTEXW lf32w
;
534 fe32
.lpLogFontParam
= plf
;
535 fe32
.lpEnumFunc
= efproc
;
536 fe32
.lpData
= lParam
;
538 fe32
.lpTextMetric
= &tm32w
;
539 fe32
.lpLogFont
= &lf32w
;
540 fe32
.dwFlags
= dwUnicode
;
542 /* the only difference between LOGFONT32A and LOGFONT32W is in the lfFaceName */
544 if( plf
->lfFaceName
[0] )
547 lstrcpynWtoA( lf16
.lfFaceName
, plf
->lfFaceName
, LF_FACESIZE
);
549 lstrcpynA( lf16
.lfFaceName
, (LPCSTR
)plf
->lfFaceName
, LF_FACESIZE
);
551 else lf16
.lfFaceName
[0] = '\0';
552 lf16
.lfCharSet
= plf
->lfCharSet
;
554 return dc
->funcs
->pEnumDeviceFonts( dc
, &lf16
, FONT_EnumInstance
, (LPARAM
)&fe32
);
559 /***********************************************************************
560 * EnumFontFamiliesEx32W (GDI32.82)
562 INT WINAPI
EnumFontFamiliesExW( HDC hDC
, LPLOGFONTW plf
,
563 FONTENUMPROCEXW efproc
,
564 LPARAM lParam
, DWORD dwFlags
)
566 return FONT_EnumFontFamiliesEx( hDC
, plf
, (FONTENUMPROCW
)efproc
,
567 lParam
, ENUM_UNICODE
);
570 /***********************************************************************
571 * EnumFontFamiliesEx32A (GDI32.81)
573 INT WINAPI
EnumFontFamiliesExA( HDC hDC
, LPLOGFONTA plf
,
574 FONTENUMPROCEXA efproc
,
575 LPARAM lParam
, DWORD dwFlags
)
577 return FONT_EnumFontFamiliesEx( hDC
, (LPLOGFONTW
)plf
,
578 (FONTENUMPROCW
)efproc
, lParam
, 0);
581 /***********************************************************************
582 * EnumFontFamilies16 (GDI.330)
584 INT16 WINAPI
EnumFontFamilies16( HDC16 hDC
, LPCSTR lpFamily
,
585 FONTENUMPROC16 efproc
, LPARAM lpData
)
589 lf
.lfCharSet
= DEFAULT_CHARSET
;
590 if( lpFamily
) lstrcpynA( lf
.lfFaceName
, lpFamily
, LF_FACESIZE
);
591 else lf
.lfFaceName
[0] = '\0';
593 return EnumFontFamiliesEx16( hDC
, &lf
, (FONTENUMPROCEX16
)efproc
, lpData
, 0 );
596 /***********************************************************************
597 * EnumFontFamilies32A (GDI32.80)
599 INT WINAPI
EnumFontFamiliesA( HDC hDC
, LPCSTR lpFamily
,
600 FONTENUMPROCA efproc
, LPARAM lpData
)
604 lf
.lfCharSet
= DEFAULT_CHARSET
;
605 if( lpFamily
) lstrcpynA( lf
.lfFaceName
, lpFamily
, LF_FACESIZE
);
606 else lf
.lfFaceName
[0] = lf
.lfFaceName
[1] = '\0';
608 return FONT_EnumFontFamiliesEx( hDC
, (LPLOGFONTW
)&lf
,
609 (FONTENUMPROCW
)efproc
, lpData
, 0 );
612 /***********************************************************************
613 * EnumFontFamilies32W (GDI32.83)
615 INT WINAPI
EnumFontFamiliesW( HDC hDC
, LPCWSTR lpFamily
,
616 FONTENUMPROCW efproc
, LPARAM lpData
)
620 lf
.lfCharSet
= DEFAULT_CHARSET
;
621 if( lpFamily
) lstrcpynW( lf
.lfFaceName
, lpFamily
, LF_FACESIZE
);
622 else lf
.lfFaceName
[0] = 0;
624 return FONT_EnumFontFamiliesEx( hDC
, &lf
, efproc
, lpData
, ENUM_UNICODE
);
627 /***********************************************************************
628 * EnumFonts16 (GDI.70)
630 INT16 WINAPI
EnumFonts16( HDC16 hDC
, LPCSTR lpName
, FONTENUMPROC16 efproc
,
633 return EnumFontFamilies16( hDC
, lpName
, (FONTENUMPROCEX16
)efproc
, lpData
);
636 /***********************************************************************
637 * EnumFonts32A (GDI32.84)
639 INT WINAPI
EnumFontsA( HDC hDC
, LPCSTR lpName
, FONTENUMPROCA efproc
,
642 return EnumFontFamiliesA( hDC
, lpName
, efproc
, lpData
);
645 /***********************************************************************
646 * EnumFonts32W (GDI32.85)
648 INT WINAPI
EnumFontsW( HDC hDC
, LPCWSTR lpName
, FONTENUMPROCW efproc
,
651 return EnumFontFamiliesW( hDC
, lpName
, efproc
, lpData
);
655 /***********************************************************************
656 * GetTextCharacterExtra16 (GDI.89)
658 INT16 WINAPI
GetTextCharacterExtra16( HDC16 hdc
)
660 DC
* dc
= (DC
*) GDI_GetObjPtr( hdc
, DC_MAGIC
);
662 return abs( (dc
->w
.charExtra
* dc
->wndExtX
+ dc
->vportExtX
/ 2)
667 /***********************************************************************
668 * GetTextCharacterExtra32 (GDI32.225)
670 INT WINAPI
GetTextCharacterExtra( HDC hdc
)
672 DC
* dc
= (DC
*) GDI_GetObjPtr( hdc
, DC_MAGIC
);
674 return abs( (dc
->w
.charExtra
* dc
->wndExtX
+ dc
->vportExtX
/ 2)
679 /***********************************************************************
680 * SetTextCharacterExtra16 (GDI.8)
682 INT16 WINAPI
SetTextCharacterExtra16( HDC16 hdc
, INT16 extra
)
684 return (INT16
)SetTextCharacterExtra( hdc
, extra
);
688 /***********************************************************************
689 * SetTextCharacterExtra32 (GDI32.337)
691 INT WINAPI
SetTextCharacterExtra( HDC hdc
, INT extra
)
694 DC
* dc
= DC_GetDCPtr( hdc
);
696 if (dc
->funcs
->pSetTextCharacterExtra
)
697 return dc
->funcs
->pSetTextCharacterExtra( dc
, extra
);
698 extra
= (extra
* dc
->vportExtX
+ dc
->wndExtX
/ 2) / dc
->wndExtX
;
699 prev
= dc
->w
.charExtra
;
700 dc
->w
.charExtra
= abs(extra
);
701 return (prev
* dc
->wndExtX
+ dc
->vportExtX
/ 2) / dc
->vportExtX
;
705 /***********************************************************************
706 * SetTextJustification16 (GDI.10)
708 INT16 WINAPI
SetTextJustification16( HDC16 hdc
, INT16 extra
, INT16 breaks
)
710 return SetTextJustification( hdc
, extra
, breaks
);
714 /***********************************************************************
715 * SetTextJustification (GDI32.339)
717 BOOL WINAPI
SetTextJustification( HDC hdc
, INT extra
, INT breaks
)
719 DC
* dc
= DC_GetDCPtr( hdc
);
721 if (dc
->funcs
->pSetTextJustification
)
722 return dc
->funcs
->pSetTextJustification( dc
, extra
, breaks
);
724 extra
= abs((extra
* dc
->vportExtX
+ dc
->wndExtX
/ 2) / dc
->wndExtX
);
725 if (!extra
) breaks
= 0;
726 dc
->w
.breakTotalExtra
= extra
;
727 dc
->w
.breakCount
= breaks
;
730 dc
->w
.breakExtra
= extra
/ breaks
;
731 dc
->w
.breakRem
= extra
- (dc
->w
.breakCount
* dc
->w
.breakExtra
);
735 dc
->w
.breakExtra
= 0;
742 /***********************************************************************
743 * GetTextFace16 (GDI.92)
745 INT16 WINAPI
GetTextFace16( HDC16 hdc
, INT16 count
, LPSTR name
)
747 return GetTextFaceA(hdc
,count
,name
);
750 /***********************************************************************
751 * GetTextFace32A (GDI32.234)
753 INT WINAPI
GetTextFaceA( HDC hdc
, INT count
, LPSTR name
)
757 DC
* dc
= (DC
*) GDI_GetObjPtr( hdc
, DC_MAGIC
);
759 if (!(font
= (FONTOBJ
*) GDI_GetObjPtr( dc
->w
.hFont
, FONT_MAGIC
)))
762 lstrcpynA( name
, font
->logfont
.lfFaceName
, count
);
763 GDI_HEAP_UNLOCK( dc
->w
.hFont
);
767 return strlen(font
->logfont
.lfFaceName
) + 1;
770 /***********************************************************************
771 * GetTextFace32W (GDI32.235)
773 INT WINAPI
GetTextFaceW( HDC hdc
, INT count
, LPWSTR name
)
775 LPSTR nameA
= HeapAlloc( GetProcessHeap(), 0, count
);
776 INT res
= GetTextFaceA(hdc
,count
,nameA
);
777 lstrcpyAtoW( name
, nameA
);
778 HeapFree( GetProcessHeap(), 0, nameA
);
783 /***********************************************************************
784 * GetTextExtent (GDI.91)
786 DWORD WINAPI
GetTextExtent16( HDC16 hdc
, LPCSTR str
, INT16 count
)
789 if (!GetTextExtentPoint16( hdc
, str
, count
, &size
)) return 0;
790 return MAKELONG( size
.cx
, size
.cy
);
794 /***********************************************************************
795 * GetTextExtentPoint16 (GDI.471)
797 * FIXME: Should this have a bug for compatibility?
798 * Original Windows versions of GetTextExtentPoint{A,W} have documented
799 * bugs (-> MSDN KB q147647.txt).
801 BOOL16 WINAPI
GetTextExtentPoint16( HDC16 hdc
, LPCSTR str
, INT16 count
,
805 BOOL ret
= GetTextExtentPoint32A( hdc
, str
, count
, &size32
);
806 CONV_SIZE32TO16( &size32
, size
);
811 /***********************************************************************
812 * GetTextExtentPoint32A (GDI32.230)
814 BOOL WINAPI
GetTextExtentPoint32A( HDC hdc
, LPCSTR str
, INT count
,
817 DC
* dc
= (DC
*) GDI_GetObjPtr( hdc
, DC_MAGIC
);
820 if (!(dc
= (DC
*)GDI_GetObjPtr( hdc
, METAFILE_DC_MAGIC
)))
824 if (!dc
->funcs
->pGetTextExtentPoint
||
825 !dc
->funcs
->pGetTextExtentPoint( dc
, str
, count
, size
))
828 TRACE_(font
)("(%08x %s %d %p): returning %d,%d\n",
829 hdc
, debugstr_an (str
, count
), count
,
830 size
, size
->cx
, size
->cy
);
835 /***********************************************************************
836 * GetTextExtentPoint32W [GDI32.231] Computes width/height for a string
838 * Computes width and height of the specified string.
844 BOOL WINAPI
GetTextExtentPoint32W(
845 HDC hdc
, /* [in] Handle of device context */
846 LPCWSTR str
, /* [in] Address of text string */
847 INT count
, /* [in] Number of characters in string */
848 LPSIZE size
) /* [out] Address of structure for string size */
850 LPSTR p
= HEAP_strdupWtoA( GetProcessHeap(), 0, str
);
851 BOOL ret
= GetTextExtentPoint32A( hdc
, p
, count
, size
);
852 HeapFree( GetProcessHeap(), 0, p
);
857 /***********************************************************************
858 * GetTextExtentPoint32ABuggy (GDI32.232)
860 BOOL WINAPI
GetTextExtentPointA( HDC hdc
, LPCSTR str
, INT count
,
863 TRACE_(font
)("not bug compatible.\n");
864 return GetTextExtentPoint32A( hdc
, str
, count
, size
);
867 /***********************************************************************
868 * GetTextExtentPoint32WBuggy (GDI32.233)
870 BOOL WINAPI
GetTextExtentPointW( HDC hdc
, LPCWSTR str
, INT count
,
873 TRACE_(font
)("not bug compatible.\n");
874 return GetTextExtentPoint32W( hdc
, str
, count
, size
);
878 /***********************************************************************
879 * GetTextExtentExPoint32A (GDI32.228)
881 BOOL WINAPI
GetTextExtentExPointA( HDC hdc
, LPCSTR str
, INT count
,
882 INT maxExt
, LPINT lpnFit
,
883 LPINT alpDx
, LPSIZE size
)
885 int index
, nFit
, extent
;
887 DC
* dc
= (DC
*) GDI_GetObjPtr( hdc
, DC_MAGIC
);
891 if (!(dc
= (DC
*)GDI_GetObjPtr( hdc
, METAFILE_DC_MAGIC
)))
894 if (!dc
->funcs
->pGetTextExtentPoint
) return FALSE
;
896 size
->cx
= size
->cy
= nFit
= extent
= 0;
897 for(index
= 0; index
< count
; index
++)
899 if(!dc
->funcs
->pGetTextExtentPoint( dc
, str
, 1, &tSize
)) return FALSE
;
900 if( extent
+tSize
.cx
< maxExt
)
905 if( alpDx
) alpDx
[index
] = extent
;
906 if( tSize
.cy
> size
->cy
) size
->cy
= tSize
.cy
;
913 TRACE_(font
)("(%08x '%.*s' %d) returning %d %d %d\n",
914 hdc
,count
,str
,maxExt
,nFit
, size
->cx
,size
->cy
);
919 /***********************************************************************
920 * GetTextExtentExPoint32W (GDI32.229)
923 BOOL WINAPI
GetTextExtentExPointW( HDC hdc
, LPCWSTR str
, INT count
,
924 INT maxExt
, LPINT lpnFit
,
925 LPINT alpDx
, LPSIZE size
)
927 LPSTR p
= HEAP_strdupWtoA( GetProcessHeap(), 0, str
);
928 BOOL ret
= GetTextExtentExPointA( hdc
, p
, count
, maxExt
,
929 lpnFit
, alpDx
, size
);
930 HeapFree( GetProcessHeap(), 0, p
);
934 /***********************************************************************
935 * GetTextMetrics16 (GDI.93)
937 BOOL16 WINAPI
GetTextMetrics16( HDC16 hdc
, TEXTMETRIC16
*metrics
)
941 if (!GetTextMetricsA( (HDC
)hdc
, &tm32
)) return FALSE
;
942 FONT_TextMetric32Ato16( &tm32
, metrics
);
947 /***********************************************************************
948 * GetTextMetrics32A (GDI32.236)
950 BOOL WINAPI
GetTextMetricsA( HDC hdc
, TEXTMETRICA
*metrics
)
952 DC
* dc
= (DC
*) GDI_GetObjPtr( hdc
, DC_MAGIC
);
955 if (!(dc
= (DC
*)GDI_GetObjPtr( hdc
, METAFILE_DC_MAGIC
)))
959 if (!dc
->funcs
->pGetTextMetrics
||
960 !dc
->funcs
->pGetTextMetrics( dc
, metrics
))
963 /* device layer returns values in device units
964 * therefore we have to convert them to logical */
966 #define WDPTOLP(x) ((x<0)? \
967 (-abs((x)*dc->wndExtX/dc->vportExtX)): \
968 (abs((x)*dc->wndExtX/dc->vportExtX)))
969 #define HDPTOLP(y) ((y<0)? \
970 (-abs((y)*dc->wndExtY/dc->vportExtY)): \
971 (abs((y)*dc->wndExtY/dc->vportExtY)))
973 metrics
->tmHeight
= HDPTOLP(metrics
->tmHeight
);
974 metrics
->tmAscent
= HDPTOLP(metrics
->tmAscent
);
975 metrics
->tmDescent
= HDPTOLP(metrics
->tmDescent
);
976 metrics
->tmInternalLeading
= HDPTOLP(metrics
->tmInternalLeading
);
977 metrics
->tmExternalLeading
= HDPTOLP(metrics
->tmExternalLeading
);
978 metrics
->tmAveCharWidth
= WDPTOLP(metrics
->tmAveCharWidth
);
979 metrics
->tmMaxCharWidth
= WDPTOLP(metrics
->tmMaxCharWidth
);
980 metrics
->tmOverhang
= WDPTOLP(metrics
->tmOverhang
);
982 TRACE_(font
)("text metrics:\n"
983 " Weight = %03li\t FirstChar = %03i\t AveCharWidth = %li\n"
984 " Italic = % 3i\t LastChar = %03i\t\t MaxCharWidth = %li\n"
985 " UnderLined = %01i\t DefaultChar = %03i\t Overhang = %li\n"
986 " StruckOut = %01i\t BreakChar = %03i\t CharSet = %i\n"
987 " PitchAndFamily = %02x\n"
988 " --------------------\n"
989 " InternalLeading = %li\n"
993 metrics
->tmWeight
, metrics
->tmFirstChar
, metrics
->tmAveCharWidth
,
994 metrics
->tmItalic
, metrics
->tmLastChar
, metrics
->tmMaxCharWidth
,
995 metrics
->tmUnderlined
, metrics
->tmDefaultChar
, metrics
->tmOverhang
,
996 metrics
->tmStruckOut
, metrics
->tmBreakChar
, metrics
->tmCharSet
,
997 metrics
->tmPitchAndFamily
,
998 metrics
->tmInternalLeading
,
1001 metrics
->tmHeight
);
1006 /***********************************************************************
1007 * GetTextMetrics32W (GDI32.237)
1009 BOOL WINAPI
GetTextMetricsW( HDC hdc
, TEXTMETRICW
*metrics
)
1012 if (!GetTextMetricsA( (HDC16
)hdc
, &tm
)) return FALSE
;
1013 FONT_TextMetric32Ato32W( &tm
, metrics
);
1018 /***********************************************************************
1019 * GetOutlineTextMetrics [GDI.308] Gets metrics for TrueType fonts.
1022 * lpOTM should be LPOUTLINETEXTMETRIC
1025 * Success: Non-zero or size of required buffer
1028 UINT16 WINAPI
GetOutlineTextMetrics16(
1029 HDC16 hdc
, /* [in] Handle of device context */
1030 UINT16 cbData
, /* [in] Size of metric data array */
1031 LPOUTLINETEXTMETRIC16 lpOTM
) /* [out] Address of metric data array */
1033 FIXME_(font
)("(%04x,%04x,%p): stub\n", hdc
,cbData
,lpOTM
);
1038 /***********************************************************************
1039 * GetOutlineTextMetrics [GDI.207] Gets metrics for TrueType fonts.
1043 * Success: Non-zero or size of required buffer
1046 UINT WINAPI
GetOutlineTextMetricsA(
1047 HDC hdc
, /* [in] Handle of device context */
1048 UINT cbData
, /* [in] Size of metric data array */
1049 LPOUTLINETEXTMETRICA lpOTM
) /* [out] Address of metric data array */
1054 LPTEXTMETRICA lptxtMetr
;
1061 lpOTM
= (LPOUTLINETEXTMETRICA
)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY
,sizeof(OUTLINETEXTMETRICA
));
1062 rtn
= sizeof(OUTLINETEXTMETRICA
);
1066 cbData
= sizeof(*lpOTM
);
1070 lpOTM
->otmSize
= cbData
;
1072 lptxtMetr
=HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY
,sizeof(TEXTMETRICA
));
1074 if (!GetTextMetricsA(hdc
,lptxtMetr
))
1079 memcpy(&(lpOTM
->otmTextMetrics
),lptxtMetr
,sizeof(TEXTMETRICA
));
1082 HeapFree(GetProcessHeap(),HEAP_ZERO_MEMORY
,lptxtMetr
);
1084 lpOTM
->otmFilter
= 0;
1086 lpOTM
->otmPanoseNumber
.bFamilyType
= 0;
1087 lpOTM
->otmPanoseNumber
.bSerifStyle
= 0;
1088 lpOTM
->otmPanoseNumber
.bWeight
= 0;
1089 lpOTM
->otmPanoseNumber
.bProportion
= 0;
1090 lpOTM
->otmPanoseNumber
.bContrast
= 0;
1091 lpOTM
->otmPanoseNumber
.bStrokeVariation
= 0;
1092 lpOTM
->otmPanoseNumber
.bArmStyle
= 0;
1093 lpOTM
->otmPanoseNumber
.bLetterform
= 0;
1094 lpOTM
->otmPanoseNumber
.bMidline
= 0;
1095 lpOTM
->otmPanoseNumber
.bXHeight
= 0;
1097 lpOTM
->otmfsSelection
= 0;
1098 lpOTM
->otmfsType
= 0;
1101 Further fill of the structure not implemented,
1102 Needs real values for the structure members
1108 /***********************************************************************
1109 * GetOutlineTextMetrics32W [GDI32.208]
1111 UINT WINAPI
GetOutlineTextMetricsW(
1112 HDC hdc
, /* [in] Handle of device context */
1113 UINT cbData
, /* [in] Size of metric data array */
1114 LPOUTLINETEXTMETRICW lpOTM
) /* [out] Address of metric data array */
1116 FIXME_(font
)("(%d,%d,%p): stub\n", hdc
, cbData
, lpOTM
);
1120 /***********************************************************************
1121 * GetCharWidth16 (GDI.350)
1123 BOOL16 WINAPI
GetCharWidth16( HDC16 hdc
, UINT16 firstChar
, UINT16 lastChar
,
1126 BOOL retVal
= FALSE
;
1128 if( firstChar
!= lastChar
)
1130 LPINT buf32
= (LPINT
)HeapAlloc(GetProcessHeap(), 0,
1131 sizeof(INT
)*(1 + (lastChar
- firstChar
)));
1134 LPINT obuf32
= buf32
;
1137 retVal
= GetCharWidth32A(hdc
, firstChar
, lastChar
, buf32
);
1140 for (i
= firstChar
; i
<= lastChar
; i
++)
1141 *buffer
++ = *buf32
++;
1143 HeapFree(GetProcessHeap(), 0, obuf32
);
1146 else /* happens quite often to warrant a special treatment */
1149 retVal
= GetCharWidth32A(hdc
, firstChar
, lastChar
, &chWidth
);
1156 /***********************************************************************
1157 * GetCharWidth32A (GDI32.155)
1159 BOOL WINAPI
GetCharWidth32A( HDC hdc
, UINT firstChar
, UINT lastChar
,
1163 DC
* dc
= (DC
*) GDI_GetObjPtr( hdc
, DC_MAGIC
);
1166 if (!(dc
= (DC
*)GDI_GetObjPtr( hdc
, METAFILE_DC_MAGIC
)))
1170 if (!dc
->funcs
->pGetCharWidth
||
1171 !dc
->funcs
->pGetCharWidth( dc
, firstChar
, lastChar
, buffer
))
1174 /* convert device units to logical */
1176 extra
= dc
->vportExtX
>> 1;
1177 for( i
= firstChar
; i
<= lastChar
; i
++, buffer
++ )
1178 *buffer
= (*buffer
* dc
->wndExtX
+ extra
) / dc
->vportExtX
;
1184 /***********************************************************************
1185 * GetCharWidth32W (GDI32.158)
1187 BOOL WINAPI
GetCharWidth32W( HDC hdc
, UINT firstChar
, UINT lastChar
,
1190 return GetCharWidth32A( hdc
, firstChar
, lastChar
, buffer
);
1195 /* FIXME: all following APIs *******************************************
1198 * SetMapperFlags16 (GDI.349)
1200 DWORD WINAPI
SetMapperFlags16( HDC16 hDC
, DWORD dwFlag
)
1202 return SetMapperFlags( hDC
, dwFlag
);
1206 /***********************************************************************
1207 * SetMapperFlags32 (GDI32.322)
1209 DWORD WINAPI
SetMapperFlags( HDC hDC
, DWORD dwFlag
)
1211 DC
*dc
= DC_GetDCPtr( hDC
);
1214 if(dc
->funcs
->pSetMapperFlags
)
1215 ret
= dc
->funcs
->pSetMapperFlags( dc
, dwFlag
);
1217 FIXME_(font
)("(0x%04x, 0x%08lx): stub - harmless\n", hDC
, dwFlag
);
1218 GDI_HEAP_UNLOCK( hDC
);
1222 /***********************************************************************
1223 * GetAspectRatioFilterEx16 (GDI.486)
1225 BOOL16 WINAPI
GetAspectRatioFilterEx16( HDC16 hdc
, LPSIZE16 pAspectRatio
)
1227 FIXME_(font
)("(%04x, %p): -- Empty Stub !\n",
1232 /***********************************************************************
1233 * GetAspectRatioFilterEx32 (GDI32.142)
1235 BOOL WINAPI
GetAspectRatioFilterEx( HDC hdc
, LPSIZE pAspectRatio
)
1237 FIXME_(font
)("(%04x, %p): -- Empty Stub !\n",
1242 /***********************************************************************
1243 * GetCharABCWidths16 (GDI.307)
1245 BOOL16 WINAPI
GetCharABCWidths16( HDC16 hdc
, UINT16 firstChar
, UINT16 lastChar
,
1249 if (!GetCharABCWidthsA( hdc
, firstChar
, lastChar
, &abc32
)) return FALSE
;
1250 abc
->abcA
= abc32
.abcA
;
1251 abc
->abcB
= abc32
.abcB
;
1252 abc
->abcC
= abc32
.abcC
;
1257 /***********************************************************************
1258 * GetCharABCWidths32A (GDI32.149)
1260 BOOL WINAPI
GetCharABCWidthsA(HDC hdc
, UINT firstChar
, UINT lastChar
,
1263 return GetCharABCWidthsW( hdc
, firstChar
, lastChar
, abc
);
1267 /******************************************************************************
1268 * GetCharABCWidths32W [GDI32.152] Retrieves widths of characters in range
1271 * hdc [I] Handle of device context
1272 * firstChar [I] First character in range to query
1273 * lastChar [I] Last character in range to query
1274 * abc [O] Address of character-width structure
1277 * Only works with TrueType fonts
1283 BOOL WINAPI
GetCharABCWidthsW( HDC hdc
, UINT firstChar
, UINT lastChar
,
1286 /* No TrueType fonts in Wine so far */
1287 FIXME_(font
)("(%04x,%04x,%04x,%p): stub\n", hdc
, firstChar
, lastChar
, abc
);
1292 /***********************************************************************
1293 * GetGlyphOutline16 (GDI.309)
1295 DWORD WINAPI
GetGlyphOutline16( HDC16 hdc
, UINT16 uChar
, UINT16 fuFormat
,
1296 LPGLYPHMETRICS16 lpgm
, DWORD cbBuffer
,
1297 LPVOID lpBuffer
, const MAT2
*lpmat2
)
1299 FIXME_(font
)("(%04x, '%c', %04x, %p, %ld, %p, %p): stub\n",
1300 hdc
, uChar
, fuFormat
, lpgm
, cbBuffer
, lpBuffer
, lpmat2
);
1301 return (DWORD
)-1; /* failure */
1305 /***********************************************************************
1306 * GetGlyphOutline32A (GDI32.186)
1308 DWORD WINAPI
GetGlyphOutlineA( HDC hdc
, UINT uChar
, UINT fuFormat
,
1309 LPGLYPHMETRICS lpgm
, DWORD cbBuffer
,
1310 LPVOID lpBuffer
, const MAT2
*lpmat2
)
1312 FIXME_(font
)("(%04x, '%c', %04x, %p, %ld, %p, %p): stub\n",
1313 hdc
, uChar
, fuFormat
, lpgm
, cbBuffer
, lpBuffer
, lpmat2
);
1314 return (DWORD
)-1; /* failure */
1317 /***********************************************************************
1318 * GetGlyphOutline32W (GDI32.187)
1320 DWORD WINAPI
GetGlyphOutlineW( HDC hdc
, UINT uChar
, UINT fuFormat
,
1321 LPGLYPHMETRICS lpgm
, DWORD cbBuffer
,
1322 LPVOID lpBuffer
, const MAT2
*lpmat2
)
1324 FIXME_(font
)("(%04x, '%c', %04x, %p, %ld, %p, %p): stub\n",
1325 hdc
, uChar
, fuFormat
, lpgm
, cbBuffer
, lpBuffer
, lpmat2
);
1326 return (DWORD
)-1; /* failure */
1329 /***********************************************************************
1330 * CreateScalableFontResource16 (GDI.310)
1332 BOOL16 WINAPI
CreateScalableFontResource16( UINT16 fHidden
,
1333 LPCSTR lpszResourceFile
,
1334 LPCSTR fontFile
, LPCSTR path
)
1336 return CreateScalableFontResourceA( fHidden
, lpszResourceFile
,
1340 /***********************************************************************
1341 * CreateScalableFontResource32A (GDI32.62)
1343 BOOL WINAPI
CreateScalableFontResourceA( DWORD fHidden
,
1344 LPCSTR lpszResourceFile
,
1345 LPCSTR lpszFontFile
,
1346 LPCSTR lpszCurrentPath
)
1348 /* fHidden=1 - only visible for the calling app, read-only, not
1349 * enumbered with EnumFonts/EnumFontFamilies
1350 * lpszCurrentPath can be NULL
1352 FIXME_(font
)("(%ld,%s,%s,%s): stub\n",
1353 fHidden
, lpszResourceFile
, lpszFontFile
, lpszCurrentPath
);
1354 return FALSE
; /* create failed */
1357 /***********************************************************************
1358 * CreateScalableFontResource32W (GDI32.63)
1360 BOOL WINAPI
CreateScalableFontResourceW( DWORD fHidden
,
1361 LPCWSTR lpszResourceFile
,
1362 LPCWSTR lpszFontFile
,
1363 LPCWSTR lpszCurrentPath
)
1365 FIXME_(font
)("(%ld,%p,%p,%p): stub\n",
1366 fHidden
, lpszResourceFile
, lpszFontFile
, lpszCurrentPath
);
1367 return FALSE
; /* create failed */
1371 /*************************************************************************
1372 * GetRasterizerCaps16 (GDI.313)
1374 BOOL16 WINAPI
GetRasterizerCaps16( LPRASTERIZER_STATUS lprs
, UINT16 cbNumBytes
)
1376 return GetRasterizerCaps( lprs
, cbNumBytes
);
1380 /*************************************************************************
1381 * GetRasterizerCaps32 (GDI32.216)
1383 BOOL WINAPI
GetRasterizerCaps( LPRASTERIZER_STATUS lprs
, UINT cbNumBytes
)
1385 lprs
->nSize
= sizeof(RASTERIZER_STATUS
);
1386 lprs
->wFlags
= TT_AVAILABLE
|TT_ENABLED
;
1387 lprs
->nLanguageID
= 0;
1392 /*************************************************************************
1393 * GetKerningPairs16 (GDI.332)
1395 INT16 WINAPI
GetKerningPairs16( HDC16 hDC
, INT16 cPairs
,
1396 LPKERNINGPAIR16 lpKerningPairs
)
1398 /* At this time kerning is ignored (set to 0) */
1400 FIXME_(font
)("(%x,%d,%p): almost empty stub!\n",
1401 hDC
, cPairs
, lpKerningPairs
);
1402 for (i
= 0; i
< cPairs
; i
++)
1403 lpKerningPairs
[i
].iKernAmount
= 0;
1409 /*************************************************************************
1410 * GetKerningPairs32A (GDI32.192)
1412 DWORD WINAPI
GetKerningPairsA( HDC hDC
, DWORD cPairs
,
1413 LPKERNINGPAIR lpKerningPairs
)
1416 FIXME_(font
)("(%x,%ld,%p): almost empty stub!\n",
1417 hDC
, cPairs
, lpKerningPairs
);
1418 for (i
= 0; i
< cPairs
; i
++)
1419 lpKerningPairs
[i
].iKernAmount
= 0;
1424 /*************************************************************************
1425 * GetKerningPairs32W (GDI32.193)
1427 DWORD WINAPI
GetKerningPairsW( HDC hDC
, DWORD cPairs
,
1428 LPKERNINGPAIR lpKerningPairs
)
1430 return GetKerningPairsA( hDC
, cPairs
, lpKerningPairs
);
1433 /*************************************************************************
1434 * TranslateCharsetInfo [GDI32.382]
1436 * Fills a CHARSETINFO structure for a character set, code page, or
1437 * font. This allows making the correspondance between different labelings
1438 * (character set, Windows, ANSI, and OEM codepages, and Unicode ranges)
1439 * of the same encoding.
1441 * Only one codepage will be set in lpCs->fs. If TCI_SRCFONTSIG is used,
1442 * only one codepage should be set in *lpSrc.
1445 * TRUE on success, FALSE on failure.
1448 BOOL WINAPI
TranslateCharsetInfo(
1450 if flags == TCI_SRCFONTSIG: pointer to fsCsb of a FONTSIGNATURE
1451 if flags == TCI_SRCCHARSET: a character set value
1452 if flags == TCI_SRCCODEPAGE: a code page value
1454 LPCHARSETINFO lpCs
, /* structure to receive charset information */
1455 DWORD flags
/* determines interpretation of lpSrc */
1459 case TCI_SRCFONTSIG
:
1460 while (!(*lpSrc
>>index
& 0x0001) && index
<MAXTCIINDEX
) index
++;
1462 case TCI_SRCCODEPAGE
:
1463 while ((UINT
) (lpSrc
) != FONT_tci
[index
].ciACP
&& index
< MAXTCIINDEX
) index
++;
1465 case TCI_SRCCHARSET
:
1466 while ((UINT
) (lpSrc
) != FONT_tci
[index
].ciCharset
&& index
< MAXTCIINDEX
) index
++;
1471 if (index
>= MAXTCIINDEX
|| FONT_tci
[index
].ciCharset
== DEFAULT_CHARSET
) return FALSE
;
1472 memcpy(lpCs
, &FONT_tci
[index
], sizeof(CHARSETINFO
));
1476 /*************************************************************************
1477 * GetFontLanguageInfo (GDI32.182)
1479 DWORD WINAPI
GetFontLanguageInfo(HDC hdc
) {
1480 /* return value 0 is correct for most cases anyway */
1481 FIXME_(font
)("(%x):stub!\n", hdc
);
1485 /*************************************************************************
1486 * GetFontLanguageInfo (GDI.616)
1488 DWORD WINAPI
GetFontLanguageInfo16(HDC16 hdc
) {
1489 /* return value 0 is correct for most cases anyway */
1490 FIXME_(font
)("(%x):stub!\n",hdc
);
1494 /*************************************************************************
1495 * GetFontData32 [GDI32.181] Retrieve data for TrueType font
1499 * success: Number of bytes returned
1500 * failure: GDI_ERROR
1504 * Calls SetLastError()
1510 DWORD WINAPI
GetFontData(HDC hdc
, DWORD table
, DWORD offset
,
1511 LPVOID buffer
, DWORD length
)
1513 FIXME_(font
)("(%x,%ld,%ld,%p,%ld): stub\n",
1514 hdc
, table
, offset
, buffer
, length
);
1515 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1519 /*************************************************************************
1520 * GetCharacterPlacement32A [GDI32.160]
1523 GetCharacterPlacementA(HDC hdc
, LPCSTR lpString
, INT uCount
,
1524 INT nMaxExtent
, GCP_RESULTSA
*lpResults
,
1527 /* return value 0 is correct for most cases anyway */
1528 FIXME_(font
)(":stub!\n");
1532 /*************************************************************************
1533 * GetCharacterPlacement32W [GDI32.161]
1536 GetCharacterPlacementW(HDC hdc
, LPCWSTR lpString
, INT uCount
,
1537 INT nMaxExtent
, GCP_RESULTSW
*lpResults
,
1540 /* return value 0 is correct for most cases anyway */
1541 FIXME_(font
)(":stub!\n");
1545 /*************************************************************************
1546 * GetCharABCWidthsFloat32A [GDI32.150]
1548 BOOL WINAPI
GetCharABCWidthsFloatA(HDC hdc
, UINT iFirstChar
, UINT iLastChar
,
1551 FIXME_(gdi
)("GetCharABCWidthsFloatA, stub\n");
1555 /*************************************************************************
1556 * GetCharABCWidthsFloat32W [GDI32.151]
1558 BOOL WINAPI
GetCharABCWidthsFloatW(HDC hdc
, UINT iFirstChar
,
1559 UINT iLastChar
, LPABCFLOAT lpABCF
)
1561 FIXME_(gdi
)("GetCharABCWidthsFloatW, stub\n");
1565 /*************************************************************************
1566 * GetCharWidthFloat32A [GDI32.156]
1568 BOOL WINAPI
GetCharWidthFloatA(HDC hdc
, UINT iFirstChar
,
1569 UINT iLastChar
, PFLOAT pxBuffer
)
1571 FIXME_(gdi
)("GetCharWidthFloatA, stub\n");
1575 /*************************************************************************
1576 * GetCharWidthFloat32W [GDI32.157]
1578 BOOL WINAPI
GetCharWidthFloatW(HDC hdc
, UINT iFirstChar
,
1579 UINT iLastChar
, PFLOAT pxBuffer
)
1581 FIXME_(gdi
)("GetCharWidthFloatW, stub\n");