|
Revision 13041, 2.0 kB
(checked in by robert, 14 months ago)
|
|
Ran script to remove trailing spaces and tabs
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Author Date Id Revision
|
| Line | |
|---|
| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | #ifndef FREETYPE_FONT |
|---|
| 15 | #define FREETYPE_FONT 1 |
|---|
| 16 | |
|---|
| 17 | #include <osgText/Font> |
|---|
| 18 | |
|---|
| 19 | #include <ft2build.h> |
|---|
| 20 | #include FT_FREETYPE_H |
|---|
| 21 | |
|---|
| 22 | class FreeTypeFont : public osgText::Font::FontImplementation |
|---|
| 23 | { |
|---|
| 24 | |
|---|
| 25 | public: |
|---|
| 26 | |
|---|
| 27 | FreeTypeFont(const std::string& filename, FT_Face face, unsigned int flags); |
|---|
| 28 | FreeTypeFont(FT_Byte* buffer, FT_Face face, unsigned int flags); |
|---|
| 29 | |
|---|
| 30 | virtual ~FreeTypeFont(); |
|---|
| 31 | |
|---|
| 32 | virtual std::string getFileName() const { return _filename; } |
|---|
| 33 | |
|---|
| 34 | virtual bool supportsMultipleFontResolutions() const { return true; } |
|---|
| 35 | |
|---|
| 36 | virtual osgText::Glyph* getGlyph(const osgText::FontResolution& fontRes,unsigned int charcode); |
|---|
| 37 | |
|---|
| 38 | virtual osgText::Glyph3D* getGlyph3D(unsigned int charcode); |
|---|
| 39 | |
|---|
| 40 | virtual osg::Vec2 getKerning(unsigned int leftcharcode,unsigned int rightcharcode, osgText::KerningType _kerningType); |
|---|
| 41 | |
|---|
| 42 | virtual bool hasVertical() const; |
|---|
| 43 | |
|---|
| 44 | virtual bool getVerticalSize(float & ascender, float & descender) const; |
|---|
| 45 | |
|---|
| 46 | float getCoordScale() const; |
|---|
| 47 | |
|---|
| 48 | protected: |
|---|
| 49 | |
|---|
| 50 | void init(); |
|---|
| 51 | |
|---|
| 52 | void setFontResolution(const osgText::FontResolution& fontSize); |
|---|
| 53 | |
|---|
| 54 | osgText::FontResolution _currentRes; |
|---|
| 55 | |
|---|
| 56 | long ft_round( long x ) { return (( x + 32 ) & -64); } |
|---|
| 57 | long ft_floor( long x ) { return (x & -64); } |
|---|
| 58 | long ft_ceiling( long x ){ return (( x + 63 ) & -64); } |
|---|
| 59 | |
|---|
| 60 | std::string _filename; |
|---|
| 61 | FT_Byte* _buffer; |
|---|
| 62 | FT_Face _face; |
|---|
| 63 | unsigned int _flags; |
|---|
| 64 | }; |
|---|
| 65 | |
|---|
| 66 | #endif |
|---|