Crazy Eddies GUI System  0.7.9
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
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 {
54 class FreeTypeFont : public Font
55 {
56 public:
96  FreeTypeFont(const String& font_name, const float point_size,
97  const bool anti_aliased, const String& font_filename,
98  const String& resource_group = "",
99  const bool auto_scaled = false,
100  const float native_horz_res = 640.0f,
101  const float native_vert_res = 480.0f,
102  const float specific_line_spacing = 0.0f);
103 
105  ~FreeTypeFont();
106 
108  float getPointSize() const;
109 
111  bool isAntiAliased() const;
112 
114  void setPointSize(const float point_size);
115 
117  void setAntiAliased(const bool anti_alaised);
118 
119 protected:
135  void drawGlyphToBuffer(argb_t* buffer, uint buf_width) const;
136 
146  uint getTextureSize(CodepointMap::const_iterator s,
147  CodepointMap::const_iterator e) const;
148 
152  void free();
153 
154  // overrides of functions in Font base class.
155  void rasterise(utf32 start_codepoint, utf32 end_codepoint) const;
156  void updateFont();
157  void writeXMLToStream_impl (XMLSerializer& xml_stream) const;
158 
162  float d_ptSize;
166  FT_Face d_fontFace;
170  typedef std::vector<Imageset*> ImagesetVector;
173 };
174 
175 } // End of CEGUI namespace section
176 
177 #endif // end of guard _CEGUIFreeTypeFont_h_
void free()
Free all allocated font data.
uint getTextureSize(CodepointMap::const_iterator s, CodepointMap::const_iterator e) const
Return the required texture size required to store imagery for the glyphs from s to e...
Implementation of the Font class interface using the FreeType library.
Definition: CEGUIFreeTypeFont.h:54
void setPointSize(const float point_size)
return the point size of the freetype font.
uint32 argb_t
32 bit ARGB representation of a colour.
Definition: CEGUIcolour.h:39
RawDataContainer d_fontData
Font file data.
Definition: CEGUIFreeTypeFont.h:168
float getPointSize() const
return the point size of the freetype font.
float d_ptSize
Point size of font.
Definition: CEGUIFreeTypeFont.h:162
bool d_antiAliased
True if the font should be rendered as anti-alaised by freeType.
Definition: CEGUIFreeTypeFont.h:164
Class that encapsulates a typeface.
Definition: CEGUIFont.h:58
FT_Face d_fontFace
FreeType-specific font handle.
Definition: CEGUIFreeTypeFont.h:166
bool isAntiAliased() const
return whether the freetype font is rendered anti-aliased.
Class used as the databuffer for loading files throughout the library.
Definition: CEGUIDataContainer.h:43
float d_specificLineSpacing
If non-zero, the overridden line spacing that we&#39;re to report.
Definition: CEGUIFreeTypeFont.h:160
FreeTypeFont(const String &font_name, const float point_size, const bool anti_aliased, const String &font_filename, const String &resource_group="", const bool auto_scaled=false, const float native_horz_res=640.0f, const float native_vert_res=480.0f, const float specific_line_spacing=0.0f)
Constructor for FreeTypeFont based fonts.
void rasterise(utf32 start_codepoint, utf32 end_codepoint) const
This function prepares a certain range of glyphs to be ready for displaying. This means that after re...
~FreeTypeFont()
Destructor.
void setAntiAliased(const bool anti_alaised)
return whether the freetype font is rendered anti-aliased.
void updateFont()
Update the font as needed, according to the current parameters.
std::vector< Imageset * > ImagesetVector
Type definition for ImagesetVector.
Definition: CEGUIFreeTypeFont.h:170
void addFreeTypeFontProperties()
Register all properties of this class.
void writeXMLToStream_impl(XMLSerializer &xml_stream) const
implementaion version of writeXMLToStream.
Class used to create XML Document.
Definition: CEGUIXMLSerializer.h:86
ImagesetVector d_glyphImages
Imagesets that holds the glyphs for this font.
Definition: CEGUIFreeTypeFont.h:172
void drawGlyphToBuffer(argb_t *buffer, uint buf_width) const
Copy the current glyph data into buffer, which has a width of buf_width pixels (not bytes)...
String class used within the GUI system.
Definition: CEGUIString.h:57