Skip to content

Commit

Permalink
Floating Label: keep local pango_text object static
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Vultraz committed Jul 26, 2017
1 parent 70b05aa commit 5430698
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/floating_label.cpp
Expand Up @@ -96,17 +96,15 @@ 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_);
renderer.set_maximum_width(width_ < 0 ? clip_rect_.w : width_);
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_);
Expand Down

0 comments on commit 5430698

Please sign in to comment.