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.18 by root, Tue Apr 11 19:31:17 2006 UTC vs.
Revision 1.22 by root, Wed Apr 12 20:06:36 2006 UTC

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/pangofc-fontmap.h>
12#include <pango/pangoft2.h> 12#include <pango/pangoft2.h>
13
14#include <sys/time.h>
15#include <sys/types.h>
16#include <unistd.h>
13 17
14#include <sys/types.h> 18#include <sys/types.h>
15#include <sys/socket.h> 19#include <sys/socket.h>
16#include <netinet/in.h> 20#include <netinet/in.h>
17#include <netinet/tcp.h> 21#include <netinet/tcp.h>
23 PangoLayout *pl; 27 PangoLayout *pl;
24 int base_height; 28 int base_height;
25} *CFClient__Layout; 29} *CFClient__Layout;
26 30
27static void 31static void
32substitute_func (FcPattern *pattern, gpointer data)
33{
34 FcPatternAddBool (pattern, FC_HINTING , 1);
35 FcPatternAddBool (pattern, FC_AUTOHINT, 1);
36}
37
38static void
28layout_update (CFClient__Layout self) 39layout_update (CFClient__Layout self)
29{ 40{
41 /* use a random scale factor to account for unknown descenders, 0.8 works
42 * reasonably well with bitstream vera
43 */
30 PangoFontDescription *font = pango_context_get_font_description (context); 44 PangoFontDescription *font = pango_context_get_font_description (context);
31 pango_font_description_set_absolute_size (font, self->base_height * PANGO_SCALE); 45 pango_font_description_set_absolute_size (font, self->base_height * (PANGO_SCALE * 8 / 10));
32} 46}
33 47
34static void 48static void
35layout_get_pixel_size (CFClient__Layout self, int *w, int *h) 49layout_get_pixel_size (CFClient__Layout self, int *w, int *h)
36{ 50{
37 PangoFontDescription *font = pango_context_get_font_description (context); 51 layout_update (self);
38 pango_font_description_set_absolute_size (font, self->base_height * PANGO_SCALE);
39 52
40 pango_layout_get_pixel_size (self->pl, w, h); 53 pango_layout_get_pixel_size (self->pl, w, h);
41 54
42 *w = (*w + 3) & ~3; 55 *w = (*w + 3) & ~3;
43 if (!*w) *w = 1; 56 if (!*w) *w = 1;
49PROTOTYPES: ENABLE 62PROTOTYPES: ENABLE
50 63
51BOOT: 64BOOT:
52{ 65{
53 fontmap = pango_ft2_font_map_new (); 66 fontmap = pango_ft2_font_map_new ();
67 pango_ft2_font_map_set_default_substitute ((PangoFT2FontMap *)fontmap, substitute_func, 0, 0);
54 context = pango_ft2_font_map_create_context ((PangoFT2FontMap *)fontmap); 68 context = pango_ft2_font_map_create_context ((PangoFT2FontMap *)fontmap);
55} 69}
56 70
57void 71void
58lowdelay (int fd, int val = 1) 72lowdelay (int fd, int val = 1)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines