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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines