MyGUI  3.2.0
MyGUI_ResourceManualFont.h
Go to the documentation of this file.
00001 
00006 /*
00007     This file is part of MyGUI.
00008 
00009     MyGUI is free software: you can redistribute it and/or modify
00010     it under the terms of the GNU Lesser General Public License as published by
00011     the Free Software Foundation, either version 3 of the License, or
00012     (at your option) any later version.
00013 
00014     MyGUI is distributed in the hope that it will be useful,
00015     but WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017     GNU Lesser General Public License for more details.
00018 
00019     You should have received a copy of the GNU Lesser General Public License
00020     along with MyGUI.  If not, see <http://www.gnu.org/licenses/>.
00021 */
00022 #ifndef __MYGUI_RESOURCE_MANUAL_FONT_H__
00023 #define __MYGUI_RESOURCE_MANUAL_FONT_H__
00024 
00025 #include "MyGUI_Prerequest.h"
00026 #include "MyGUI_ITexture.h"
00027 #include "MyGUI_IFont.h"
00028 
00029 namespace MyGUI
00030 {
00031 
00032     class MYGUI_EXPORT ResourceManualFont :
00033         public IFont
00034     {
00035         MYGUI_RTTI_DERIVED( ResourceManualFont )
00036 
00037     public:
00038         ResourceManualFont();
00039         virtual ~ResourceManualFont();
00040 
00041         virtual void deserialization(xml::ElementPtr _node, Version _version);
00042 
00043         virtual GlyphInfo* getGlyphInfo(Char _id);
00044 
00045         virtual ITexture* getTextureFont();
00046 
00047         // дефолтная высота, указанная в настройках шрифта
00048         virtual int getDefaultHeight();
00049 
00050     private:
00051         void addGlyph(Char _index, const IntCoord& _coord);
00052 
00053         void initialise();
00054 
00055         void addGlyph(GlyphInfo* _info, Char _index, int _left, int _top, int _right, int _bottom, int _finalw, int _finalh, float _aspect, int _addHeight = 0) const;
00056 
00057         typedef std::vector<PairCodeCoord> VectorPairCodeCoord;
00058         void addRange(VectorPairCodeCoord& _info, size_t _first, size_t _last, int _width, int _height, float _aspect);
00059         void checkTexture();
00060 
00061     private:
00062         std::string mSource;
00063         int mDefaultHeight;
00064 
00065         // отдельная информация о символах
00066         GlyphInfo mSpaceGlyphInfo;
00067 
00068         // символы созданные руками
00069         VectorPairCodeCoord mVectorPairCodeCoord;
00070 
00071         // вся информация о символах
00072         typedef std::vector<RangeInfo> VectorRangeInfo;
00073         VectorRangeInfo mVectorRangeInfo;
00074 
00075         MyGUI::ITexture* mTexture;
00076     };
00077 
00078 } // namespace MyGUI
00079 
00080 #endif // __MYGUI_RESOURCE_MANUAL_FONT_H__