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.58 by root, Sun Apr 23 00:57:38 2006 UTC vs.
Revision 1.60 by root, Sun Apr 23 04:47:02 2006 UTC

66layout_update (CFClient__Layout self) 66layout_update (CFClient__Layout self)
67{ 67{
68 /* 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
69 * reasonably well with bitstream vera 69 * reasonably well with bitstream vera
70 */ 70 */
71 PangoFontDescription *font = pango_context_get_font_description (context); 71 PangoFontDescription *font = (PangoFontDescription *)
72 pango_layout_get_font_description (self->pl);
72 73
73 int height = self->base_height * (PANGO_SCALE * 8 / 10); 74 int height = self->base_height * (PANGO_SCALE * 8 / 10);
74 75
75 if (height < MIN_FONT_HEIGHT) 76 if (height < MIN_FONT_HEIGHT)
76 height = MIN_FONT_HEIGHT; 77 height = MIN_FONT_HEIGHT;
77 78
78 if (pango_font_description_get_size (font) != height) 79 if (pango_font_description_get_size (font) != height)
79 { 80 {
81 font = pango_font_description_copy (font);
80 pango_font_description_set_absolute_size (font, height); 82 pango_font_description_set_absolute_size (font, height);
81 pango_layout_context_changed (self->pl); 83 pango_layout_set_font_description (self->pl, font);
82 } 84 }
83} 85}
84 86
85static void 87static void
86layout_get_pixel_size (CFClient__Layout self, int *w, int *h) 88layout_get_pixel_size (CFClient__Layout self, int *w, int *h)
526{ 528{
527 int count; 529 int count;
528 FcPattern *pattern = FcFreeTypeQuery ((const FcChar8 *)file, 0, 0, &count); 530 FcPattern *pattern = FcFreeTypeQuery ((const FcChar8 *)file, 0, 0, &count);
529 PangoFontDescription *font = pango_fc_font_description_from_pattern (pattern, 0); 531 PangoFontDescription *font = pango_fc_font_description_from_pattern (pattern, 0);
530 FcPatternDestroy (pattern); 532 FcPatternDestroy (pattern);
533 pango_font_description_set_absolute_size (font, MIN_FONT_HEIGHT);
531 pango_context_set_font_description (context, font); 534 pango_context_set_font_description (context, font);
532} 535}
533 536
534void 537void
535load_image_inline (SV *image_) 538load_image_inline (SV *image_)
637 CODE: 640 CODE:
638 New (0, RETVAL, 1, struct cf_layout); 641 New (0, RETVAL, 1, struct cf_layout);
639 RETVAL->base_height = base_height; 642 RETVAL->base_height = base_height;
640 RETVAL->pl = pango_layout_new (context); 643 RETVAL->pl = pango_layout_new (context);
641 pango_layout_set_wrap (RETVAL->pl, PANGO_WRAP_WORD_CHAR); 644 pango_layout_set_wrap (RETVAL->pl, PANGO_WRAP_WORD_CHAR);
645 pango_layout_set_font_description (RETVAL->pl,
646 pango_font_description_copy (
647 pango_context_get_font_description (context)));
642 OUTPUT: 648 OUTPUT:
643 RETVAL 649 RETVAL
644 650
645void 651void
646DESTROY (CFClient::Layout self) 652DESTROY (CFClient::Layout self)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines