diff options
author | Paul Gilbert | 2016-04-24 17:16:32 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-10 16:12:00 -0400 |
commit | c75de59a28c94e364a38af39057af720ba8465d4 (patch) | |
tree | 0fbd1ac099d39b31f2791193c26f172bfc23b178 /engines/titanic/support/font.h | |
parent | a88c0b09994562d4576e7dd08db8ad2fe3326f53 (diff) | |
download | scummvm-rg350-c75de59a28c94e364a38af39057af720ba8465d4.tar.gz scummvm-rg350-c75de59a28c94e364a38af39057af720ba8465d4.tar.bz2 scummvm-rg350-c75de59a28c94e364a38af39057af720ba8465d4.zip |
TITANIC: Implementing font text bounds calculations
Diffstat (limited to 'engines/titanic/support/font.h')
-rw-r--r-- | engines/titanic/support/font.h | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/engines/titanic/support/font.h b/engines/titanic/support/font.h index 5ed0b5b7b4..e1c63e6544 100644 --- a/engines/titanic/support/font.h +++ b/engines/titanic/support/font.h @@ -50,6 +50,17 @@ private: */ int writeChar(CVideoSurface *surface, unsigned char c, const Common::Point &pt, Rect *destRect, Rect *srcRect); + + /** + * Extends a passed text area by the space required for + * the given character + */ + void extendBounds(Point &textSize, byte c, int maxWidth) const; + + /** + * Called at spacing between words, checks for line wrapping + */ + void checkLineWrap(Point &textSize, int maxWidth, const char *&str) const; public: byte *_dataPtr; size_t _dataSize; @@ -72,10 +83,13 @@ public: int stringWidth(const CString &text) const; /** - * Write out a string - * TODO: Verify this + * Get the text area a string will fit into + * @param str String + * @param maxWidth Maximum width in pixels + * @param sizeOut Optional pointer to output size (width, height) + * @returns Required height */ - void writeString(int maxWidth, const CString &text, int *v1, int *v2); + int getTextBounds(const CString &str, int maxWidth, Point *sizeOut) const; /** * Sets the font color |