… | |
… | |
7 | |
7 | |
8 | #include "EXTERN.h" |
8 | #include "EXTERN.h" |
9 | #include "perl.h" |
9 | #include "perl.h" |
10 | #include "XSUB.h" |
10 | #include "XSUB.h" |
11 | |
11 | |
|
|
12 | #include <math.h> |
12 | #include <string.h> |
13 | #include <string.h> |
13 | #include <stdio.h> |
14 | #include <stdio.h> |
14 | |
15 | |
15 | #include <SDL.h> |
16 | #include <SDL.h> |
16 | #include <SDL_endian.h> |
17 | #include <SDL_endian.h> |
… | |
… | |
83 | |
84 | |
84 | static void |
85 | static void |
85 | substitute_func (FcPattern *pattern, gpointer data) |
86 | substitute_func (FcPattern *pattern, gpointer data) |
86 | { |
87 | { |
87 | FcPatternAddBool (pattern, FC_HINTING , 1); |
88 | FcPatternAddBool (pattern, FC_HINTING , 1); |
|
|
89 | #ifdef _WIN32 |
88 | FcPatternAddBool (pattern, FC_AUTOHINT, 1); |
90 | FcPatternAddBool (pattern, FC_AUTOHINT, 1); |
|
|
91 | #else |
|
|
92 | FcPatternAddBool (pattern, FC_AUTOHINT, 0); |
|
|
93 | #endif |
89 | } |
94 | } |
90 | |
95 | |
91 | static void |
96 | static void |
92 | layout_update_font (CFClient__Layout self) |
97 | layout_update_font (CFClient__Layout self) |
93 | { |
98 | { |
… | |
… | |
798 | set_width (CFClient::Layout self, int max_width = -1) |
803 | set_width (CFClient::Layout self, int max_width = -1) |
799 | CODE: |
804 | CODE: |
800 | pango_layout_set_width (self->pl, max_width < 0 ? max_width : max_width * PANGO_SCALE); |
805 | pango_layout_set_width (self->pl, max_width < 0 ? max_width : max_width * PANGO_SCALE); |
801 | |
806 | |
802 | void |
807 | void |
|
|
808 | set_indent (CFClient::Layout self, int indent) |
|
|
809 | CODE: |
|
|
810 | pango_layout_set_indent (self->pl, indent * PANGO_SCALE); |
|
|
811 | |
|
|
812 | void |
|
|
813 | set_spacing (CFClient::Layout self, int spacing) |
|
|
814 | CODE: |
|
|
815 | pango_layout_set_spacing (self->pl, spacing * PANGO_SCALE); |
|
|
816 | |
|
|
817 | void |
|
|
818 | set_ellipsise (CFClient::Layout self, int ellipsise) |
|
|
819 | CODE: |
|
|
820 | pango_layout_set_ellipsize (self->pl, |
|
|
821 | ellipsise == 1 ? PANGO_ELLIPSIZE_START |
|
|
822 | : ellipsise == 2 ? PANGO_ELLIPSIZE_MIDDLE |
|
|
823 | : ellipsise == 3 ? PANGO_ELLIPSIZE_END |
|
|
824 | : PANGO_ELLIPSIZE_NONE |
|
|
825 | ); |
|
|
826 | |
|
|
827 | void |
|
|
828 | set_single_paragraph_mode (CFClient::Layout self, int spm) |
|
|
829 | CODE: |
|
|
830 | pango_layout_set_single_paragraph_mode (self->pl, !!spm); |
|
|
831 | |
|
|
832 | void |
803 | size (CFClient::Layout self) |
833 | size (CFClient::Layout self) |
804 | PPCODE: |
834 | PPCODE: |
805 | { |
835 | { |
806 | int w, h; |
836 | int w, h; |
807 | |
837 | |
… | |
… | |
1589 | void glEnd () |
1619 | void glEnd () |
1590 | |
1620 | |
1591 | void glColor (float r, float g, float b, float a = 1.0) |
1621 | void glColor (float r, float g, float b, float a = 1.0) |
1592 | PROTOTYPE: @ |
1622 | PROTOTYPE: @ |
1593 | CODE: |
1623 | CODE: |
1594 | // 255.999 is close enough to correctness (256 and clamp) |
1624 | glColor4ub (MIN ((int)(r * 255.f), 255), |
1595 | glColor4ub (r * 255.999, g * 255.999, b * 255.999, a * 255.999); |
1625 | MIN ((int)(g * 255.f), 255), |
|
|
1626 | MIN ((int)(b * 255.f), 255), |
|
|
1627 | MIN ((int)(a * 255.f), 255)); |
1596 | |
1628 | |
1597 | void glVertex (float x, float y, float z = 0.) |
1629 | void glVertex (float x, float y, float z = 0.) |
1598 | CODE: |
1630 | CODE: |
1599 | glVertex3f (x, y, z); |
1631 | glVertex3f (x, y, z); |
1600 | |
1632 | |