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