summaryrefslogtreecommitdiff
path: root/src/gfx.cpp
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2021-06-12 19:13:22 +0200
committerMichael Lutz <michi@icosahedron.de>2021-06-12 22:30:38 +0200
commit418e0ea85f69196845c16193954dedee33191cb5 (patch)
treecd4ad1d4035142bb086e83f4ed95063dc30cb786 /src/gfx.cpp
parent8dd846bad42eebc9bf37d62d635b9c3f19e72016 (diff)
downloadopenttd-418e0ea85f69196845c16193954dedee33191cb5.tar.xz
Codechange: Use dynamic string list for contents of land info window.
Diffstat (limited to 'src/gfx.cpp')
-rw-r--r--src/gfx.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/gfx.cpp b/src/gfx.cpp
index a4bac6e13..e44cb708c 100644
--- a/src/gfx.cpp
+++ b/src/gfx.cpp
@@ -890,6 +890,21 @@ Dimension GetStringBoundingBox(const char *str, FontSize start_fontsize)
}
/**
+ * Return the string dimension in pixels. The height and width are returned
+ * in a single Dimension value. TINYFONT, BIGFONT modifiers are only
+ * supported as the first character of the string. The returned dimensions
+ * are therefore a rough estimation correct for all the current strings
+ * but not every possible combination
+ * @param str string to calculate pixel-width
+ * @param start_fontsize Fontsize to start the text with
+ * @return string width and height in pixels
+ */
+Dimension GetStringBoundingBox(const std::string &str, FontSize start_fontsize)
+{
+ return GetStringBoundingBox(str.c_str(), start_fontsize);
+}
+
+/**
* Get bounding box of a string. Uses parameters set by #SetDParam if needed.
* Has the same restrictions as #GetStringBoundingBox(const char *str, FontSize start_fontsize).
* @param strid String to examine.