Save font scale in global settings

This commit is contained in:
vsonnier
2016-06-20 19:28:26 +02:00
parent f3d4b8868a
commit 92221bccdd
6 changed files with 58 additions and 8 deletions
+16 -2
View File
@@ -811,8 +811,7 @@ void GLFont::setScale(GLFontScale scale) {
//0) Normal:
std::lock_guard<std::mutex> lock(g_userFontZoomMappingMutex);
currentScaleFactor = scale;
userFontZoomMapping[GLFont::GLFONT_SIZE12] = GLFont::GLFONT_SIZE12;
userFontZoomMapping[GLFont::GLFONT_SIZE16] = GLFont::GLFONT_SIZE16;
userFontZoomMapping[GLFont::GLFONT_SIZE18] = GLFont::GLFONT_SIZE18;
@@ -824,6 +823,14 @@ void GLFont::setScale(GLFontScale scale) {
userFontZoomMapping[GLFont::GLFONT_SIZE64] = GLFont::GLFONT_SIZE64;
userFontZoomMapping[GLFont::GLFONT_SIZE72] = GLFont::GLFONT_SIZE72;
userFontZoomMapping[GLFont::GLFONT_SIZE96] = GLFont::GLFONT_SIZE96;
currentScaleFactor = scale;
//safety vs. inputs
if (currentScaleFactor < GLFONT_SCALE_NORMAL || currentScaleFactor > GLFONT_SCALE_LARGE) {
currentScaleFactor = GLFontScale::GLFONT_SCALE_NORMAL;
}
//override depending of zoom level:
//Medium : more or less 1.5 x
@@ -877,3 +884,10 @@ double GLFont::getScaleFactor() {
return 1.0;
}
GLFont::GLFontScale GLFont::getScale() {
std::lock_guard<std::mutex> lock(g_userFontZoomMappingMutex);
return currentScaleFactor;
}
+2
View File
@@ -105,6 +105,8 @@ public:
//Called to change the scale of the rendered fonts
static void setScale(GLFontScale scale);
static GLFontScale getScale();
//Return the current scale factor in use (1.0 for normal, 1.5 for medium, 2.0 for large for ex.)
static double getScaleFactor();