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