00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
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
00073 std::string mSource;
00074
00075 float mTtfSize;
00076
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 }
00103
00104 #endif // __MYGUI_RESOURCE_TRUE_TYPE_FONT_H__