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 #define __ftgl__ 30 31 /* We need the Freetype headers */ 32 #include <ft2build.h> 33 #include FT_FREETYPE_H 34 #include FT_GLYPH_H 35 #include FT_OUTLINE_H 36 37 /* Floating point types used by the library */ 38 typedef double FTGL_DOUBLE; 39 typedef float FTGL_FLOAT; 40 41 /* Macros used to declare C-linkage types and symbols */ 42 #ifdef __cplusplus 43 # define FTGL_BEGIN_C_DECLS extern "C" { namespace FTGL { 44 # define FTGL_END_C_DECLS } } 45 #else 46 # define FTGL_BEGIN_C_DECLS 47 # define FTGL_END_C_DECLS 48 #endif 49 50 #ifdef __cplusplus 51 namespace FTGL 52 { 53 typedef enum 54 { 55 RENDER_FRONT = 0x0001, 56 RENDER_BACK = 0x0002, 57 RENDER_SIDE = 0x0004, 58 RENDER_ALL = 0xffff 59 } RenderMode; 60 61 typedef enum 62 { 63 ALIGN_LEFT = 0, 64 ALIGN_CENTER = 1, 65 ALIGN_RIGHT = 2, 66 ALIGN_JUSTIFY = 3 67 } TextAlignment; 68 69 typedef enum 70 { 71 CONFIG_VERSION = 1, 72 } ConfigString; 73 74 /** 75 * Return a string describing the current %FTGL instance 76 * 77 * @param config Name of the string to retrieve. Can be one of: 78 * - CONFIG_VERSION: return the %FTGL release number. 79 * @return A pointer to a constant string containing the requested 80 * information, or 0 in case of invalid argument. 81 */ 82 extern char const *GetString(ConfigString config); 83 } 84 #else 85 # define FTGL_RENDER_FRONT 0x0001 86 # define FTGL_RENDER_BACK 0x0002 87 # define FTGL_RENDER_SIDE 0x0004 88 # define FTGL_RENDER_ALL 0xffff 89 90 # define FTGL_ALIGN_LEFT 0 91 # define FTGL_ALIGN_CENTER 1 92 # define FTGL_ALIGN_RIGHT 2 93 # define FTGL_ALIGN_JUSTIFY 3 94 95 # define FTGL_CONFIG_VERSION 1 96 97 /** 98 * Return a string describing the current %FTGL instance 99 * 100 * @param config Name of the string to retrieve. Can be one of: 101 * - FTGL_CONFIG_VERSION: return the %FTGL release number. 102 * @return A pointer to a constant string containing the requested 103 * information, or NULL in case of invalid argument. 104 */ 105 extern char const *ftglGetString(int config); 106 #endif 107 108 // Compiler-specific conditional compilation 109 #ifdef _MSC_VER // MS Visual C++ 110 111 // Disable various warning. 112 // 4786: template name too long 113 #pragma warning(disable : 4251) 114 #pragma warning(disable : 4275) 115 #pragma warning(disable : 4786) 116 117 // The following definitions control how symbols are exported. 118 // If the target is a static library ensure that FTGL_LIBRARY_STATIC 119 // is defined. If building a dynamic library (ie DLL) ensure the 120 // FTGL_LIBRARY macro is defined, as it will mark symbols for 121 // export. If compiling a project to _use_ the _dynamic_ library 122 // version of the library, no definition is required. 123 #ifdef FTGL_LIBRARY_STATIC // static lib - no special export required 124 # define FTGL_EXPORT 125 #elif FTGL_LIBRARY // dynamic lib - must export/import symbols appropriately. 126 # define FTGL_EXPORT __declspec(dllexport) 127 #else 128 # define FTGL_EXPORT __declspec(dllimport) 129 #endif 130 131 #else 132 // Compiler that is not MS Visual C++. 133 // Ensure that the export symbol is defined (and blank) 134 #define FTGL_EXPORT 135 #endif 136 137 #include <FTGL/FTLibrary.h> 138 139 #include <FTGL/FTPoint.h> 140 #include <FTGL/FTBBox.h> 141 #include <FTGL/FTBuffer.h> 142 143 #include <FTGL/FTGlyph.h> 144 #include <FTGL/FTBitmapGlyph.h> 145 #include <FTGL/FTBufferGlyph.h> 146 #include <FTGL/FTExtrdGlyph.h> 147 #include <FTGL/FTOutlineGlyph.h> 148 #include <FTGL/FTPixmapGlyph.h> 149 #include <FTGL/FTPolyGlyph.h> 150 #include <FTGL/FTTextureGlyph.h> 151 #include <FTGL/FTTriangleExtractorGlyph.h> 152 153 #include <FTGL/FTFont.h> 154 #include <FTGL/FTGLBitmapFont.h> 155 #include <FTGL/FTBufferFont.h> 156 #include <FTGL/FTGLExtrdFont.h> 157 #include <FTGL/FTGLOutlineFont.h> 158 #include <FTGL/FTGLPixmapFont.h> 159 #include <FTGL/FTGLPolygonFont.h> 160 #include <FTGL/FTGLTextureFont.h> 161 #include <FTGL/FTGLTriangleExtractorFont.h> 162 163 #include <FTGL/FTLayout.h> 164 #include <FTGL/FTSimpleLayout.h> 165 166 #endif // __ftgl__ 167