font/sdl_ttf_compat: Drop redundant font::pango_draw_text() API
It's literally font::pango_line_size() with fixed big extents and only used once.
This commit is contained in:
parent
e3b737cfd6
commit
9fbe48dfc0
3 changed files with 4 additions and 15 deletions
|
@ -176,10 +176,4 @@ SDL_Rect pango_draw_text(surface& dst, const SDL_Rect& area, int size, const col
|
|||
return res;
|
||||
}
|
||||
|
||||
SDL_Rect pango_text_area(const std::string& text, int size, pango_text::FONT_STYLE style)
|
||||
{
|
||||
const SDL_Rect area {0,0,10000,10000};
|
||||
return pango_draw_text(nullptr, area, size, font::NORMAL_COLOR, text, 0, 0, false, style);
|
||||
}
|
||||
|
||||
} // end namespace font
|
||||
|
|
|
@ -82,9 +82,4 @@ SDL_Rect pango_draw_text(surface& dst, const SDL_Rect& area, int size, const col
|
|||
*/
|
||||
SDL_Rect pango_draw_text(CVideo* gui, const SDL_Rect& area, int size, const color_t& color, const std::string& text, int x, int y, bool use_tooltips = false, pango_text::FONT_STYLE style = pango_text::STYLE_NORMAL);
|
||||
|
||||
/**
|
||||
* Calculate the size of a text (in pixels) if it were to be drawn.
|
||||
*/
|
||||
SDL_Rect pango_text_area(const std::string& text, int size, pango_text::FONT_STYLE style = pango_text::STYLE_NORMAL);
|
||||
|
||||
} // end namespace font
|
||||
|
|
|
@ -918,12 +918,12 @@ void menu::draw_row(const std::size_t row_index, const SDL_Rect& rect, ROW_TYPE
|
|||
} else {
|
||||
column.x = xpos;
|
||||
|
||||
const SDL_Rect& text_size = font::pango_text_area(str,style_->get_font_size());
|
||||
const std::size_t y = rect.y + (rect.h - text_size.h)/2;
|
||||
const auto text_size = font::pango_line_size(str, style_->get_font_size());
|
||||
const std::size_t y = rect.y + (rect.h - text_size.second)/2;
|
||||
const std::size_t padding = 2;
|
||||
SDL_Rect text_rect = column;
|
||||
text_rect.w = rect.w - (xpos - rect.x) - 2 * style_->get_thickness();
|
||||
text_rect.h = text_size.h;
|
||||
text_rect.h = text_size.second;
|
||||
font::pango_draw_text(&video(), text_rect, style_->get_font_size(), font::NORMAL_COLOR, str,
|
||||
(type == HEADING_ROW ? xpos+padding : xpos), y);
|
||||
|
||||
|
@ -937,7 +937,7 @@ void menu::draw_row(const std::size_t row_index, const SDL_Rect& rect, ROW_TYPE
|
|||
}
|
||||
}
|
||||
|
||||
xpos += dir * (text_size.w + 5);
|
||||
xpos += dir * (text_size.first + 5);
|
||||
}
|
||||
}
|
||||
if(lang_rtl)
|
||||
|
|
Loading…
Add table
Reference in a new issue