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