• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • Examples
  • File List
  • Globals

MyGUI_ResourceTrueTypeFont.h

Go to the documentation of this file.
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_TRUE_TYPE_FONT_H__
00024 #define __MYGUI_RESOURCE_TRUE_TYPE_FONT_H__
00025 
00026 #include "MyGUI_Prerequest.h"
00027 #include "MyGUI_Common.h"
00028 #include "MyGUI_ITexture.h"
00029 #include "MyGUI_IFont.h"
00030 
00031 namespace MyGUI
00032 {
00033 
00034     class MYGUI_EXPORT ResourceTrueTypeFont :
00035         public IFont
00036     {
00037         MYGUI_RTTI_DERIVED( ResourceTrueTypeFont );
00038 
00039     public:
00040         typedef std::vector<PairCodePoint> VectorPairCodePoint;
00041         typedef std::vector<RangeInfo> VectorRangeInfo;
00042         typedef std::vector<PairCodeCoord> VectorPairCodeCoord;
00043 
00044     public:
00045         ResourceTrueTypeFont();
00046         virtual ~ResourceTrueTypeFont();
00047 
00048         virtual void deserialization(xml::ElementPtr _node, Version _version);
00049 
00050         virtual GlyphInfo* getGlyphInfo(Char _id);
00051 
00052         virtual ITexture* getTextureFont() { return mTexture; }
00053 
00054         // получившаяся высота при генерации в пикселях
00055         virtual int getDefaultHeight() { return mHeightPix; }
00056 
00057     private:
00058         void addCodePointRange(Char _first, Char _second);
00059         void addHideCodePointRange(Char _first, Char _second);
00060 
00061         // проверяет, входит ли символ в зоны ненужных символов
00062         bool checkHidePointCode(Char _id);
00063 
00065         void clearCodePointRanges();
00066 
00067         void initialise();
00068 
00069         void addGlyph(GlyphInfo * _info, Char _index, int _left, int _top, int _right, int _bottom, int _finalw, int _finalh, float _aspect, int _addHeight = 0);
00070 
00071     private:
00072         // Source of the font
00073         std::string mSource;
00074         // Size of the truetype font, in points
00075         float mTtfSize;
00076         // Resolution (dpi) of truetype font
00077         uint mTtfResolution;
00078 
00079         bool mAntialiasColour;
00080 
00081         int mDistance;
00082         int mSpaceWidth;
00083         int mTabWidth;
00084         int mCursorWidth;
00085         int mSelectionWidth;
00086         int mOffsetHeight;
00087         int mHeightPix;
00088 
00089         // отдельная информация о символах
00090         GlyphInfo mSpaceGlyphInfo, mTabGlyphInfo, mSelectGlyphInfo, mSelectDeactiveGlyphInfo, mCursorGlyphInfo;
00091 
00092         // символы которые не нужно рисовать
00093         VectorPairCodePoint mVectorHideCodePoint;
00094 
00095         // вся информация о символах
00096         VectorRangeInfo mVectorRangeInfo;
00097 
00098         MyGUI::ITexture* mTexture;
00099 
00100     };
00101 
00102 } // namespace MyGUI
00103 
00104 #endif // __MYGUI_RESOURCE_TRUE_TYPE_FONT_H__

Generated on Sun Jan 30 2011 for MyGUI by  doxygen 1.7.1