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.57 by root, Fri Apr 21 07:09:10 2006 UTC vs.
Revision 1.59 by root, Sun Apr 23 04:41:33 2006 UTC

40#define FOW_DARKNESS 32 40#define FOW_DARKNESS 32
41 41
42#define MAP_EXTEND_X 32 42#define MAP_EXTEND_X 32
43#define MAP_EXTEND_Y 512 43#define MAP_EXTEND_Y 512
44 44
45#define MIN_FONT_HEIGHT 8 * PANGO_SCALE
46
45typedef Mix_Chunk *CFClient__MixChunk; 47typedef Mix_Chunk *CFClient__MixChunk;
46typedef Mix_Music *CFClient__MixMusic; 48typedef Mix_Music *CFClient__MixMusic;
47 49
48static PangoContext *context; 50static PangoContext *context;
49static PangoFontMap *fontmap; 51static PangoFontMap *fontmap;
64layout_update (CFClient__Layout self) 66layout_update (CFClient__Layout self)
65{ 67{
66 /* use a random scale factor to account for unknown descenders, 0.8 works 68 /* use a random scale factor to account for unknown descenders, 0.8 works
67 * reasonably well with bitstream vera 69 * reasonably well with bitstream vera
68 */ 70 */
69 PangoFontDescription *font = pango_context_get_font_description (context); 71 PangoFontDescription *font = pango_layout_get_font_description (self->pl);
70 72
71 int height = self->base_height * (PANGO_SCALE * 8 / 10); 73 int height = self->base_height * (PANGO_SCALE * 8 / 10);
74
75 if (height < MIN_FONT_HEIGHT)
76 height = MIN_FONT_HEIGHT;
72 77
73 if (pango_font_description_get_size (font) != height) 78 if (pango_font_description_get_size (font) != height)
74 { 79 {
80 font = pango_font_description_copy (font);
75 pango_font_description_set_absolute_size (font, height); 81 pango_font_description_set_absolute_size (font, height);
76 pango_layout_context_changed (self->pl); 82 pango_layout_set_font_description (self->pl, font);
77 } 83 }
78} 84}
79 85
80static void 86static void
81layout_get_pixel_size (CFClient__Layout self, int *w, int *h) 87layout_get_pixel_size (CFClient__Layout self, int *w, int *h)
521{ 527{
522 int count; 528 int count;
523 FcPattern *pattern = FcFreeTypeQuery ((const FcChar8 *)file, 0, 0, &count); 529 FcPattern *pattern = FcFreeTypeQuery ((const FcChar8 *)file, 0, 0, &count);
524 PangoFontDescription *font = pango_fc_font_description_from_pattern (pattern, 0); 530 PangoFontDescription *font = pango_fc_font_description_from_pattern (pattern, 0);
525 FcPatternDestroy (pattern); 531 FcPatternDestroy (pattern);
532 pango_font_description_set_absolute_size (font, MIN_FONT_HEIGHT);
526 pango_context_set_font_description (context, font); 533 pango_context_set_font_description (context, font);
527} 534}
528 535
529void 536void
530load_image_inline (SV *image_) 537load_image_inline (SV *image_)
632 CODE: 639 CODE:
633 New (0, RETVAL, 1, struct cf_layout); 640 New (0, RETVAL, 1, struct cf_layout);
634 RETVAL->base_height = base_height; 641 RETVAL->base_height = base_height;
635 RETVAL->pl = pango_layout_new (context); 642 RETVAL->pl = pango_layout_new (context);
636 pango_layout_set_wrap (RETVAL->pl, PANGO_WRAP_WORD_CHAR); 643 pango_layout_set_wrap (RETVAL->pl, PANGO_WRAP_WORD_CHAR);
644 pango_layout_set_font_description (RETVAL->pl,
645 pango_font_description_copy (
646 pango_context_get_font_description (context)));
637 OUTPUT: 647 OUTPUT:
638 RETVAL 648 RETVAL
639 649
640void 650void
641DESTROY (CFClient::Layout self) 651DESTROY (CFClient::Layout self)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines