CEGUIFreeTypeFont.h

00001 /***********************************************************************
00002         filename:       CEGUIFreeTypeFont.h
00003         created:        3/6/2006
00004         author:         Andrew Zabolotny
00005         
00006         purpose:    Implementation of the Font class via the FreeType library
00007 *************************************************************************/
00008 /***************************************************************************
00009  *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
00010  *
00011  *   Permission is hereby granted, free of charge, to any person obtaining
00012  *   a copy of this software and associated documentation files (the
00013  *   "Software"), to deal in the Software without restriction, including
00014  *   without limitation the rights to use, copy, modify, merge, publish,
00015  *   distribute, sublicense, and/or sell copies of the Software, and to
00016  *   permit persons to whom the Software is furnished to do so, subject to
00017  *   the following conditions:
00018  *
00019  *   The above copyright notice and this permission notice shall be
00020  *   included in all copies or substantial portions of the Software.
00021  *
00022  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00023  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00024  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00025  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
00026  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00027  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00028  *   OTHER DEALINGS IN THE SOFTWARE.
00029  ***************************************************************************/
00030 #ifndef _CEGUIFreeTypeFont_h_
00031 #define _CEGUIFreeTypeFont_h_
00032 
00033 #include "CEGUIFont.h"
00034 #include "CEGUIImage.h"
00035 #include "CEGUIDataContainer.h"
00036 
00037 #include <ft2build.h>
00038 #include FT_FREETYPE_H
00039 
00040 // Start of CEGUI namespace section
00041 namespace CEGUI
00042 {
00043 
00044 // Forward declarations for font properties
00045 namespace FontProperties
00046 {
00047     class FreeTypePointSize;
00048     class FreeTypeAntialiased;
00049 };
00050 
00062 class FreeTypeFont : public Font
00063 {
00064 protected:
00065     friend class FontManager;
00066     friend class FontProperties::FreeTypePointSize;
00067     friend class FontProperties::FreeTypeAntialiased;
00068 
00069     typedef std::vector<Imageset*> ImagesetVector;
00071     ImagesetVector d_glyphImages;
00072 
00074     float d_ptSize;
00076     bool d_antiAliased;
00077 
00079     FT_Face d_fontFace;
00081     RawDataContainer d_fontData;
00082 
00098     void drawGlyphToBuffer (argb_t* buffer, uint buf_width);
00099 
00109     uint getTextureSize (CodepointMap::const_iterator s,
00110                          CodepointMap::const_iterator e);
00111 
00113     FreeTypeFont (const String& name, const String& filename,
00114                   const String& resourceGroup);
00115 
00117     FreeTypeFont (const XMLAttributes& attributes);
00118 
00120     virtual ~FreeTypeFont ();
00121 
00123     virtual void updateFont ();
00124 
00126     virtual void writeXMLToStream_impl (XMLSerializer& xml_stream) const;
00127 
00132     void addFreeTypeFontProperties ();
00133 
00138     void free ();
00139 
00140 public:
00142     virtual void load ();
00143 
00145     virtual void rasterize (utf32 start_codepoint, utf32 end_codepoint);
00146 };
00147 
00148 } // End of  CEGUI namespace section
00149 
00150 #endif  // end of guard _CEGUIFreeTypeFont_h_

Generated on Sat Jun 28 14:35:44 2008 for Crazy Eddies GUI System by  doxygen 1.5.4