… | |
… | |
66 | layout_update (CFClient__Layout self) |
66 | layout_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 | |
85 | static void |
86 | static void |
86 | layout_get_pixel_size (CFClient__Layout self, int *w, int *h) |
87 | layout_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 | |
534 | void |
536 | void |
535 | load_image_inline (SV *image_) |
537 | load_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 | |
645 | void |
650 | void |
646 | DESTROY (CFClient::Layout self) |
651 | DESTROY (CFClient::Layout self) |