Crazy Eddies GUI System: CEGUIFreeTypeFont.h Source File

Crazy Eddies GUI System 0.7.6

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

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 {
    00054 class FreeTypeFont : public Font
    00055 {
    00056 public:
    00096     FreeTypeFont(const String& font_name, const float point_size,
    00097                  const bool anti_aliased, const String& font_filename,
    00098                  const String& resource_group = "",
    00099                  const bool auto_scaled = false,
    00100                  const float native_horz_res = 640.0f,
    00101                  const float native_vert_res = 480.0f,
    00102                  const float specific_line_spacing = 0.0f);
    00103
    00105     ~FreeTypeFont();
    00106
    00108     float getPointSize() const;
    00109
    00111     bool isAntiAliased() const;
    00112
    00114     void setPointSize(const float point_size);
    00115
    00117     void setAntiAliased(const bool anti_alaised);
    00118
    00119 protected:
    00135     void drawGlyphToBuffer(argb_t* buffer, uint buf_width) const;
    00136
    00146     uint getTextureSize(CodepointMap::const_iterator s,
    00147                         CodepointMap::const_iterator e) const;
    00148
    00150     void addFreeTypeFontProperties();
    00152     void free();
    00153
    00154     // overrides of functions in Font base class.
    00155     void rasterise(utf32 start_codepoint, utf32 end_codepoint) const;
    00156     void updateFont();
    00157     void writeXMLToStream_impl (XMLSerializer& xml_stream) const;
    00158
    00160     float d_specificLineSpacing;
    00162     float d_ptSize;
    00164     bool d_antiAliased;
    00166     FT_Face d_fontFace;
    00168     RawDataContainer d_fontData;
    00170     typedef std::vector<Imageset*> ImagesetVector;
    00172     mutable ImagesetVector d_glyphImages;
    00173 };
    00174
    00175 } // End of  CEGUI namespace section
    00176
    00177 #endif  // end of guard _CEGUIFreeTypeFont_h_