… | |
… | |
47 | { |
47 | { |
48 | /* use a random scale factor to account for unknown descenders, 0.8 works |
48 | /* use a random scale factor to account for unknown descenders, 0.8 works |
49 | * reasonably well with bitstream vera |
49 | * reasonably well with bitstream vera |
50 | */ |
50 | */ |
51 | PangoFontDescription *font = pango_context_get_font_description (context); |
51 | PangoFontDescription *font = pango_context_get_font_description (context); |
52 | pango_font_description_set_absolute_size (font, self->base_height * (PANGO_SCALE * 8 / 10)); |
52 | |
|
|
53 | int height = self->base_height * (PANGO_SCALE * 8 / 10); |
|
|
54 | |
|
|
55 | if (pango_font_description_get_size (font) != height) |
|
|
56 | { |
|
|
57 | pango_font_description_set_absolute_size (font, height); |
|
|
58 | pango_layout_context_changed (self->pl); |
|
|
59 | } |
53 | } |
60 | } |
54 | |
61 | |
55 | static void |
62 | static void |
56 | layout_get_pixel_size (CFClient__Layout self, int *w, int *h) |
63 | layout_get_pixel_size (CFClient__Layout self, int *w, int *h) |
57 | { |
64 | { |
… | |
… | |
391 | char *text = SvPVutf8 (text_, textlen); |
398 | char *text = SvPVutf8 (text_, textlen); |
392 | |
399 | |
393 | pango_layout_set_markup (self->pl, text, textlen); |
400 | pango_layout_set_markup (self->pl, text, textlen); |
394 | } |
401 | } |
395 | |
402 | |
|
|
403 | SV * |
|
|
404 | get_text (CFClient::Layout self) |
|
|
405 | CODE: |
|
|
406 | RETVAL = newSVpv (pango_layout_get_text (self), 0); |
|
|
407 | SvUTF8_on (RETVAL); |
|
|
408 | OUTPUT: |
|
|
409 | RETVAL |
|
|
410 | |
396 | void |
411 | void |
397 | set_height (CFClient::Layout self, int base_height) |
412 | set_height (CFClient::Layout self, int base_height) |
398 | CODE: |
413 | CODE: |
399 | self->base_height = base_height; |
414 | self->base_height = base_height; |
400 | |
415 | |