# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

font_manager.h

Go to the documentation of this file.
00001 
00007 /* Copyright, 2000 Nevrax Ltd.
00008  *
00009  * This file is part of NEVRAX NEL.
00010  * NEVRAX NEL is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2, or (at your option)
00013  * any later version.
00014 
00015  * NEVRAX NEL is distributed in the hope that it will be useful, but
00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00018  * General Public License for more details.
00019 
00020  * You should have received a copy of the GNU General Public License
00021  * along with NEVRAX NEL; see the file COPYING. If not, write to the
00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00023  * MA 02111-1307, USA.
00024  */
00025 
00026 #ifndef NL_FONT_MANAGER_H
00027 #define NL_FONT_MANAGER_H
00028 
00029 #include "nel/misc/types_nl.h"
00030 #include "nel/misc/smart_ptr.h"
00031 #include "3d/texture.h"
00032 #include "3d/material.h"
00033 #include "3d/texture_font.h"
00034 
00035 #include <map>
00036 #include <list>
00037 #include <functional>
00038 
00039 
00040 
00041 
00042 namespace NL3D {
00043 
00044 class  CFontGenerator;
00045 struct CComputedString;
00046 
00062 class CFontManager 
00063 {
00064         uint32 _MemSize;
00065         uint32 _MaxMemory;
00066         uint32 _NbChar;
00067 
00068         CMaterial               *_MatFont;
00069         CTextureFont    *_TexFont;
00070 
00071 public:
00072 
00076         CFontManager()
00077         {
00078                 _MemSize = 0;
00079                 _MaxMemory = 1000000;
00080                 _NbChar = 0;
00081                 _MatFont = NULL;
00082                 _TexFont = NULL;
00083         }
00084 
00085 
00090         void setMaxMemory(uint32 mem) { _MaxMemory = mem; }
00091 
00092 
00097         uint32 getMaxMemory() const { return _MaxMemory; }
00098 
00104         CMaterial* getFontMaterial();
00105 
00106 
00118         void computeString (const std::string& s,
00119                                                 CFontGenerator *fontGen, 
00120                                                 const NLMISC::CRGBA &color,
00121                                                 uint32 fontSize, 
00122                                             IDriver *driver,
00123                                                 CComputedString& output,
00124                                                 bool    keep800x600Ratio= true);
00125 
00129         void computeString (const ucstring &s,
00130                                                 CFontGenerator *fontGen, 
00131                                                 const NLMISC::CRGBA &color,
00132                                                 uint32 fontSize, 
00133                                             IDriver *driver,
00134                                                 CComputedString &output,
00135                                                 bool    keep800x600Ratio= true);
00136 
00140         void computeStringInfo (const ucstring &s,
00141                                                         CFontGenerator *fontGen, 
00142                                                         const NLMISC::CRGBA &color,
00143                                                         uint32 fontSize, 
00144                                                         IDriver *driver,
00145                                                         CComputedString &output,
00146                                                         bool keep800x600Ratio= true);
00147 
00148 
00152         std::string getCacheInformation() const;
00153 
00154         void    dumpCache (const char *filename)
00155         {
00156                 _TexFont->dumpTextureFont (filename);
00157         }
00158 
00159 };
00160 
00161 
00162 
00163 } // NL3D
00164 
00165 
00166 #endif // NL_FONT_MANAGER_H
00167 
00168 /* End of font_manager.h */