root/OpenSceneGraph/trunk/src/osgPlugins/freetype/FreeTypeFont.h @ 13041

Revision 13041, 2.0 kB (checked in by robert, 3 years 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/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version.  The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 * OpenSceneGraph Public License for more details.
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
22class FreeTypeFont : public osgText::Font::FontImplementation
23{
24// declare the interface to a font.
25public:
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
48protected:
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
Note: See TracBrowser for help on using the browser.