From 15472a073e7001f2d0c3f3c30e4f3ebf0fde4fff Mon Sep 17 00:00:00 2001 From: Nebuleon Fumika Date: Thu, 24 Jul 2014 02:52:44 +0000 Subject: [PATCH] Wrap long subtitles to multiple lines in Dialog::writeSubTitle Setting descriptions and help prompts now appear fully even if they are longer than the screen allows. Translations do not need to worry about allowed text being wider than the screen in some fonts anymore. --- src/dialog.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/dialog.cpp b/src/dialog.cpp index 3eed2df..dc85de1 100644 --- a/src/dialog.cpp +++ b/src/dialog.cpp @@ -31,14 +31,15 @@ void Dialog::writeTitle(const std::string &title, Surface *s) { if (s==NULL) s = gmenu2x->s; - s->write(gmenu2x->font, title, 40, gmenu2x->skinConfInt["topBarHeight"] / 4, Font::HAlignLeft, Font::VAlignMiddle); + s->write(gmenu2x->font, title, 40, 0, Font::HAlignLeft, Font::VAlignTop); } void Dialog::writeSubTitle(const std::string &subtitle, Surface *s) { if (s==NULL) s = gmenu2x->s; - s->write(gmenu2x->font, subtitle, 40, gmenu2x->skinConfInt["topBarHeight"] / 4 * 3, Font::HAlignLeft, Font::VAlignMiddle); + std::string wrapped = gmenu2x->font->wordWrap(subtitle, gmenu2x->resX - 48); + s->write(gmenu2x->font, wrapped, 40, gmenu2x->skinConfInt["topBarHeight"] - gmenu2x->font->getTextHeight(wrapped), Font::HAlignLeft, Font::VAlignTop); }