diff --git a/src/font/digit_face.hpp b/src/font/digit_face.hpp index ea7e6cf37..103b5546a 100644 --- a/src/font/digit_face.hpp +++ b/src/font/digit_face.hpp @@ -33,7 +33,7 @@ private: // ------------------------------------------------------------------------ virtual unsigned int getGlyphPageSize() const OVERRIDE { return 256; } // ------------------------------------------------------------------------ - virtual float getScalingFactorOne() const OVERRIDE { return 0.7f; } + virtual float getScalingFactorOne() const OVERRIDE { return 1.4f; } // ------------------------------------------------------------------------ virtual unsigned int getScalingFactorTwo() const OVERRIDE { return 40; } @@ -47,6 +47,8 @@ public: virtual void reset() OVERRIDE; // ------------------------------------------------------------------------ virtual bool disableTextShaping() const OVERRIDE { return true; } + // ------------------------------------------------------------------------ + virtual float getNativeScalingFactor() const OVERRIDE { return 0.5f; } }; // DigitFace #endif diff --git a/src/font/font_with_face.cpp b/src/font/font_with_face.cpp index 9f378a47b..502de9404 100644 --- a/src/font/font_with_face.cpp +++ b/src/font/font_with_face.cpp @@ -498,11 +498,12 @@ core::dimension2d FontWithFace::getDimension(const core::stringw& text, if (GUIEngine::isNoGraphics()) return core::dimension2d(1, 1); - const float scale = font_settings ? font_settings->getScale() : 1.0f; + const float scale = (font_settings ? font_settings->getScale() : 1.0f) + * getNativeScalingFactor(); if (disableTextShaping()) { return gui::getGlyphLayoutsDimension(text2GlyphsWithoutShaping(text), - m_font_max_height, 1.0f/*inverse shaping*/, scale); + m_font_max_height * scale, 1.0f/*inverse shaping*/, scale); } auto& gls = font_manager->getCachedLayouts(text); @@ -525,7 +526,8 @@ int FontWithFace::getCharacterFromPos(const wchar_t* text, int pixel_x, FontSettings* font_settings) const { #ifndef SERVER_ONLY - const float scale = font_settings ? font_settings->getScale() : 1.0f; + const float scale = (font_settings ? font_settings->getScale() : 1.0f) + * getNativeScalingFactor(); float x = 0; int idx = 0; @@ -574,7 +576,8 @@ void FontWithFace::render(const std::vector& gl, font_settings->useBlackBorder() : false; const bool colored_border = font_settings ? font_settings->useColoredBorder() : false; - const float scale = font_settings ? font_settings->getScale() : 1.0f; + const float scale = (font_settings ? font_settings->getScale() : 1.0f) + * getNativeScalingFactor(); const float shadow = font_settings ? font_settings->useShadow() : false; if (shadow) diff --git a/src/font/font_with_face.hpp b/src/font/font_with_face.hpp index f18a9b004..074940298 100644 --- a/src/font/font_with_face.hpp +++ b/src/font/font_with_face.hpp @@ -324,6 +324,10 @@ public: // ------------------------------------------------------------------------ virtual bool useColorGlyphPage() const { return false; } // ------------------------------------------------------------------------ + /** Defined by sub-class about the native scaling factor, to provide */ + /** a texture with higher resolution when the scale is > 1.0f */ + virtual float getNativeScalingFactor() const { return 1.0f; } + // ------------------------------------------------------------------------ void setDPI(); }; // FontWithFace diff --git a/src/graphics/stk_text_billboard.cpp b/src/graphics/stk_text_billboard.cpp index ef3e37323..2d8fde6b3 100644 --- a/src/graphics/stk_text_billboard.cpp +++ b/src/graphics/stk_text_billboard.cpp @@ -67,7 +67,7 @@ STKTextBillboard::STKTextBillboard(const video::SColor& color_top, // ---------------------------------------------------------------------------- float STKTextBillboard::getDefaultScale(FontWithFace* face) { - return 1.0f / (float)face->getDPI(); + return 1.0f / (float)face->getDPI() / face->getNativeScalingFactor(); } // getDefaultScale // ---------------------------------------------------------------------------- diff --git a/src/guiengine/scalable_font.cpp b/src/guiengine/scalable_font.cpp index 43294f28c..e3746e3a0 100644 --- a/src/guiengine/scalable_font.cpp +++ b/src/guiengine/scalable_font.cpp @@ -150,7 +150,9 @@ IGUISpriteBank* ScalableFont::getSpriteBank() const // ---------------------------------------------------------------------------- s32 ScalableFont::getHeightPerLine() const { - return m_face->getFontMaxHeight() * m_font_settings->getScale(); + return m_face->getFontMaxHeight() + * m_face->getNativeScalingFactor() + * m_font_settings->getScale(); } // getHeightPerLine // ----------------------------------------------------------------------------