--- deliantra/Deliantra-Client/Client.xs 2006/06/05 00:17:47 1.104 +++ deliantra/Deliantra-Client/Client.xs 2006/06/12 13:26:14 1.111 @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -87,7 +88,10 @@ static void substitute_func (FcPattern *pattern, gpointer data) { - FcPatternAddBool (pattern, FC_HINTING , 1); + FcPatternAddBool (pattern, FC_HINTING, 1); +#ifdef FC_HINT_STYLE + FcPatternAddBool (pattern, FC_HINT_STYLE, FC_HINT_FULL); +#endif #ifdef _WIN32 FcPatternAddBool (pattern, FC_AUTOHINT, 1); #else @@ -420,14 +424,28 @@ void pango_init () CODE: -{ // delayed, so it can pick up new fonts added by AddFontResourceEx - ft2_fontmap = pango_ft2_font_map_new (); - pango_ft2_font_map_set_default_substitute ((PangoFT2FontMap *)ft2_fontmap, substitute_func, 0, 0); - ft2_context = pango_ft2_font_map_create_context ((PangoFT2FontMap *)ft2_fontmap); - - cairo_fontmap = pango_cairo_font_map_get_default (); - cairo_context = pango_cairo_font_map_create_context ((PangoCairoFontMap *)cairo_fontmap); +{ + { + ft2_fontmap = pango_ft2_font_map_new (); + pango_ft2_font_map_set_default_substitute ((PangoFT2FontMap *)ft2_fontmap, substitute_func, 0, 0); + ft2_context = pango_ft2_font_map_create_context ((PangoFT2FontMap *)ft2_fontmap); + } + { + cairo_font_options_t *fopt = cairo_font_options_create (); + cairo_fontmap = pango_cairo_font_map_get_default (); + cairo_context = pango_cairo_font_map_create_context ((PangoCairoFontMap *)cairo_fontmap); +#ifdef _WIN32 + // cairo looks like shit eaten twice on windows + cairo_font_options_set_antialias (fopt, CAIRO_ANTIALIAS_NONE); +#else + cairo_font_options_set_antialias (fopt, CAIRO_ANTIALIAS_GRAY); +#endif + cairo_font_options_set_hint_style (fopt, CAIRO_HINT_STYLE_FULL); + cairo_font_options_set_hint_metrics (fopt, CAIRO_HINT_METRICS_ON); + pango_cairo_context_set_font_options (cairo_context, fopt); + cairo_font_options_destroy (fopt); + } } int @@ -688,7 +706,12 @@ #ifdef _WIN32 MessageBox (0, message, "Crossfire+ Fatal Error", MB_OK | MB_ICONERROR); #endif - exit (1); + _Exit (1); + +void +_exit (int retval) + CODE: + _Exit (retval); MODULE = CFClient PACKAGE = CFClient::Font @@ -719,10 +742,6 @@ CFClient::Layout new (SV *class, int rgba = 0) CODE: -#if _WIN32 - //rgba = 0;//D makes text nicer, breaks TextView -#endif - rgba=1;//D New (0, RETVAL, 1, struct cf_layout); RETVAL->pl = pango_layout_new (rgba ? cairo_context : ft2_context); @@ -776,7 +795,7 @@ get_text (CFClient::Layout self) CODE: RETVAL = newSVpv (pango_layout_get_text (self->pl), 0); - SvUTF8_on (RETVAL); + sv_utf8_decode (RETVAL); OUTPUT: RETVAL @@ -1042,6 +1061,7 @@ { map_clear (self); Safefree (self->face); + Safefree (self->tex); Safefree (self); }