Fix wrong text alignment

This commit is contained in:
Benau
2016-07-19 15:21:14 +08:00
parent 89976def57
commit 03b92efba5
5 changed files with 8 additions and 5 deletions

View File

@@ -452,7 +452,7 @@ void FontWithFace::render(const core::stringw& text,
if (rtl || hcenter || vcenter || clip)
{
text_dimension = getDimension(text.c_str());
text_dimension = getDimension(text.c_str(), font_settings);
if (hcenter)
offset.X += (position.getWidth() - text_dimension.Width) / 2;

View File

@@ -1057,7 +1057,7 @@ namespace GUIEngine
Private::font_height = g_font->getDimension( L"X" ).Height;
ScalableFont* sfont_larger = new ScalableFont(regular);
sfont_larger->getFontSettings()->setScale(1.4f);
sfont_larger->setScale(1.4f);
g_large_font = sfont_larger;
Private::large_font_height = g_large_font->getDimension( L"X" ).Height;
@@ -1065,7 +1065,7 @@ namespace GUIEngine
g_outline_font->getFontSettings()->setBlackBorder(true);
ScalableFont* sfont_smaller = new ScalableFont(regular);
sfont_smaller->getFontSettings()->setScale(0.8f);
sfont_smaller->setScale(0.8f);
g_small_font = sfont_smaller;
Private::small_font_height = g_small_font->getDimension( L"X" ).Height;

View File

@@ -29,7 +29,8 @@ namespace gui
ScalableFont::ScalableFont(FontWithFace* face)
{
m_face = face;
m_font_settings = new FontSettings();
m_font_settings = new FontSettings(false/*black_border*/,
translations->isRTLLanguage());
} // ScalableFont
// ----------------------------------------------------------------------------

View File

@@ -47,7 +47,7 @@ public:
// ------------------------------------------------------------------------
FontSettings* getFontSettings() { return m_font_settings; }
// ------------------------------------------------------------------------
const FontSettings* getFontSettings() const { return m_font_settings; }
const FontSettings* getFontSettings() const { return m_font_settings; }
// ------------------------------------------------------------------------
void setScale(float scale);
// ------------------------------------------------------------------------

View File

@@ -341,6 +341,8 @@ void OptionsScreenUI::eventCallback(Widget* widget, const std::string& name, con
GUIEngine::getFont()->updateRTL();
GUIEngine::getTitleFont()->updateRTL();
GUIEngine::getSmallFont()->updateRTL();
GUIEngine::getLargeFont()->updateRTL();
GUIEngine::getOutlineFont()->updateRTL();
UserConfigParams::m_language = selection.c_str();
user_config->saveConfig();