- Your Widget Set For OpenGL
Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | Related Pages

ugl_texturefontrenderer.hpp

00001 /*************************************************************************** 00002 LibUFO - UI For OpenGL 00003 copyright : (C) 2001-2005 by Johannes Schmidt 00004 email : schmidtjf at users.sourceforge.net 00005 ------------------- 00006 00007 file : include/ufo/gl/ugl_texturefontrenderer.hpp 00008 begin : Sat Dec 20 2003 00009 $Id: ugl_texturefontrenderer.hpp,v 1.6 2005/05/21 15:17:23 schmidtjf Exp $ 00010 ***************************************************************************/ 00011 00012 /*************************************************************************** 00013 * This library is free software; you can redistribute it and/or * 00014 * modify it under the terms of the GNU Lesser General Public * 00015 * License as published by the Free Software Foundation; either * 00016 * version 2.1 of the License, or (at your option) any later version. * 00017 * * 00018 * This library is distributed in the hope that it will be useful, * 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00021 * Lesser General Public License for more details. * 00022 * * 00023 * You should have received a copy of the GNU Lesser General Public * 00024 * License along with this library; if not, write to the Free Software * 00025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 00026 ***************************************************************************/ 00027 00028 #ifndef UGL_TEXTUREFONTRENDERER_HPP 00029 #define UGL_TEXTUREFONTRENDERER_HPP 00030 00031 #include "../font/ufontrenderer.hpp" 00032 00033 #include <vector> 00034 00035 #include "../font/ufontinfo.hpp" 00036 #include "../font/ufontmetrics.hpp" 00037 00038 00039 namespace ufo { 00040 00041 class UGL_TextureFontMetrics; 00042 class UImageIO; 00043 struct UGL_TextureFontData; 00044 00045 class UFontPlugin; 00046 class UPluginBase; 00047 00055 class UFO_EXPORT UGL_TextureFontRenderer : public UFontRenderer { 00056 UFO_DECLARE_ABSTRACT_CLASS(UGL_TextureFontRenderer) 00057 private: 00058 friend class UGL_TextureFontMetrics; 00059 // some forward declarations 00060 public: 00066 UGL_TextureFontRenderer(const UFontInfo & fontInfo); 00067 00068 ~UGL_TextureFontRenderer(); 00069 00070 public: // Public methods 00072 bool isValid() const; 00073 00074 public: // Implements UFontRenderer 00075 int drawString(UGraphics * g, const char * text, unsigned int nChar, 00076 int xA = 0, int yA = 0); 00077 00078 void beginDrawing(UGraphics * g); 00079 void endDrawing(UGraphics * g); 00080 00081 void refresh(); 00082 00083 const UFontMetrics * getFontMetrics() const; 00084 00085 UFontInfo getFontInfo() const; 00086 00087 std::string getSystemName() const; 00088 00089 private: // Private methods 00090 void createTexture(UImageIO * imageIO); 00091 UImageIO * loadImageFile(); 00092 void genGlyphMetrics(UImageIO * imageIO); 00093 00094 public: // plugin methods 00095 static UPluginBase * createPlugin(); 00096 static void destroyPlugin(UPluginBase * plugin); 00097 00098 private: // Private attributes 00099 UFontInfo m_fontInfo; 00100 UGL_TextureFontMetrics * m_fontMetrics; 00102 std::string m_systemName; 00103 00104 UGL_TextureFontData * m_data; 00105 bool m_isValid; 00106 }; // UGL_TextureFontRenderer 00107 00108 } // namespac ufo 00109 00110 #endif // UGL_TEXTUREFONTRENDERER_HPP

The libUFO Project - written by Johannes Schmidt