1 /* { dg-xfail-if "cast to pointer of different size" { "avr-*-*" x86_64-*-mingw* } } */
2 typedef struct HDC__
{ int unused
; } *HDC
;
3 typedef struct HFONT__
{ int unused
; } *HFONT
;
8 } CHARSETINFO
, *PCHARSETINFO
, *LPCHARSETINFO
;
10 typedef struct tagTEXTMETRICW
13 } TEXTMETRICW
, *LPTEXTMETRICW
, *PTEXTMETRICW
;
17 void* (*pSelectObject
)( void* handle
, void* hdc
);
20 typedef struct tagGdiFont GdiFont
;
26 unsigned int font_code_page
;
29 extern GdiFont
* WineEngCreateFontInstance(DC
*, HFONT
);
30 extern unsigned int WineEngGetTextCharsetInfo(GdiFont
*font
, void* fs
, unsigned int flags
);
31 extern int WineEngGetTextMetrics(GdiFont
*, LPTEXTMETRICW
);
32 extern void* alloc_gdi_handle( void *obj
, unsigned short type
, const struct gdi_obj_funcs
*funcs
);
34 enum __wine_debug_class
44 struct __wine_debug_channel
50 extern int wine_dbg_log( enum __wine_debug_class cls
, struct __wine_debug_channel
*ch
, const char *func
,
51 const char *format
, ... ) __attribute__((format (printf
,4,5)));
53 static struct __wine_debug_channel __wine_dbch_font
= { ~0, "font" };
54 static struct __wine_debug_channel
* const __wine_dbch___default
= &__wine_dbch_font
;
56 static void* FONT_SelectObject( void* handle
, void* hdc
);
57 int TranslateCharsetInfo( void *, CHARSETINFO
*, int );
58 unsigned int GetACP (void);
60 static const struct gdi_obj_funcs font_funcs
=
65 HFONT
CreateFontIndirectW( const void *plf
)
67 return alloc_gdi_handle( 0, 6, &font_funcs
);
70 static void update_font_code_page( DC
*dc
)
73 int charset
= (unsigned char)1;
76 charset
= WineEngGetTextCharsetInfo( dc
->gdiFont
, ((void *)0), 0 );
78 if (TranslateCharsetInfo( ((void *)(unsigned long)((unsigned long)charset
)), &csi
, 1) )
79 dc
->font_code_page
= csi
.ciACP
;
82 case (unsigned char)1:
83 dc
->font_code_page
= GetACP();
86 case (unsigned char)246:
87 dc
->font_code_page
= 0;
91 do { if((((__wine_dbch___default
))->flags
& (1 << __WINE_DBCL_FIXME
))) { struct __wine_debug_channel
* const __dbch
= (__wine_dbch___default
); const enum __wine_debug_class __dbcl
= __WINE_DBCL_FIXME
; wine_dbg_log( __dbcl
, __dbch
, __FUNCTION__
, "Can't find codepage for charset %d\n", charset
); } } while(0);
92 dc
->font_code_page
= 0;
97 do { if((((__wine_dbch___default
))->flags
& (1 << __WINE_DBCL_TRACE
))) { struct __wine_debug_channel
* const __dbch
= (__wine_dbch___default
); const enum __wine_debug_class __dbcl
= __WINE_DBCL_TRACE
; wine_dbg_log( __dbcl
, __dbch
, __FUNCTION__
, "charset %d => cp %d\n", charset
, dc
->font_code_page
); } } while(0);
100 static void* FONT_SelectObject( void* handle
, void* hdc
)
104 dc
->gdiFont
= WineEngCreateFontInstance( dc
, handle
);
105 update_font_code_page( dc
);
109 int GetTextMetricsW( HDC hdc
, TEXTMETRICW
*metrics
)
112 return WineEngGetTextMetrics(dc
->gdiFont
, metrics
);