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

« back to all changes in this revision

Viewing changes to extern/bFTGL/include/FTFace.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     __FTFace__
 
2
#define     __FTFace__
 
3
 
 
4
#include <ft2build.h>
 
5
#include FT_FREETYPE_H
 
6
#include FT_GLYPH_H
 
7
 
 
8
#include "FTGL.h"
 
9
#include "FTPoint.h"
 
10
#include "FTSize.h"
 
11
 
 
12
/**
 
13
 * FTFace class provides an abstraction layer for the Freetype Face.
 
14
 *
 
15
 * @see "Freetype 2 Documentation"
 
16
 *
 
17
 */
 
18
class FTGL_EXPORT FTFace
 
19
{
 
20
    public:
 
21
        /**
 
22
         * Opens and reads a face file. Error is set.
 
23
         *
 
24
         * @param filename  font file name.
 
25
         */
 
26
        FTFace( const char* filename);
 
27
 
 
28
        /**
 
29
         * Read face data from an in-memory buffer. Error is set.
 
30
         *
 
31
         * @param pBufferBytes  the in-memory buffer
 
32
         * @param bufferSizeInBytes  the length of the buffer in bytes
 
33
         */
 
34
        FTFace( const unsigned char *pBufferBytes, size_t bufferSizeInBytes );
 
35
 
 
36
        /**
 
37
         * Destructor
 
38
         *
 
39
         * Disposes of the current Freetype Face.
 
40
         */
 
41
        virtual ~FTFace();
 
42
 
 
43
        /**
 
44
         * Attach auxilliary file to font (e.g., font metrics).
 
45
         *
 
46
         * @param filename  auxilliary font file name.
 
47
         * @return          <code>true</code> if file has opened
 
48
         *                  successfully.
 
49
         */
 
50
        bool Attach( const char* filename);
 
51
 
 
52
        /**
 
53
         * Attach auxilliary data to font (e.g., font metrics) from memory
 
54
         *
 
55
         * @param pBufferBytes  the in-memory buffer
 
56
         * @param bufferSizeInBytes  the length of the buffer in bytes
 
57
         * @return          <code>true</code> if file has opened
 
58
         *                  successfully.
 
59
         */
 
60
        bool Attach( const unsigned char *pBufferBytes, size_t bufferSizeInBytes);
 
61
 
 
62
        /**
 
63
         * Disposes of the face
 
64
         */
 
65
        void Close();
 
66
 
 
67
        /**
 
68
         * Get the freetype face object..
 
69
         *
 
70
         * @return pointer to an FT_Face.
 
71
         */
 
72
        FT_Face* Face() const { return ftFace;}
 
73
        
 
74
        /**
 
75
         * Sets the char size for the current face.
 
76
         *
 
77
         * This doesn't guarantee that the size was set correctly. Clients
 
78
         * should check errors.
 
79
         *
 
80
         * @param size      the face size in points (1/72 inch)
 
81
         * @param res       the resolution of the target device.
 
82
         * @return          <code>FTSize</code> object
 
83
         */
 
84
        const FTSize& Size( const unsigned int size, const unsigned int res);
 
85
 
 
86
        unsigned int UnitsPerEM() const;
 
87
 
 
88
        /**
 
89
         * Get the number of character maps in this face.
 
90
         *
 
91
         * @return character map count.
 
92
         */
 
93
        unsigned int CharMapCount();
 
94
 
 
95
        /**
 
96
         * Get a list of character maps in this face.
 
97
         *
 
98
         * @return pointer to the first encoding.
 
99
         */
 
100
        FT_Encoding* CharMapList();
 
101
        
 
102
        /**
 
103
         * Gets the kerning vector between two glyphs
 
104
         */
 
105
        FTPoint KernAdvance( unsigned int index1, unsigned int index2);
 
106
 
 
107
        /**
 
108
         * Loads and creates a Freetype glyph.
 
109
         */
 
110
        FT_GlyphSlot Glyph( unsigned int index, FT_Int load_flags);
 
111
 
 
112
        /**
 
113
         * Gets the number of glyphs in the current face.
 
114
         */
 
115
        unsigned int GlyphCount() const { return numGlyphs;}
 
116
 
 
117
        /**
 
118
         * Queries for errors.
 
119
         *
 
120
         * @return  The current error code.
 
121
         */
 
122
        FT_Error Error() const { return err; }
 
123
        
 
124
    private:
 
125
        /**
 
126
         * The Freetype face
 
127
         */
 
128
        FT_Face* ftFace;
 
129
 
 
130
        /**
 
131
         * The size object associated with this face
 
132
         */
 
133
        FTSize  charSize;
 
134
        
 
135
        /**
 
136
         * The number of glyphs in this face
 
137
         */
 
138
        int numGlyphs;
 
139
        
 
140
        FT_Encoding* fontEncodingList;
 
141
 
 
142
        /**
 
143
         * Current error code. Zero means no error.
 
144
         */
 
145
        FT_Error err;
 
146
};
 
147
 
 
148
 
 
149
#endif  //  __FTFace__