… | |
… | |
86 | |
86 | |
87 | static void |
87 | static void |
88 | substitute_func (FcPattern *pattern, gpointer data) |
88 | substitute_func (FcPattern *pattern, gpointer data) |
89 | { |
89 | { |
90 | FcPatternAddBool (pattern, FC_HINTING , 1); |
90 | FcPatternAddBool (pattern, FC_HINTING , 1); |
91 | #ifdef _WIN32 |
|
|
92 | FcPatternAddBool (pattern, FC_AUTOHINT, 1); |
91 | //FcPatternAddBool (pattern, FC_AUTOHINT, 1); |
93 | #else |
|
|
94 | FcPatternAddBool (pattern, FC_AUTOHINT, 0); |
92 | FcPatternAddBool (pattern, FC_AUTOHINT, 0); |
95 | #endif |
|
|
96 | } |
93 | } |
97 | |
94 | |
98 | static void |
95 | static void |
99 | layout_update_font (CFClient__Layout self) |
96 | layout_update_font (CFClient__Layout self) |
100 | { |
97 | { |
… | |
… | |
418 | } |
415 | } |
419 | |
416 | |
420 | void |
417 | void |
421 | pango_init () |
418 | pango_init () |
422 | CODE: |
419 | CODE: |
423 | { |
|
|
424 | // delayed, so it can pick up new fonts added by AddFontResourceEx |
420 | // delayed, so it can pick up new fonts added by AddFontResourceEx |
|
|
421 | { |
|
|
422 | { |
425 | ft2_fontmap = pango_ft2_font_map_new (); |
423 | ft2_fontmap = pango_ft2_font_map_new (); |
426 | pango_ft2_font_map_set_default_substitute ((PangoFT2FontMap *)ft2_fontmap, substitute_func, 0, 0); |
424 | 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); |
425 | ft2_context = pango_ft2_font_map_create_context ((PangoFT2FontMap *)ft2_fontmap); |
|
|
426 | } |
428 | |
427 | |
|
|
428 | { |
|
|
429 | cairo_font_options_t *fopt = cairo_font_options_create (); |
429 | cairo_fontmap = pango_cairo_font_map_get_default (); |
430 | cairo_fontmap = pango_cairo_font_map_get_default (); |
430 | cairo_context = pango_cairo_font_map_create_context ((PangoCairoFontMap *)cairo_fontmap); |
431 | cairo_context = pango_cairo_font_map_create_context ((PangoCairoFontMap *)cairo_fontmap); |
|
|
432 | cairo_font_options_set_antialias (fopt, CAIRO_ANTIALIAS_GRAY); |
|
|
433 | cairo_font_options_set_hint_style (fopt, CAIRO_HINT_STYLE_FULL); |
|
|
434 | cairo_font_options_set_hint_metrics (fopt, CAIRO_HINT_METRICS_ON); |
|
|
435 | pango_cairo_context_set_font_options (cairo_context, fopt); |
|
|
436 | cairo_font_options_destroy (fopt); |
|
|
437 | } |
431 | } |
438 | } |
432 | |
439 | |
433 | int |
440 | int |
434 | SDL_Init (U32 flags = SDL_INIT_VIDEO | SDL_INIT_AUDIO) |
441 | SDL_Init (U32 flags = SDL_INIT_VIDEO | SDL_INIT_AUDIO) |
435 | |
442 | |
… | |
… | |
720 | new (SV *class, int rgba = 0) |
727 | new (SV *class, int rgba = 0) |
721 | CODE: |
728 | CODE: |
722 | #if _WIN32 |
729 | #if _WIN32 |
723 | //rgba = 0;//D makes text nicer, breaks TextView |
730 | //rgba = 0;//D makes text nicer, breaks TextView |
724 | #endif |
731 | #endif |
|
|
732 | rgba=1;//D |
725 | New (0, RETVAL, 1, struct cf_layout); |
733 | New (0, RETVAL, 1, struct cf_layout); |
726 | |
734 | |
727 | RETVAL->pl = pango_layout_new (rgba ? cairo_context : ft2_context); |
735 | RETVAL->pl = pango_layout_new (rgba ? cairo_context : ft2_context); |
728 | RETVAL->rgba = rgba; |
736 | RETVAL->rgba = rgba; |
729 | RETVAL->r = 1.; |
737 | RETVAL->r = 1.; |
… | |
… | |
990 | |
998 | |
991 | if (ix == 2) |
999 | if (ix == 2) |
992 | glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
1000 | glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
993 | else |
1001 | else |
994 | gl_BlendFuncSeparate (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, |
1002 | gl_BlendFuncSeparate (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, |
995 | GL_ONE_MINUS_DST_ALPHA, GL_ONE); |
1003 | GL_ONE , GL_ONE_MINUS_SRC_ALPHA); |
996 | |
1004 | |
997 | glEnable (GL_ALPHA_TEST); |
1005 | glEnable (GL_ALPHA_TEST); |
998 | glAlphaFunc (GL_GREATER, 0.01f); |
1006 | glAlphaFunc (GL_GREATER, 0.01f); |
999 | } |
1007 | } |
1000 | |
1008 | |
… | |
… | |
1557 | const_iv (GL_RESCALE_NORMAL), |
1565 | const_iv (GL_RESCALE_NORMAL), |
1558 | const_iv (GL_AND), |
1566 | const_iv (GL_AND), |
1559 | const_iv (GL_ONE), |
1567 | const_iv (GL_ONE), |
1560 | const_iv (GL_ZERO), |
1568 | const_iv (GL_ZERO), |
1561 | const_iv (GL_SRC_ALPHA), |
1569 | const_iv (GL_SRC_ALPHA), |
1562 | const_iv (GL_SRC_ALPHA_SATURATE), |
1570 | const_iv (GL_DST_ALPHA), |
1563 | const_iv (GL_ONE_MINUS_SRC_ALPHA), |
1571 | const_iv (GL_ONE_MINUS_SRC_ALPHA), |
1564 | const_iv (GL_ONE_MINUS_DST_ALPHA), |
1572 | const_iv (GL_ONE_MINUS_DST_ALPHA), |
|
|
1573 | const_iv (GL_SRC_ALPHA_SATURATE), |
1565 | const_iv (GL_RGB), |
1574 | const_iv (GL_RGB), |
1566 | const_iv (GL_RGBA), |
1575 | const_iv (GL_RGBA), |
1567 | const_iv (GL_UNSIGNED_BYTE), |
1576 | const_iv (GL_UNSIGNED_BYTE), |
1568 | const_iv (GL_UNSIGNED_SHORT), |
1577 | const_iv (GL_UNSIGNED_SHORT), |
1569 | const_iv (GL_UNSIGNED_INT), |
1578 | const_iv (GL_UNSIGNED_INT), |