… | |
… | |
6 | |
6 | |
7 | #include <SDL.h> |
7 | #include <SDL.h> |
8 | #include <SDL_opengl.h> |
8 | #include <SDL_opengl.h> |
9 | |
9 | |
10 | #include <pango/pango.h> |
10 | #include <pango/pango.h> |
|
|
11 | #include <pango/pangofc-fontmap.h> |
11 | #include <pango/pangoft2.h> |
12 | #include <pango/pangoft2.h> |
|
|
13 | |
|
|
14 | #include <sys/types.h> |
|
|
15 | #include <sys/socket.h> |
|
|
16 | #include <netinet/in.h> |
|
|
17 | #include <netinet/tcp.h> |
12 | |
18 | |
13 | static PangoContext *context; |
19 | static PangoContext *context; |
14 | static PangoFontMap *fontmap; |
20 | static PangoFontMap *fontmap; |
15 | |
21 | |
16 | MODULE = Crossfire::Client PACKAGE = Crossfire::Client |
22 | MODULE = Crossfire::Client PACKAGE = Crossfire::Client |
… | |
… | |
18 | BOOT: |
24 | BOOT: |
19 | { |
25 | { |
20 | fontmap = pango_ft2_font_map_new (); |
26 | fontmap = pango_ft2_font_map_new (); |
21 | context = pango_ft2_font_map_create_context ((PangoFT2FontMap *)fontmap); |
27 | context = pango_ft2_font_map_create_context ((PangoFT2FontMap *)fontmap); |
22 | } |
28 | } |
|
|
29 | |
|
|
30 | void |
|
|
31 | lowdelay (int fd, int val = 1) |
|
|
32 | CODE: |
|
|
33 | setsockopt (fd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof (val)); |
23 | |
34 | |
24 | char * |
35 | char * |
25 | gl_version () |
36 | gl_version () |
26 | CODE: |
37 | CODE: |
27 | RETVAL = (char *)glGetString (GL_VERSION); |
38 | RETVAL = (char *)glGetString (GL_VERSION); |
… | |
… | |
34 | RETVAL = (char *)glGetString (GL_EXTENSIONS); |
45 | RETVAL = (char *)glGetString (GL_EXTENSIONS); |
35 | OUTPUT: |
46 | OUTPUT: |
36 | RETVAL |
47 | RETVAL |
37 | |
48 | |
38 | void |
49 | void |
39 | add_font (char *file) |
50 | set_font (char *file) |
40 | CODE: |
51 | CODE: |
41 | FcConfigAppFontAddFile (0, (const FcChar8 *)file); |
|
|
42 | |
|
|
43 | void |
|
|
44 | set_font (char *pango_font) |
|
|
45 | CODE: |
|
|
46 | { |
52 | { |
|
|
53 | int count; |
|
|
54 | FcPattern *pattern = FcFreeTypeQuery ((const FcChar8 *)file, 0, 0, &count); |
|
|
55 | FcConfigAppFontAddFile (0, (const FcChar8 *)file); /* no idea wether this is required */ |
47 | PangoFontDescription *font = pango_font_description_from_string (pango_font); |
56 | PangoFontDescription *font = pango_fc_font_description_from_pattern (pattern, 0); |
|
|
57 | FcPatternDestroy (pattern); |
48 | pango_context_set_font_description (context, font); |
58 | pango_context_set_font_description (context, font); |
49 | } |
59 | } |
50 | |
60 | |
51 | void |
61 | void |
52 | font_render (SV *text_, int height = 10) |
62 | font_render (SV *text_, int height = 10) |