FTGL: FTGlyph.h Source File

FTGL 2.4.0

FTGlyph.h
Go to the documentation of this file.
1/*
2 * FTGL - OpenGL font library
3 *
4 * Copyright (c) 2001-2004 Henry Maddocks <ftgl@opengl.geek.nz>
5 * Copyright (c) 2008 Sam Hocevar <sam@hocevar.net>
6 * Copyright (c) 2008 Sean Morrison <learner@brlcad.org>
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining
9 * a copy of this software and associated documentation files (the
10 * "Software"), to deal in the Software without restriction, including
11 * without limitation the rights to use, copy, modify, merge, publish,
12 * distribute, sublicense, and/or sell copies of the Software, and to
13 * permit persons to whom the Software is furnished to do so, subject to
14 * the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be
17 * included in all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
23 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 */
27
28#ifndef __ftgl__
29# warning This header is deprecated. Please use <FTGL/ftgl.h> from now.
30# include <FTGL/ftgl.h>
31#endif
32
33#ifndef __FTGlyph__
34#define __FTGlyph__
35
36#ifdef __cplusplus
37
38class FTGlyphImpl;
39
50 class FTGL_EXPORT FTGlyph
51{
52 protected:
58 FTGlyph(FT_GlyphSlot glyph);
59
60 private:
67 FTGlyph(FTGlyphImpl *pImpl);
68
69 /* Allow our internal subclasses to access the private constructor */
70 friend class FTBitmapGlyph;
71 friend class FTBufferGlyph;
72 friend class FTExtrudeGlyph;
73 friend class FTOutlineGlyph;
74 friend class FTPixmapGlyph;
75 friend class FTPolygonGlyph;
76 friend class FTTextureGlyph;
77 friend class FTTriangleExtractorGlyph;
78
79 public:
83 virtual ~FTGlyph();
84
92 virtual const FTPoint& Render(const FTPoint& pen, int renderMode) = 0;
93
99 virtual float Advance() const;
100
106 virtual const FTBBox& BBox() const;
107
113 virtual FT_Error Error() const;
114
115 private:
119 FTGlyphImpl *impl;
120};
121
122#endif //__cplusplus
123
124 FTGL_BEGIN_C_DECLS
125
133struct _FTGLGlyph;
134 typedef struct _FTGLglyph FTGLglyph;
135
146 FTGL_EXPORT FTGLglyph *ftglCreateCustomGlyph(FTGLglyph *base, void *data,
147 void (*renderCallback) (FTGLglyph *, void *, FTGL_DOUBLE, FTGL_DOUBLE,
148 int, FTGL_DOUBLE *, FTGL_DOUBLE *),
149 void (*destroyCallback) (FTGLglyph *, void *));
150
156 FTGL_EXPORT void ftglDestroyGlyph(FTGLglyph *glyph);
157
171 FTGL_EXPORT void ftglRenderGlyph(FTGLglyph *glyph, FTGL_DOUBLE penx,
172 FTGL_DOUBLE peny, int renderMode,
173 FTGL_DOUBLE *advancex, FTGL_DOUBLE *advancey);
180 FTGL_EXPORT float ftglGetGlyphAdvance(FTGLglyph *glyph);
181
189 FTGL_EXPORT void ftglGetGlyphBBox(FTGLglyph *glyph, float bounds[6]);
190
197 FTGL_EXPORT FT_Error ftglGetGlyphError(FTGLglyph* glyph);
198
199 FTGL_END_C_DECLS
200
201#endif // __FTGlyph__
202
ftglGetGlyphBBox
void ftglGetGlyphBBox(FTGLglyph *glyph, float bounds[6])
Return the bounding box for a glyph.
ftglRenderGlyph
void ftglRenderGlyph(FTGLglyph *glyph, FTGL_DOUBLE penx, FTGL_DOUBLE peny, int renderMode, FTGL_DOUBLE *advancex, FTGL_DOUBLE *advancey)
Render a glyph at the current pen position and compute the corresponding advance.
FTGLglyph
struct _FTGLglyph FTGLglyph
Definition FTGlyph.h:134
ftglGetGlyphAdvance
float ftglGetGlyphAdvance(FTGLglyph *glyph)
Return the advance for a glyph.
ftglCreateCustomGlyph
FTGLglyph * ftglCreateCustomGlyph(FTGLglyph *base, void *data, void(*renderCallback)(FTGLglyph *, void *, FTGL_DOUBLE, FTGL_DOUBLE, int, FTGL_DOUBLE *, FTGL_DOUBLE *), void(*destroyCallback)(FTGLglyph *, void *))
Create a custom FTGL glyph object.
ftglGetGlyphError
FT_Error ftglGetGlyphError(FTGLglyph *glyph)
Query a glyph for errors.
ftglDestroyGlyph
void ftglDestroyGlyph(FTGLglyph *glyph)
Destroy an FTGL glyph object.
FTBBox
FTBBox is a convenience class for handling bounding boxes.
Definition FTBBox.h:43
FTGlyph::FTTextureGlyph
friend class FTTextureGlyph
Definition FTGlyph.h:76
FTGlyph::FTPolygonGlyph
friend class FTPolygonGlyph
Definition FTGlyph.h:75
FTGlyph::Advance
virtual float Advance() const
Return the advance width for this glyph.
FTGlyph::BBox
virtual const FTBBox & BBox() const
Return the bounding box for this glyph.
FTGlyph::FTBufferGlyph
friend class FTBufferGlyph
Definition FTGlyph.h:71
FTGlyph::FTExtrudeGlyph
friend class FTExtrudeGlyph
Definition FTGlyph.h:72
FTGlyph::FTGlyph
FTGlyph(FT_GlyphSlot glyph)
Create a glyph.
FTGlyph::FTBitmapGlyph
friend class FTBitmapGlyph
Definition FTGlyph.h:70
FTGlyph::FTPixmapGlyph
friend class FTPixmapGlyph
Definition FTGlyph.h:74
FTGlyph::FTOutlineGlyph
friend class FTOutlineGlyph
Definition FTGlyph.h:73
FTGlyph::Error
virtual FT_Error Error() const
Queries for errors.
FTGlyph::~FTGlyph
virtual ~FTGlyph()
Destructor.
FTGlyph::Render
virtual const FTPoint & Render(const FTPoint &pen, int renderMode)=0
Renders this glyph at the current pen position.
FTGlyph::FTTriangleExtractorGlyph
friend class FTTriangleExtractorGlyph
Definition FTGlyph.h:77
FTPoint
FTPoint class is a basic 3-dimensional point or vector.
Definition FTPoint.h:43
ftgl.h
FTGL_BEGIN_C_DECLS
#define FTGL_BEGIN_C_DECLS
Definition ftgl.h:43
FTGL_END_C_DECLS
#define FTGL_END_C_DECLS
Definition ftgl.h:44
FTGL_EXPORT
#define FTGL_EXPORT
Definition ftgl.h:134
FTGL_DOUBLE
double FTGL_DOUBLE
Definition ftgl.h:38