Add Pango support for tooltip...

(and other floating text but not map labels)

by moving the slightly hackish protection against pango use for map labels
into code specific to them.
This commit is contained in:
Ali El Gariani 2010-05-13 23:05:15 +00:00
parent b1a6785abb
commit 6cc85ecc3b
2 changed files with 11 additions and 4 deletions

View file

@ -992,9 +992,6 @@ surface floating_label::create_surface()
text.set_font_size(font_size_);
text.set_maximum_width(clip_rect_.w);
text.set_maximum_height(clip_rect_.h);
// If a colour is specified don't allow to override it with markup. (prevents faking map labels for example)
// FIXME: @todo Better would be to only ignore colour markup or reset the colour after set_text().
if (colour_ != font::LABEL_COLOUR) use_markup_ = false;
text.set_text(text_, use_markup_);
// Reset the maximum width, as we want the smallest bounding box.
text.set_maximum_width(text.get_width());

View file

@ -459,13 +459,23 @@ void terrain_label::draw()
cfg_colour();
// If a colour is specified don't allow to override it with markup. (prevents faking map labels for example)
// FIXME: @todo Better detect if it's team label and not provided by
// the scenario.
bool use_markup = colour_ == font::LABEL_COLOUR;
handle_ = font::add_floating_label(text_,
font::SIZE_NORMAL,
colour_,
xloc, yloc,
0,0,
-1,
parent_->disp().map_outside_area());
parent_->disp().map_outside_area(),
font::CENTER_ALIGN,
NULL, 0,
font::ANCHOR_LABEL_SCREEN,
use_markup
);
calculate_shroud();
}