Use the standard word wrapper in tooltips.
Previously used a bad special word wrapper (broken for long words like in Chinese/Japanese) The old tooltip had a maximum width of 60 chars (overwritten by long words, so the bug). Now the maximum width is 400 pixels and 260 for tiny-gui (+borders) These arbitray values try to reproduce the previous size with the english fonts. Feel free to comment/change this choice.
This commit is contained in:
parent
52348f5629
commit
5cee07fe04
1 changed files with 8 additions and 3 deletions
|
@ -36,18 +36,23 @@ namespace {
|
|||
|
||||
CVideo* video_ = NULL;
|
||||
|
||||
static const int font_size = font::SIZE_SMALL;
|
||||
#ifdef USE_TINY_GUI
|
||||
static const int text_width = 260;
|
||||
#else
|
||||
static const int text_width = 400;
|
||||
#endif
|
||||
|
||||
struct tooltip
|
||||
{
|
||||
tooltip(const SDL_Rect& r, const std::string& msg) : rect(r), message(msg)
|
||||
{
|
||||
font::text_to_lines(message,60);
|
||||
message = font::word_wrap_text(message, font_size, text_width);
|
||||
}
|
||||
SDL_Rect rect;
|
||||
std::string message;
|
||||
};
|
||||
|
||||
static const int font_size = font::SIZE_SMALL;
|
||||
|
||||
std::vector<tooltip> tips;
|
||||
std::vector<tooltip>::const_iterator current_tooltip = tips.end();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue