Floating Label: keep local pango_text object static

This also means I need to set set_add_outline every time create_texture is called to make sure the
text renderer has the correct settings.
This commit is contained in:
Charles Dang 2017-07-21 06:48:38 +11:00
parent c72ac0079d
commit 0032395ccf

View file

@ -96,7 +96,7 @@ texture floating_label::create_texture()
//
// TODO: figure out why the global text renderer object gives too large a size.
font::pango_text renderer;
static font::pango_text renderer;
renderer.set_foreground_color(color_);
renderer.set_font_size(font_size_);
@ -104,9 +104,7 @@ texture floating_label::create_texture()
renderer.set_maximum_height(height_ < 0 ? clip_rect_.h : height_, true);
// Add text outline if we're not drawing the background.
if(!fill_background_) {
renderer.set_add_outline(true);
}
renderer.set_add_outline(!fill_background_);
// Strip trailing newlines.
boost::trim_right(text_);