diff options
author | alberth <alberth@openttd.org> | 2009-09-02 20:40:56 +0000 |
---|---|---|
committer | alberth <alberth@openttd.org> | 2009-09-02 20:40:56 +0000 |
commit | a3ddb8a235058618502f98a60bb35c45a958fa9d (patch) | |
tree | 9e4cdccfc3007a835d4b8d81e338cc0f2f4bd14d /src/gfx.cpp | |
parent | 33756275526f812e381d491318c2f0140ce569ca (diff) | |
download | openttd-a3ddb8a235058618502f98a60bb35c45a958fa9d.tar.xz |
(svn r17391) -Codechange: Add string box calculation routine for multi-line strings.
Diffstat (limited to 'src/gfx.cpp')
-rw-r--r-- | src/gfx.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gfx.cpp b/src/gfx.cpp index 8d0add677..cb03ea7d5 100644 --- a/src/gfx.cpp +++ b/src/gfx.cpp @@ -729,6 +729,16 @@ int GetStringHeight(StringID str, int maxw) return GetMultilineStringHeight(buffer, GB(tmp, 0, 16)); } +/** Calculate string bounding box for multi-line strings. + * @param str String to check. + * @param suggestion Suggested bounding box. + * @return Bounding box for the multi-line string, may be bigger than \a suggestion. + */ +Dimension GetStringMultiLineBoundingBox(StringID str, const Dimension &suggestion) +{ + Dimension box = {suggestion.width, GetStringHeight(str, suggestion.width)}; + return box; +} /** * Draw string, possibly over multiple lines. |