… | |
… | |
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 | |
… | |
… | |
635 | |
650 | |
636 | mapcell *cell = map_get_cell (self, x, y); |
651 | mapcell *cell = map_get_cell (self, x, y); |
637 | |
652 | |
638 | if (flags & 15) |
653 | if (flags & 15) |
639 | { |
654 | { |
640 | if (cell->darkness < 0) // && x < self->w && y < self->h) |
655 | if (cell->darkness < 0) |
641 | { |
656 | { |
642 | cell->darkness = 0; |
657 | cell->darkness = 0; |
643 | cell->face [0] = 0; |
658 | cell->face [0] = 0; |
644 | cell->face [1] = 0; |
659 | cell->face [1] = 0; |
645 | cell->face [2] = 0; |
660 | cell->face [2] = 0; |
646 | } |
661 | } |
647 | |
662 | |
648 | cell->darkness = flags & 8 ? *data++ : 255; |
663 | cell->darkness = flags & 8 ? *data++ : 255; |
649 | |
664 | |
650 | //TODO: don't trust server data to be in-range(!) |
665 | //TODO: don't trust server data to be in-range(!) |
651 | |
666 | |
652 | if (flags & 4) |
667 | if (flags & 4) |