summaryrefslogtreecommitdiffstats
path: root/src/graphics/engine/text.h
diff options
context:
space:
mode:
authorPiotr Dziwinski <piotrdz@gmail.com>2013-05-12 18:38:01 +0200
committerPiotr Dziwinski <piotrdz@gmail.com>2013-05-12 18:38:01 +0200
commit07839a561fa876539484fdc44e68d3f17e20a89b (patch)
tree30479794903a507e56c9e803e6ffd8e41e2af1d3 /src/graphics/engine/text.h
parent61841b3f40c3381bd591ca14af290e46d3d9a76c (diff)
downloadcolobot-07839a561fa876539484fdc44e68d3f17e20a89b.tar.gz
colobot-07839a561fa876539484fdc44e68d3f17e20a89b.tar.bz2
colobot-07839a561fa876539484fdc44e68d3f17e20a89b.zip
Unicode symbols for special characters
* added support for special characters from original text bitmaps
Diffstat (limited to 'src/graphics/engine/text.h')
-rw-r--r--src/graphics/engine/text.h31
1 files changed, 27 insertions, 4 deletions
diff --git a/src/graphics/engine/text.h b/src/graphics/engine/text.h
index 6bcc59b..b19a224 100644
--- a/src/graphics/engine/text.h
+++ b/src/graphics/engine/text.h
@@ -206,6 +206,20 @@ struct MultisizeFont
};
/**
+ * \enum SpecialChar
+ * \brief Special codes for certain characters
+ */
+enum SpecialChar
+{
+ CHAR_TAB = '\t', //! Tab character - :
+ CHAR_NEWLINE = '\n', //! Newline character - arrow pointing down and left
+ CHAR_DOT = 1, //! Single dot in the middle
+ CHAR_SQUARE = 2, //! Square
+ CHAR_SKIP_RIGHT = 5, //! Filled triangle pointing right
+ CHAR_SKIP_LEFT = 6 //! Filled triangle pointing left
+};
+
+/**
* \class CText
* \brief Text rendering engine
*
@@ -240,6 +254,12 @@ public:
//! Flushes cached textures
void FlushCache();
+ //@{
+ //! Tab size management
+ void SetTabSize(int tabSize);
+ int GetTabSize();
+ //@}
+
//! Draws text (multi-format)
void DrawText(const std::string &text, std::vector<FontMetaChar>::iterator format,
std::vector<FontMetaChar>::iterator end,
@@ -268,11 +288,11 @@ public:
float GetHeight(FontType font, float size);
//! Returns width of string (multi-format)
- TEST_VIRTUAL float GetStringWidth(const std::string &text,
- std::vector<FontMetaChar>::iterator format,
- std::vector<FontMetaChar>::iterator end, float size);
+ TEST_VIRTUAL float GetStringWidth(const std::string& text,
+ std::vector<FontMetaChar>::iterator format,
+ std::vector<FontMetaChar>::iterator end, float size);
//! Returns width of string (single font)
- TEST_VIRTUAL float GetStringWidth(const std::string &text, FontType font, float size);
+ TEST_VIRTUAL float GetStringWidth(std::string text, FontType font, float size);
//! Returns width of single character
TEST_VIRTUAL float GetCharWidth(UTF8Char ch, FontType font, float size, float offset);
@@ -290,6 +310,8 @@ public:
//! Returns the most suitable position to a given offset (one font)
int Detect(const std::string &text, FontType font, float size, float offset);
+ UTF8Char TranslateSpecialChar(int specialChar);
+
protected:
CachedFont* GetOrOpenFont(FontType type, float size);
CharTexture CreateCharTexture(UTF8Char ch, CachedFont* font);
@@ -309,6 +331,7 @@ protected:
std::string m_error;
float m_defaultSize;
+ int m_tabSize;
std::map<FontType, MultisizeFont*> m_fonts;