~ubuntu-branches/ubuntu/gutsy/blender/gutsy-security

« back to all changes in this revision

Viewing changes to extern/bFTGL/include/FTGlyphContainer.h

  • Committer: Bazaar Package Importer
  • Author(s): Florian Ernst
  • Date: 2005-11-06 12:40:03 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051106124003-3pgs7tcg5rox96xg
Tags: 2.37a-1.1
* Non-maintainer upload.
* Split out parts of 01_SConstruct_debian.dpatch again: root_build_dir
  really needs to get adjusted before the clean target runs - closes: #333958,
  see #288882 for reference

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef     __FTGlyphContainer__
 
2
#define     __FTGlyphContainer__
 
3
 
 
4
#include <ft2build.h>
 
5
#include FT_FREETYPE_H
 
6
#include FT_GLYPH_H
 
7
 
 
8
#include "FTGL.h"
 
9
#include "FTBBox.h"
 
10
#include "FTPoint.h"
 
11
#include "FTVector.h"
 
12
 
 
13
class FTFace;
 
14
class FTGlyph;
 
15
class FTCharmap;
 
16
 
 
17
/**
 
18
 * FTGlyphContainer holds the post processed FTGlyph objects.
 
19
 *
 
20
 * @see FTGlyph
 
21
 */
 
22
class FTGL_EXPORT FTGlyphContainer
 
23
{
 
24
        typedef FTVector<FTGlyph*> GlyphVector;
 
25
    public:
 
26
        /**
 
27
         * Constructor
 
28
         *
 
29
         * @param face      The Freetype face
 
30
         */
 
31
        FTGlyphContainer( FTFace* face);
 
32
 
 
33
        /**
 
34
         * Destructor
 
35
         */
 
36
        ~FTGlyphContainer();
 
37
 
 
38
        /**
 
39
         * Sets the character map for the face.
 
40
         *
 
41
         * @param encoding      the Freetype encoding symbol. See above.
 
42
         * @return              <code>true</code> if charmap was valid
 
43
         *                      and set correctly
 
44
         */
 
45
        bool CharMap( FT_Encoding encoding);
 
46
 
 
47
        /**
 
48
         * Get the font index of the input character.
 
49
         *
 
50
         * @param characterCode The character code of the requested glyph in the
 
51
         *                      current encoding eg apple roman.
 
52
         * @return      The font index for the character.
 
53
         */
 
54
        unsigned int FontIndex( const unsigned int characterCode ) const;
 
55
        
 
56
        /**
 
57
         * Adds a glyph to this glyph list.
 
58
         *
 
59
         * @param glyph         The FTGlyph to be inserted into the container
 
60
         * @param characterCode The char code of the glyph NOT the glyph index.
 
61
         */
 
62
        void Add( FTGlyph* glyph, const unsigned int characterCode);
 
63
 
 
64
        /**
 
65
         * Get a glyph from the glyph list
 
66
         *
 
67
         * @param characterCode The char code of the glyph NOT the glyph index      
 
68
         * @return              An FTGlyph or <code>null</code> is it hasn't been
 
69
         * loaded.
 
70
         */
 
71
        const FTGlyph* const Glyph( const unsigned int characterCode) const;
 
72
 
 
73
        /**
 
74
         * Get the bounding box for a character.
 
75
         * @param characterCode The char code of the glyph NOT the glyph index      
 
76
         */
 
77
        FTBBox BBox( const unsigned int characterCode) const;
 
78
        
 
79
        /**
 
80
        * Returns the kerned advance width for a glyph.
 
81
        *
 
82
        * @param characterCode     glyph index of the character
 
83
        * @param nextCharacterCode the next glyph in a string
 
84
        * @return                  advance width
 
85
        */
 
86
        float Advance( const unsigned int characterCode, const unsigned int nextCharacterCode);
 
87
        
 
88
        /**
 
89
         * Renders a character
 
90
         * @param characterCode      the glyph to be Rendered
 
91
         * @param nextCharacterCode  the next glyph in the string. Used for kerning.
 
92
         * @param penPosition        the position to Render the glyph
 
93
         * @return                   The distance to advance the pen position after Rendering
 
94
         */
 
95
        FTPoint Render( const unsigned int characterCode, const unsigned int nextCharacterCode, FTPoint penPosition);
 
96
        
 
97
        /**
 
98
         * Queries the Font for errors.
 
99
         *
 
100
         * @return  The current error code.
 
101
         */
 
102
        FT_Error Error() const { return err;}
 
103
 
 
104
    private:
 
105
        /**
 
106
         * The FTGL face
 
107
         */
 
108
        FTFace* face;
 
109
 
 
110
        /**
 
111
         * The Character Map object associated with the current face
 
112
         */
 
113
        FTCharmap* charMap;
 
114
 
 
115
        /**
 
116
         * A structure to hold the glyphs
 
117
         */
 
118
        GlyphVector glyphs;
 
119
 
 
120
        /**
 
121
         * Current error code. Zero means no error.
 
122
         */
 
123
        FT_Error err;
 
124
};
 
125
 
 
126
 
 
127
#endif  //  __FTGlyphContainer__