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_ITexture.h"
00028 #include "MyGUI_IFont.h"
00029
00030 namespace MyGUI
00031 {
00032
00033 class MYGUI_EXPORT ResourceTrueTypeFont :
00034 public IFont
00035 {
00036 MYGUI_RTTI_DERIVED( ResourceTrueTypeFont )
00037
00038 public:
00039 typedef std::vector<PairCodePoint> VectorPairCodePoint;
00040 typedef std::vector<RangeInfo> VectorRangeInfo;
00041 typedef std::vector<PairCodeCoord> VectorPairCodeCoord;
00042
00043 public:
00044 ResourceTrueTypeFont();
00045 virtual ~ResourceTrueTypeFont();
00046
00047 virtual void deserialization(xml::ElementPtr _node, Version _version);
00048
00049 virtual GlyphInfo* getGlyphInfo(Char _id);
00050
00051 virtual ITexture* getTextureFont() { return mTexture; }
00052
00053
00054 virtual int getDefaultHeight() { return mHeightPix; }
00055
00056 private:
00057 void addCodePointRange(Char _first, Char _second);
00058 void addHideCodePointRange(Char _first, Char _second);
00059
00060
00061 bool checkHidePointCode(Char _id);
00062
00064 void clearCodePointRanges();
00065
00066 void initialise();
00067
00068 void addGlyph(GlyphInfo * _info, Char _index, int _left, int _top, int _right, int _bottom, int _finalw, int _finalh, float _aspect, int _addHeight = 0);
00069
00070 uint8* writeData(uint8* _pDest, unsigned char _luminance, unsigned char _alpha, bool _rgba);
00071
00072 private:
00073
00074 std::string mSource;
00075
00076 float mTtfSize;
00077
00078 uint mTtfResolution;
00079
00080 bool mAntialiasColour;
00081
00082 int mDistance;
00083 int mSpaceWidth;
00084 int mTabWidth;
00085 int mCursorWidth;
00086 int mSelectionWidth;
00087 int mOffsetHeight;
00088 int mHeightPix;
00089
00090
00091 GlyphInfo mSpaceGlyphInfo, mTabGlyphInfo, mSelectGlyphInfo, mSelectDeactiveGlyphInfo, mCursorGlyphInfo;
00092
00093
00094 VectorPairCodePoint mVectorHideCodePoint;
00095
00096
00097 VectorRangeInfo mVectorRangeInfo;
00098
00099 MyGUI::ITexture* mTexture;
00100
00101 };
00102
00103 }
00104
00105 #endif // __MYGUI_RESOURCE_TRUE_TYPE_FONT_H__