From 4883e4a585ffe2f1c726585777167fb0b87cb857 Mon Sep 17 00:00:00 2001 From: Deve Date: Mon, 13 May 2019 23:46:28 +0200 Subject: [PATCH] Use floating point value for font scale --- src/config/user_config.hpp | 6 +++--- src/font/font_with_face.cpp | 11 +++++++++-- src/main_android.cpp | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/config/user_config.hpp b/src/config/user_config.hpp index bddbb8761..c1d82e38b 100644 --- a/src/config/user_config.hpp +++ b/src/config/user_config.hpp @@ -643,9 +643,9 @@ namespace UserConfigParams PARAM_DEFAULT(BoolUserConfigParam(false, "hq_mipmap", &m_video_group, "Generate mipmap for textures using " "high quality method with SSE")); - PARAM_PREFIX IntUserConfigParam m_fonts_size - PARAM_DEFAULT( IntUserConfigParam(2, "fonts_size", - &m_video_group,"The size of fonts. 0 is the smallest and 4 is the biggest") ); + PARAM_PREFIX FloatUserConfigParam m_fonts_size + PARAM_DEFAULT( FloatUserConfigParam(2, "fonts_size", + &m_video_group,"The size of fonts. 0 is the smallest and 6 is the biggest") ); // ---- Recording PARAM_PREFIX GroupUserConfigParam m_recording_group diff --git a/src/font/font_with_face.cpp b/src/font/font_with_face.cpp index 00b68acd3..f3f7bc505 100644 --- a/src/font/font_with_face.cpp +++ b/src/font/font_with_face.cpp @@ -354,9 +354,16 @@ void FontWithFace::setDPI() irr_driver->getActualScreenSize().Width) / 720.0f; int factorTwo = getScalingFactorTwo(); - if(0 <= UserConfigParams::m_fonts_size && UserConfigParams::m_fonts_size <= 4) - factorTwo += UserConfigParams::m_fonts_size * 5 - 10; + if (UserConfigParams::m_fonts_size < 0) + { + UserConfigParams::m_fonts_size = 0; + } + else if (UserConfigParams::m_fonts_size > 6) + { + UserConfigParams::m_fonts_size = 6; + } + factorTwo += UserConfigParams::m_fonts_size * 5 - 10; m_face_dpi = int(factorTwo * getScalingFactorOne() * scale); } // setDPI diff --git a/src/main_android.cpp b/src/main_android.cpp index dad2ea061..7375a09fc 100644 --- a/src/main_android.cpp +++ b/src/main_android.cpp @@ -69,7 +69,7 @@ void override_default_params() UserConfigParams::m_screen_keyboard = 1; // Set bigger fonts and buttons - UserConfigParams::m_fonts_size = 4; + UserConfigParams::m_fonts_size = 4.5f; // It shouldn't matter, but STK is always run in fullscreen on android UserConfigParams::m_fullscreen = true;