00001 #ifndef Hippo_TextTTF_h 00002 #define Hippo_TextTTF_h 00003 00004 #include <vector> 00005 #include <string> 00006 00007 class TextTTF_Internal; 00008 00009 namespace hippodraw { 00010 00024 class TextTTF { 00025 public: 00026 enum Justification { 00027 LEFT = 0x01, 00028 RIGHT = 0x02, 00029 CENTER = 0x03, 00030 BOTTOM = 0x04, 00031 MIDDLE = 0x05, 00032 TOP = 0x06 00033 }; 00034 enum ViewportMapping { 00035 NONE, 00036 RESCALE, 00037 ADJUST 00038 }; 00039 TextTTF(); 00040 virtual ~TextTTF(); 00041 void setFileName(const std::string&); 00042 void setString(const std::string&); 00043 void setStrings(const std::vector<std::string>&); 00044 void setSize(float); 00045 void setJustification(Justification,Justification); 00046 void setRotated(bool); 00047 void render(); 00048 private: 00049 bool setup(); 00050 void renderString(const std::string&); 00051 void renderCharacter(char); 00052 bool getTextSizePixels(short&,short&); 00053 private: 00054 // Fields 00055 std::string m_fileName; 00056 std::vector<std::string> m_strings; 00057 float m_size; 00058 Justification m_horizontalJustification; 00059 Justification m_verticalJustification; 00060 ViewportMapping m_viewportMapping; 00061 00062 TextTTF_Internal* fTTF; 00063 bool fStatus; 00064 void initFont(); 00065 bool fInitFont; 00066 int fPointSize; 00067 int fViewportWidth; 00068 int fViewportHeight; 00069 bool fRotated; 00070 }; 00071 00072 } // end namespace hippodraw 00073 00074 #endif