summaryrefslogtreecommitdiff
path: root/src/zoom_func.h
diff options
context:
space:
mode:
authorPeterN <peter@fuzzle.org>2019-02-23 16:07:25 +0000
committerGitHub <noreply@github.com>2019-02-23 16:07:25 +0000
commiteeae4512ae6b5286aff600d82e612fc10fef5a76 (patch)
treec69cf58bd931d8bfe326ad0e3b314ed74d46baad /src/zoom_func.h
parent13962a84753f203c83d2fadf460043e032f066de (diff)
downloadopenttd-eeae4512ae6b5286aff600d82e612fc10fef5a76.tar.xz
Fix #7003: Freetype fonts were scaled by both GUI and Font zoom levels. (#7267)
Diffstat (limited to 'src/zoom_func.h')
-rw-r--r--src/zoom_func.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/zoom_func.h b/src/zoom_func.h
index da266e35c..0e8fa8c9e 100644
--- a/src/zoom_func.h
+++ b/src/zoom_func.h
@@ -84,4 +84,24 @@ static inline int ScaleGUITrad(int value)
return UnScaleGUI(value * ZOOM_LVL_BASE);
}
+/**
+ * Short-hand to apply font zoom level.
+ * @param value Pixel amount at #ZOOM_LVL_BEGIN (full zoom in).
+ * @return Pixel amount at #ZOOM_LVL_FONT (current interface size).
+ */
+static inline int UnScaleFont(int value)
+{
+ return UnScaleByZoom(value, ZOOM_LVL_FONT);
+}
+
+/**
+ * Scale traditional pixel dimensions to Font zoom level.
+ * @param value Pixel amount at #ZOOM_LVL_BASE (traditional "normal" interface size).
+ * @return Pixel amount at #ZOOM_LVL_FONT (current interface size).
+ */
+static inline int ScaleFontTrad(int value)
+{
+ return UnScaleFont(value * ZOOM_LVL_BASE);
+}
+
#endif /* ZOOM_FUNC_H */