00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
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     
00060 
public:
00066     UGL_TextureFontRenderer(
const UFontInfo & fontInfo);
00067 
00068     ~UGL_TextureFontRenderer();
00069 
00070 
public: 
00072     
bool isValid() 
const;
00073 
00074 
public: 
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: 
00090     
void createTexture(
UImageIO * imageIO);
00091     
UImageIO * loadImageFile();
00092     
void genGlyphMetrics(
UImageIO * imageIO);
00093 
00094 
public: 
00095     
static UPluginBase * createPlugin();
00096     
static void destroyPlugin(
UPluginBase * plugin);
00097 
00098 
private:  
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 }; 
00107 
00108 } 
00109 
00110 
#endif // UGL_TEXTUREFONTRENDERER_HPP