Crazy Eddies GUI System  0.6.2
CEGUIFreeTypeFont.h
1 /***********************************************************************
2  filename: CEGUIFreeTypeFont.h
3  created: 3/6/2006
4  author: Andrew Zabolotny
5 
6  purpose: Implementation of the Font class via the FreeType library
7 *************************************************************************/
8 /***************************************************************************
9  * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
10  *
11  * Permission is hereby granted, free of charge, to any person obtaining
12  * a copy of this software and associated documentation files (the
13  * "Software"), to deal in the Software without restriction, including
14  * without limitation the rights to use, copy, modify, merge, publish,
15  * distribute, sublicense, and/or sell copies of the Software, and to
16  * permit persons to whom the Software is furnished to do so, subject to
17  * the following conditions:
18  *
19  * The above copyright notice and this permission notice shall be
20  * included in all copies or substantial portions of the Software.
21  *
22  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
26  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
27  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28  * OTHER DEALINGS IN THE SOFTWARE.
29  ***************************************************************************/
30 #ifndef _CEGUIFreeTypeFont_h_
31 #define _CEGUIFreeTypeFont_h_
32 
33 #include "CEGUIFont.h"
34 #include "CEGUIImage.h"
35 #include "CEGUIDataContainer.h"
36 
37 #include <ft2build.h>
38 #include FT_FREETYPE_H
39 
40 // Start of CEGUI namespace section
41 namespace CEGUI
42 {
43 
44 // Forward declarations for font properties
45 namespace FontProperties
46 {
47  class FreeTypePointSize;
48  class FreeTypeAntialiased;
49 };
50 
62 class FreeTypeFont : public Font
63 {
64 protected:
65  friend class FontManager;
68 
69  typedef std::vector<Imageset*> ImagesetVector;
71  ImagesetVector d_glyphImages;
72 
74  float d_ptSize;
77 
79  FT_Face d_fontFace;
82 
98  void drawGlyphToBuffer (argb_t* buffer, uint buf_width);
99 
109  uint getTextureSize (CodepointMap::const_iterator s,
110  CodepointMap::const_iterator e);
111 
113  FreeTypeFont (const String& name, const String& filename,
114  const String& resourceGroup);
115 
117  FreeTypeFont (const XMLAttributes& attributes);
118 
120  virtual ~FreeTypeFont ();
121 
123  virtual void updateFont ();
124 
126  virtual void writeXMLToStream_impl (XMLSerializer& xml_stream) const;
127 
133 
138  void free ();
139 
140 public:
142  virtual void load ();
143 
145  virtual void rasterize (utf32 start_codepoint, utf32 end_codepoint);
146 };
147 
148 } // End of CEGUI namespace section
149 
150 #endif // end of guard _CEGUIFreeTypeFont_h_