diff --git a/ui/view.cpp b/ui/view.cpp index 476345108c..cc550d0194 100644 --- a/ui/view.cpp +++ b/ui/view.cpp @@ -268,13 +268,13 @@ void TextureView::Draw(UIContext &dc) { } void TextView::GetContentDimensions(const UIContext &dc, float &w, float &h) const { - dc.Draw()->SetFontScale(textScale_, textScale_); + dc.Draw()->SetFontScale(textScaleX_, textScaleY_); dc.Draw()->MeasureText(dc.theme->uiFont, text_.c_str(), &w, &h); dc.Draw()->SetFontScale(1.0f, 1.0f); } void TextView::Draw(UIContext &dc) { - dc.Draw()->SetFontScale(textScale_, textScale_); + dc.Draw()->SetFontScale(textScaleX_, textScaleY_); dc.Draw()->DrawTextRect(dc.theme->uiFont, text_.c_str(), bounds_.x, bounds_.y, bounds_.w, bounds_.h, 0xFFFFFFFF, textAlign_); dc.Draw()->SetFontScale(1.0f, 1.0f); } diff --git a/ui/view.h b/ui/view.h index 8825e3e5d2..99f3430096 100644 --- a/ui/view.h +++ b/ui/view.h @@ -489,16 +489,19 @@ public: class TextView : public InertView { public: TextView(int font, const std::string &text, int textAlign, float textScale, LayoutParams *layoutParams = 0) - : InertView(layoutParams), font_(font), text_(text), textScale_(textScale), textAlign_(textAlign) {} + : InertView(layoutParams), font_(font), text_(text), textScaleX_(textScale), textScaleY_(textScale), textAlign_(textAlign) {} virtual void GetContentDimensions(const UIContext &dc, float &w, float &h) const; virtual void Draw(UIContext &dc); - virtual void SetText(const std::string &text) { text_ = text; } + void SetText(const std::string &text) { text_ = text; } + void SetTextScaleXY(float sx, float sy) { textScaleX_ = sx; textScaleY_ = sy; } + void SetTextScale(float scale) { textScaleX_ = scale; textScaleY_ = scale; } private: int font_; std::string text_; - float textScale_; + float textScaleX_; + float textScaleY_; int textAlign_; };