TrueTypeFont.h

Go to the documentation of this file.
00001 //**********************************************************************
00002 //
00003 //  REGCOM: Regimental Command
00004 //  Copyright (C) 2008 Randi J. Relander
00005 //    <rjrelander@users.sourceforge.net>
00006 //
00007 //  This program is free software; you can redistribute it and/or
00008 //  modify it under the terms of the GNU General Public License
00009 //  as published by the Free Software Foundation; either version 3
00010 //  of the License, or (at your option) any later version.
00011 //  
00012 //  This program is distributed in the hope that it will be useful,
00013 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 //  GNU General Public License for more details.
00016 //  
00017 //  You should have received a copy of the GNU General Public
00018 //  License along with this program.  If not, see 
00019 //  <http://www.gnu.org/licenses/>.
00020 //  
00021 //**********************************************************************
00022 
00023 #ifndef REGCOM_GUI_TRUE_TYPE_FONT_H
00024 #define REGCOM_GUI_TRUE_TYPE_FONT_H
00025 
00026 // SYSTEM INCLUDES
00027 #include <string>
00028 
00029 // LIBRARY INCLUDES
00030 #include "SDL.h"
00031 #include "SDL_ttf.h"
00032 
00033 // PROJECT INCLUDES
00034 #include "regcom/gui/Surface.h"
00035 
00036 // NAMESPACES
00037 namespace regcom {
00038 namespace gui {
00039 
00040 // FORWARD REFERENCES
00041 class Surface;
00042 
00044 //  CLASS: TrueTypeFont
00050 class TrueTypeFont
00051 {
00052 public:
00053 
00054     // PUBLIC METHODS
00055 
00057     TrueTypeFont();
00058 
00060     virtual ~TrueTypeFont();
00061 
00063     static void Init();
00064 
00066     static void Quit();
00067 
00069     int Open(const std::string& rPath, const std::string& rName, int pointSize);
00070 
00072     int Open(const std::string& rName, int pointSize);
00073 
00075     void Close();
00076 
00078     void RenderText(Surface& rSurface, const std::string& rText);
00079 
00081     void GetTextSize(const std::string& rText, int& rWidth, int& rHeight) const;
00082 
00083 private:
00084 
00085     // MEMBER VARIABLES
00086 
00088     TTF_Font* m_pFont;
00089 };
00090 
00091 } // namespace gui
00092 } // namespace regcom
00093 
00094 #endif