ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/Client.xs
(Generate patch)

Comparing deliantra/Deliantra-Client/Client.xs (file contents):
Revision 1.103 by root, Sun Jun 4 23:05:05 2006 UTC vs.
Revision 1.108 by root, Wed Jun 7 23:28:12 2006 UTC

85static PangoFontMap *ft2_fontmap, *cairo_fontmap; 85static PangoFontMap *ft2_fontmap, *cairo_fontmap;
86 86
87static void 87static void
88substitute_func (FcPattern *pattern, gpointer data) 88substitute_func (FcPattern *pattern, gpointer data)
89{ 89{
90 FcPatternAddBool (pattern, FC_HINTING , 1); 90 FcPatternAddBool (pattern, FC_HINTING, 1);
91 FcPatternAddBool (pattern, FC_HINTSTYLE, FC_HINT_FULL);
91#ifdef _WIN32 92#ifdef _WIN32
92 FcPatternAddBool (pattern, FC_AUTOHINT, 1); 93 FcPatternAddBool (pattern, FC_AUTOHINT, 1);
93#else 94#else
94 FcPatternAddBool (pattern, FC_AUTOHINT, 0); 95 FcPatternAddBool (pattern, FC_AUTOHINT, 0);
95#endif 96#endif
418} 419}
419 420
420void 421void
421pango_init () 422pango_init ()
422 CODE: 423 CODE:
423{
424 // delayed, so it can pick up new fonts added by AddFontResourceEx 424 // delayed, so it can pick up new fonts added by AddFontResourceEx
425{
426 {
425 ft2_fontmap = pango_ft2_font_map_new (); 427 ft2_fontmap = pango_ft2_font_map_new ();
426 pango_ft2_font_map_set_default_substitute ((PangoFT2FontMap *)ft2_fontmap, substitute_func, 0, 0); 428 pango_ft2_font_map_set_default_substitute ((PangoFT2FontMap *)ft2_fontmap, substitute_func, 0, 0);
427 ft2_context = pango_ft2_font_map_create_context ((PangoFT2FontMap *)ft2_fontmap); 429 ft2_context = pango_ft2_font_map_create_context ((PangoFT2FontMap *)ft2_fontmap);
428 430 }
431 {
432 cairo_font_options_t *fopt = cairo_font_options_create ();
429 cairo_fontmap = pango_cairo_font_map_get_default (); 433 cairo_fontmap = pango_cairo_font_map_get_default ();
430 cairo_context = pango_cairo_font_map_create_context ((PangoCairoFontMap *)cairo_fontmap); 434 cairo_context = pango_cairo_font_map_create_context ((PangoCairoFontMap *)cairo_fontmap);
435#ifdef _WIN32
436 // cairo looks like shit eaten twice on windows
437 cairo_font_options_set_antialias (fopt, CAIRO_ANTIALIAS_NONE);
438#else
439 cairo_font_options_set_antialias (fopt, CAIRO_ANTIALIAS_GRAY);
440#endif
441 cairo_font_options_set_hint_style (fopt, CAIRO_HINT_STYLE_FULL);
442 cairo_font_options_set_hint_metrics (fopt, CAIRO_HINT_METRICS_ON);
443 pango_cairo_context_set_font_options (cairo_context, fopt);
444 cairo_font_options_destroy (fopt);
445 }
431} 446}
432 447
433int 448int
434SDL_Init (U32 flags = SDL_INIT_VIDEO | SDL_INIT_AUDIO) 449SDL_Init (U32 flags = SDL_INIT_VIDEO | SDL_INIT_AUDIO)
435 450
717MODULE = CFClient PACKAGE = CFClient::Layout 732MODULE = CFClient PACKAGE = CFClient::Layout
718 733
719CFClient::Layout 734CFClient::Layout
720new (SV *class, int rgba = 0) 735new (SV *class, int rgba = 0)
721 CODE: 736 CODE:
722#if _WIN32
723 //rgba = 0;//D makes text nicer, breaks TextView
724#endif
725 New (0, RETVAL, 1, struct cf_layout); 737 New (0, RETVAL, 1, struct cf_layout);
726 738
727 RETVAL->pl = pango_layout_new (rgba ? cairo_context : ft2_context); 739 RETVAL->pl = pango_layout_new (rgba ? cairo_context : ft2_context);
728 RETVAL->rgba = rgba; 740 RETVAL->rgba = rgba;
729 RETVAL->r = 1.; 741 RETVAL->r = 1.;
773 785
774SV * 786SV *
775get_text (CFClient::Layout self) 787get_text (CFClient::Layout self)
776 CODE: 788 CODE:
777 RETVAL = newSVpv (pango_layout_get_text (self->pl), 0); 789 RETVAL = newSVpv (pango_layout_get_text (self->pl), 0);
778 SvUTF8_on (RETVAL); 790 sv_utf8_decode (RETVAL);
779 OUTPUT: 791 OUTPUT:
780 RETVAL 792 RETVAL
781 793
782void 794void
783set_foreground (CFClient::Layout self, float r, float g, float b, float a = 1.) 795set_foreground (CFClient::Layout self, float r, float g, float b, float a = 1.)
990 1002
991 if (ix == 2) 1003 if (ix == 2)
992 glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); 1004 glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
993 else 1005 else
994 gl_BlendFuncSeparate (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, 1006 gl_BlendFuncSeparate (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA,
995 GL_ONE_MINUS_DST_ALPHA, GL_ONE); 1007 GL_ONE , GL_ONE_MINUS_SRC_ALPHA);
996 1008
997 glEnable (GL_ALPHA_TEST); 1009 glEnable (GL_ALPHA_TEST);
998 glAlphaFunc (GL_GREATER, 0.01f); 1010 glAlphaFunc (GL_GREATER, 0.01f);
999 } 1011 }
1000 1012
1557 const_iv (GL_RESCALE_NORMAL), 1569 const_iv (GL_RESCALE_NORMAL),
1558 const_iv (GL_AND), 1570 const_iv (GL_AND),
1559 const_iv (GL_ONE), 1571 const_iv (GL_ONE),
1560 const_iv (GL_ZERO), 1572 const_iv (GL_ZERO),
1561 const_iv (GL_SRC_ALPHA), 1573 const_iv (GL_SRC_ALPHA),
1562 const_iv (GL_SRC_ALPHA_SATURATE), 1574 const_iv (GL_DST_ALPHA),
1563 const_iv (GL_ONE_MINUS_SRC_ALPHA), 1575 const_iv (GL_ONE_MINUS_SRC_ALPHA),
1564 const_iv (GL_ONE_MINUS_DST_ALPHA), 1576 const_iv (GL_ONE_MINUS_DST_ALPHA),
1577 const_iv (GL_SRC_ALPHA_SATURATE),
1565 const_iv (GL_RGB), 1578 const_iv (GL_RGB),
1566 const_iv (GL_RGBA), 1579 const_iv (GL_RGBA),
1567 const_iv (GL_UNSIGNED_BYTE), 1580 const_iv (GL_UNSIGNED_BYTE),
1568 const_iv (GL_UNSIGNED_SHORT), 1581 const_iv (GL_UNSIGNED_SHORT),
1569 const_iv (GL_UNSIGNED_INT), 1582 const_iv (GL_UNSIGNED_INT),

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines