source: GTP/trunk/Lib/Geom/OgreStuff/include/CEGUI/CEGUIFont_xmlHandler.h @ 1809

Revision 1809, 5.9 KB checked in by gumbau, 18 years ago (diff)
Line 
1/************************************************************************
2filename:       CEGUIFont_xmlHandler.h
3created:        21/2/2004
4author:         Paul D Turner
5
6purpose:        Defines interface for the Font class
7*************************************************************************/
8/*************************************************************************
9Crazy Eddie's GUI System (http://www.cegui.org.uk)
10Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
11
12This library is free software; you can redistribute it and/or
13modify it under the terms of the GNU Lesser General Public
14License as published by the Free Software Foundation; either
15version 2.1 of the License, or (at your option) any later version.
16
17This library is distributed in the hope that it will be useful,
18but WITHOUT ANY WARRANTY; without even the implied warranty of
19MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20Lesser General Public License for more details.
21
22You should have received a copy of the GNU Lesser General Public
23License along with this library; if not, write to the Free Software
24Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
25*************************************************************************/
26#ifndef _CEGUIFont_xmlHandler_h_
27#define _CEGUIFont_xmlHandler_h_
28
29#include "CEGUIFont.h"
30#include "CEGUIXMLHandler.h"
31
32// Start of CEGUI namespace section
33namespace CEGUI
34{
35
36/*!
37\brief
38Handler class used to parse the Font XML files using SAX2
39*/
40class Font_xmlHandler : public XMLHandler
41{
42public:
43        /*************************************************************************
44        Construction & Destruction
45        *************************************************************************/
46        /*!
47        \brief
48        Constructor for Font::xmlHandler objects
49
50        \param font
51        Pointer to the Font object creating this xmlHandler object
52        */
53        Font_xmlHandler(Font* font) : d_font(font) {}
54
55        /*!
56        \brief
57        Destructor for Font::xmlHandler objects
58        */
59        virtual ~Font_xmlHandler(void) {}
60
61        /*************************************************************************
62        SAX2 Handler overrides
63        *************************************************************************/
64        /*!
65        \brief
66        document processing (only care about elements, schema validates format)
67        */
68    virtual void elementStart(const String& element, const XMLAttributes& attributes);
69    virtual void elementEnd(const String& element);
70
71private:
72        /*************************************************************************
73        Implementation Constants
74        *************************************************************************/
75        // XML related strings
76        static const String FontElement;                                        //!< Tag name for Font elements.
77        static const String MappingElement;                             //!< Tag name for Mapping elements.
78        static const String FontTypeStatic;                             //!< Value used for FontTypeAttribute for a static (bitmapped) font.
79        static const String FontTypeDynamic;                            //!< Value used for FontTypeAttribute for a dynamic (true-type) font.
80        static const String GlyphElement;                                       //!< Tag name for Glyph elements.
81        static const String GlyphRangeElement;                  //!< Tag name for GlyphRange elements.
82        static const String GlyphSetElement;                            //!< Tag name for GlyphSet elements.
83        static const char       FontNameAttribute[];                    //!< Attribute name that stores the name of the Font
84    static const char   FontFilenameAttribute[];                //!< Attribute name that stores the filename, this is either an Imageset xml file, or a font file.
85    static const char   FontResourceGroupAttribute[];   //!< Attribute name that stores the resource group identifier used when loading font file.
86        static const char       FontTypeAttribute[];                    //!< Attribute name that stores the type of font being defined (either static or dynamic).
87        static const char       FontSizeAttribute[];                    //!< Attribute name that stores the point size for a dynamic font.
88        static const char       FontFirstCodepointAttribute[];  //!< Attribute name that stores the first code-point for a dynamic font.
89        static const char       FontLastCodepointAttribute[];   //!< Attribute name that stores the last code-point for a dynamic font.
90        static const char       FontNativeHorzResAttribute[];   //!< Optional attribute that stores 'native' horizontal resolution for the Font.
91        static const char       FontNativeVertResAttribute[];   //!< Optional attribute that stores 'native' vertical resolution for the Font.
92        static const char       FontAutoScaledAttribute[];              //!< Optional attribute that specifies whether the Font should be auto-scaled.
93        static const char       FontAntiAliasedAttribute[];             //!< Optional attribute that specifies whether the TTF based font should be anti-aliased.
94        static const char       MappingCodepointAttribute[];    //!< Attribute name that stores the Unicode code-point for a mapping.
95        static const char       MappingImageAttribute[];                //!< Attribute name that stores the Image name for a mapping.
96        static const char       MappingHorzAdvanceAttribute[];  //!< Attribute name that stores the horizontal advance for a glyph.
97        static const char       GlyphCodepointAttribute[];                              //!< Attribute name that stores the U+ codepoint to add to the set.
98        static const char       GlyphRangeStartCodepointAttribute[];    //!< Attribute name that stores the U+ codepoint for the start of a range.
99        static const char       GlyphRangeEndCodepointAttribute[];              //!< Attribute name that stores the U+ codepoint for the end of a range.
100        static const char       GlyphSetGlyphsAttribute[];                              //!< Attribute name that stores the UTF8 encoded codepoint set.
101
102        // general constants
103        static const int        AutoGenerateHorzAdvance;                //!< Horizontal advance value that tells the parser to auto-calculate some reasonable value.
104
105        /*************************************************************************
106        Implementation Data
107        *************************************************************************/
108        Font*   d_font;                 //!< Font object that we are helping to build
109        String  d_glyphSet;             //!< String holding the set of codepoints to be available.
110};
111
112} // End of  CEGUI namespace section
113
114#endif
Note: See TracBrowser for help on using the repository browser.