1 typedef struct HDC__ { int unused; } *HDC;
2 typedef struct HFONT__ { int unused; } *HFONT;
7 } CHARSETINFO, *PCHARSETINFO, *LPCHARSETINFO;
9 typedef struct tagTEXTMETRICW
12 } TEXTMETRICW, *LPTEXTMETRICW, *PTEXTMETRICW;
16 void* (*pSelectObject)( void* handle, void* hdc );
19 typedef struct tagGdiFont GdiFont;
25 unsigned int font_code_page;
28 extern GdiFont* WineEngCreateFontInstance(DC*, HFONT);
29 extern unsigned int WineEngGetTextCharsetInfo(GdiFont *font, void* fs, unsigned int flags);
30 extern int WineEngGetTextMetrics(GdiFont*, LPTEXTMETRICW);
31 extern void* alloc_gdi_handle( void *obj, unsigned short type, const struct gdi_obj_funcs *funcs );
33 enum __wine_debug_class
43 struct __wine_debug_channel
49 extern int wine_dbg_log( enum __wine_debug_class cls, struct __wine_debug_channel *ch, const char *func,
50 const char *format, ... ) __attribute__((format (printf,4,5)));
52 static struct __wine_debug_channel __wine_dbch_font = { ~0, "font" };
53 static struct __wine_debug_channel * const __wine_dbch___default = &__wine_dbch_font;
55 static void* FONT_SelectObject( void* handle, void* hdc );
57 static const struct gdi_obj_funcs font_funcs =
62 HFONT CreateFontIndirectW( const void *plf )
64 return alloc_gdi_handle( 0, 6, &font_funcs );
67 static void update_font_code_page( DC *dc )
70 int charset = (unsigned char)1;
73 charset = WineEngGetTextCharsetInfo( dc->gdiFont, ((void *)0), 0 );
75 if (TranslateCharsetInfo( ((void *)(unsigned long)((unsigned long)charset)), &csi, 1) )
76 dc->font_code_page = csi.ciACP;
79 case (unsigned char)1:
80 dc->font_code_page = GetACP();
83 case (unsigned char)246:
84 dc->font_code_page = 0;
88 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);
89 dc->font_code_page = 0;
94 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);
97 static void* FONT_SelectObject( void* handle, void* hdc )
101 dc->gdiFont = WineEngCreateFontInstance( dc, handle );
102 update_font_code_page( dc );
106 int GetTextMetricsW( HDC hdc, TEXTMETRICW *metrics )
109 return WineEngGetTextMetrics(dc->gdiFont, metrics);