FTGL 2.1.3~rc5
FTGlyph.h
Go to the documentation of this file.
00001 /*
00002  * FTGL - OpenGL font library
00003  *
00004  * Copyright (c) 2001-2004 Henry Maddocks <ftgl@opengl.geek.nz>
00005  * Copyright (c) 2008 Sam Hocevar <sam@zoy.org>
00006  * Copyright (c) 2008 Sean Morrison <learner@brlcad.org>
00007  *
00008  * Permission is hereby granted, free of charge, to any person obtaining
00009  * a copy of this software and associated documentation files (the
00010  * "Software"), to deal in the Software without restriction, including
00011  * without limitation the rights to use, copy, modify, merge, publish,
00012  * distribute, sublicense, and/or sell copies of the Software, and to
00013  * permit persons to whom the Software is furnished to do so, subject to
00014  * the following conditions:
00015  *
00016  * The above copyright notice and this permission notice shall be
00017  * included in all copies or substantial portions of the Software.
00018  *
00019  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00020  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00021  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00022  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
00023  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
00024  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
00025  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00026  */
00027 
00028 #ifndef __ftgl__
00029 #   warning This header is deprecated. Please use <FTGL/ftgl.h> from now.
00030 #   include <FTGL/ftgl.h>
00031 #endif
00032 
00033 #ifndef __FTGlyph__
00034 #define __FTGlyph__
00035 
00036 #ifdef __cplusplus
00037 
00038 class FTGlyphImpl;
00039 
00050 class FTGL_EXPORT FTGlyph
00051 {
00052     protected:
00058         FTGlyph(FT_GlyphSlot glyph);
00059 
00060     private:
00067         FTGlyph(FTGlyphImpl *pImpl);
00068 
00069         /* Allow our internal subclasses to access the private constructor */
00070         friend class FTBitmapGlyph;
00071         friend class FTBufferGlyph;
00072         friend class FTExtrudeGlyph;
00073         friend class FTOutlineGlyph;
00074         friend class FTPixmapGlyph;
00075         friend class FTPolygonGlyph;
00076         friend class FTTextureGlyph;
00077 
00078     public:
00082         virtual ~FTGlyph();
00083 
00091         virtual const FTPoint& Render(const FTPoint& pen, int renderMode) = 0;
00092 
00098         virtual float Advance() const;
00099 
00105         virtual const FTBBox& BBox() const;
00106 
00112         virtual FT_Error Error() const;
00113 
00114     private:
00118         FTGlyphImpl *impl;
00119 };
00120 
00121 #endif //__cplusplus
00122 
00123 FTGL_BEGIN_C_DECLS
00124 
00132 struct _FTGLGlyph;
00133 typedef struct _FTGLglyph FTGLglyph;
00134 
00145 FTGL_EXPORT FTGLglyph *ftglCreateCustomGlyph(FTGLglyph *base, void *data,
00146     void (*renderCallback) (FTGLglyph *, void *, FTGL_DOUBLE, FTGL_DOUBLE,
00147                              int, FTGL_DOUBLE *, FTGL_DOUBLE *),
00148     void (*destroyCallback) (FTGLglyph *, void *));
00149 
00155 FTGL_EXPORT void ftglDestroyGlyph(FTGLglyph *glyph);
00156 
00170 FTGL_EXPORT void ftglRenderGlyph(FTGLglyph *glyph, FTGL_DOUBLE penx,
00171                                  FTGL_DOUBLE peny, int renderMode,
00172                                  FTGL_DOUBLE *advancex, FTGL_DOUBLE *advancey);
00179 FTGL_EXPORT float ftglGetGlyphAdvance(FTGLglyph *glyph);
00180 
00188 FTGL_EXPORT void ftglGetGlyphBBox(FTGLglyph *glyph, float bounds[6]);
00189 
00196 FTGL_EXPORT FT_Error ftglGetGlyphError(FTGLglyph* glyph);
00197 
00198 FTGL_END_C_DECLS
00199 
00200 #endif  //  __FTGlyph__
00201