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.17 by root, Tue Apr 11 17:02:35 2006 UTC vs.
Revision 1.21 by root, Wed Apr 12 18:09:21 2006 UTC

23 PangoLayout *pl; 23 PangoLayout *pl;
24 int base_height; 24 int base_height;
25} *CFClient__Layout; 25} *CFClient__Layout;
26 26
27static void 27static void
28substitute_func (FcPattern *pattern, gpointer data)
29{
30 FcPatternAddBool (pattern, FC_HINTING , 1);
31 FcPatternAddBool (pattern, FC_AUTOHINT, 1);
32}
33
34static void
28layout_update (CFClient__Layout self) 35layout_update (CFClient__Layout self)
29{ 36{
37 /* use a random scale factor to account for unknown descenders, 0.8 works
38 * reasonably well with bitstream vera
39 */
30 PangoFontDescription *font = pango_context_get_font_description (context); 40 PangoFontDescription *font = pango_context_get_font_description (context);
31 pango_font_description_set_absolute_size (font, self->base_height * PANGO_SCALE); 41 pango_font_description_set_absolute_size (font, self->base_height * (PANGO_SCALE * 8 / 10));
32} 42}
33 43
34static void 44static void
35layout_get_pixel_size (CFClient__Layout self, int *w, int *h) 45layout_get_pixel_size (CFClient__Layout self, int *w, int *h)
36{ 46{
37 PangoFontDescription *font = pango_context_get_font_description (context); 47 layout_update (self);
38 pango_font_description_set_absolute_size (font, self->base_height * PANGO_SCALE);
39 48
40 pango_layout_get_pixel_size (self->pl, w, h); 49 pango_layout_get_pixel_size (self->pl, w, h);
41 50
42 *w = (*w + 3) & ~3; 51 *w = (*w + 3) & ~3;
43 if (!*w) *w = 1; 52 if (!*w) *w = 1;
49PROTOTYPES: ENABLE 58PROTOTYPES: ENABLE
50 59
51BOOT: 60BOOT:
52{ 61{
53 fontmap = pango_ft2_font_map_new (); 62 fontmap = pango_ft2_font_map_new ();
63 pango_ft2_font_map_set_default_substitute ((PangoFT2FontMap *)fontmap, substitute_func, 0, 0);
54 context = pango_ft2_font_map_create_context ((PangoFT2FontMap *)fontmap); 64 context = pango_ft2_font_map_create_context ((PangoFT2FontMap *)fontmap);
55} 65}
56 66
57void 67void
58lowdelay (int fd, int val = 1) 68lowdelay (int fd, int val = 1)
85 int count; 95 int count;
86 FcPattern *pattern = FcFreeTypeQuery ((const FcChar8 *)file, 0, 0, &count); 96 FcPattern *pattern = FcFreeTypeQuery ((const FcChar8 *)file, 0, 0, &count);
87 PangoFontDescription *font = pango_fc_font_description_from_pattern (pattern, 0); 97 PangoFontDescription *font = pango_fc_font_description_from_pattern (pattern, 0);
88 FcPatternDestroy (pattern); 98 FcPatternDestroy (pattern);
89 pango_context_set_font_description (context, font); 99 pango_context_set_font_description (context, font);
100}
101
102void
103wait_events (SV *rfd_, SV *wfd_)
104 PPCODE:
105{
90} 106}
91 107
92MODULE = CFClient PACKAGE = CFClient::Layout 108MODULE = CFClient PACKAGE = CFClient::Layout
93 109
94CFClient::Layout 110CFClient::Layout
212 double t = SvNV (*hv_fetch (hv, "t", 1, 1)); 228 double t = SvNV (*hv_fetch (hv, "t", 1, 1));
213 int name = SvIV (*hv_fetch (hv, "name", 4, 1)); 229 int name = SvIV (*hv_fetch (hv, "name", 4, 1));
214 230
215 if (items < 5) 231 if (items < 5)
216 { 232 {
217 w = SvNV (*hv_fetch (hv, "width", 5, 1)); 233 w = SvNV (*hv_fetch (hv, "w", 1, 1));
218 h = SvNV (*hv_fetch (hv, "height", 6, 1)); 234 h = SvNV (*hv_fetch (hv, "h", 1, 1));
219 } 235 }
220 236
221 glBindTexture (GL_TEXTURE_2D, name); 237 glBindTexture (GL_TEXTURE_2D, name);
222 glBegin (GL_QUADS); 238 glBegin (GL_QUADS);
223 glTexCoord2d (0, 0); glVertex2d (x , y ); 239 glTexCoord2d (0, 0); glVertex2d (x , y );

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines