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.20 by root, Wed Apr 12 02:00:06 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)
212 double t = SvNV (*hv_fetch (hv, "t", 1, 1)); 222 double t = SvNV (*hv_fetch (hv, "t", 1, 1));
213 int name = SvIV (*hv_fetch (hv, "name", 4, 1)); 223 int name = SvIV (*hv_fetch (hv, "name", 4, 1));
214 224
215 if (items < 5) 225 if (items < 5)
216 { 226 {
217 w = SvNV (*hv_fetch (hv, "width", 5, 1)); 227 w = SvNV (*hv_fetch (hv, "w", 1, 1));
218 h = SvNV (*hv_fetch (hv, "height", 6, 1)); 228 h = SvNV (*hv_fetch (hv, "h", 1, 1));
219 } 229 }
220 230
221 glBindTexture (GL_TEXTURE_2D, name); 231 glBindTexture (GL_TEXTURE_2D, name);
222 glBegin (GL_QUADS); 232 glBegin (GL_QUADS);
223 glTexCoord2d (0, 0); glVertex2d (x , y ); 233 glTexCoord2d (0, 0); glVertex2d (x , y );

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines