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

utexturefont.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/font/utexturefont.hpp 00008 begin : Mon Oct 1 2001 00009 $Id: utexturefont.hpp,v 1.13 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 UTEXTUREFONT_HPP 00029 #define UTEXTUREFONT_HPP 00030 00031 #include "ufontrenderer.hpp" 00032 00033 #include "ufontmetrics.hpp" 00034 #include "ufontinfo.hpp" 00035 00036 #include "../util/ugeom.hpp" 00037 00038 00039 namespace ufo { 00040 00041 class UTextureFontMetrics; 00042 //class UTextureFontCache; 00043 struct UTextureFontData; 00044 class UImageIO; 00045 00046 class UFontPlugin; 00047 class UPluginBase; 00048 00055 class UFO_EXPORT UTextureFontRenderer : public UFontRenderer { 00056 UFO_DECLARE_ABSTRACT_CLASS(UTextureFontRenderer) 00057 private: 00058 friend class UTextureFontMetrics; 00059 // some forward declarations 00060 public: 00066 UTextureFontRenderer(const UFontInfo & fontInfo); 00067 00068 ~UTextureFontRenderer(); 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 public: // plugin methods 00090 static UPluginBase * createPlugin(); 00091 static void destroyPlugin(UPluginBase * plugin); 00092 00093 private: // Private methods 00094 void createTexture(UImageIO * imageIO); 00095 UImageIO * loadImageFile(); 00096 void genGlyphMetrics(UImageIO * imageIO); 00097 00098 public: // Public static methods 00099 static UFontInfo queryFont(const UFontInfo & fontInfo); 00101 static std::vector<UFontInfo> listFonts(const UFontInfo & fontInfo); 00103 static std::vector<UFontInfo> listFonts(); 00104 00105 private: // Private attributes 00106 UFontInfo m_fontInfo; 00107 UTextureFontMetrics * m_fontMetrics; 00109 std::string m_systemName; 00110 00111 UTextureFontData * m_data; 00112 bool m_isValid; 00113 }; // UTextureFontRenderer 00114 00115 00116 } // namespace ufo 00117 00118 #endif // UTEXTUREFONT_HPP

The libUFO Project - written by Johannes Schmidt