* Document the C bindings for FTGlyph.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438
diff --git a/src/FTFont/FTFontGlue.cpp b/src/FTFont/FTFontGlue.cpp
index 3ae8189..14ddc79 100644
--- a/src/FTFont/FTFontGlue.cpp
+++ b/src/FTFont/FTFontGlue.cpp
@@ -167,7 +167,7 @@ C_FUN(void, ftglSetFontOutset, (FTGLfont *f, float front, float back),
return, FTFont::Outset, (front, back));
// void FTFont::UseDisplayList(bool useList);
-C_FUN(void, ftglFontUseDisplayList, (FTGLfont *f, int l),
+C_FUN(void, ftglSetFontDisplayList, (FTGLfont *f, int l),
return, UseDisplayList, (l));
// float FTFont::Ascender() const;
diff --git a/src/FTGL/FTBitmapGlyph.h b/src/FTGL/FTBitmapGlyph.h
index 9b5ea72..5b8a75d 100644
--- a/src/FTGL/FTBitmapGlyph.h
+++ b/src/FTGL/FTBitmapGlyph.h
@@ -37,12 +37,7 @@
/**
* FTBitmapGlyph is a specialisation of FTGlyph for creating bitmaps.
*
- * It provides the interface between Freetype glyphs and their openGL
- * Renderable counterparts. This is an abstract class and derived classes
- * must implement the <code>Render</code> function.
- *
* @see FTGlyphContainer
- *
*/
class FTGL_EXPORT FTBitmapGlyph : public FTGlyph
{
@@ -62,5 +57,17 @@ class FTGL_EXPORT FTBitmapGlyph : public FTGlyph
#endif //__cplusplus
+FTGL_BEGIN_C_DECLS
+
+/**
+ * Create a specialisation of FTGLglyph for creating bitmaps.
+ *
+ * @param glyph The Freetype glyph to be processed
+ * @return An FTGLglyph* object.
+ */
+FTGL_EXPORT FTGLglyph *ftglCreateBitmapGlyph(FT_GlyphSlot glyph);
+
+FTGL_END_C_DECLS
+
#endif // __FTBitmapGlyph__
diff --git a/src/FTGL/FTExtrdGlyph.h b/src/FTGL/FTExtrdGlyph.h
index 59ae27e..ff81818 100644
--- a/src/FTGL/FTExtrdGlyph.h
+++ b/src/FTGL/FTExtrdGlyph.h
@@ -71,5 +71,27 @@ class FTGL_EXPORT FTExtrudeGlyph : public FTGlyph
#endif //__cplusplus
+FTGL_BEGIN_C_DECLS
+
+/**
+ * Create a specialisation of FTGLglyph for creating tessellated
+ * extruded polygon glyphs.
+ *
+ * @param glyph The Freetype glyph to be processed
+ * @param depth The distance along the z axis to extrude the glyph
+ * @param frontOutset outset contour size
+ * @param backOutset outset contour size
+ * @param useDisplayList Enable or disable the use of Display Lists
+ * for this glyph
+ * <code>true</code> turns ON display lists.
+ * <code>false</code> turns OFF display lists.
+ * @return An FTGLglyph* object.
+ */
+FTGL_EXPORT FTGLglyph *ftglCreateExtrudeGlyph(FT_GlyphSlot glyph, float depth,
+ float frontOutset, float backOutset,
+ int useDisplayList);
+
+FTGL_END_C_DECLS
+
#endif // __FTExtrudeGlyph__
diff --git a/src/FTGL/FTFont.h b/src/FTGL/FTFont.h
index fdc8dfd..b3cf799 100644
--- a/src/FTGL/FTFont.h
+++ b/src/FTGL/FTFont.h
@@ -309,6 +309,16 @@ class FTGL_EXPORT FTFont
FTGL_BEGIN_C_DECLS
/**
+ * FTGLfont is the public interface for the FTGL library.
+ *
+ * It is good practice after using these functions to test the error
+ * code returned. <code>FT_Error Error()</code>. Check the freetype file
+ * fterrdef.h for error definitions.
+ */
+struct _FTGLFont;
+typedef struct _FTGLfont FTGLfont;
+
+/**
* Destroy an FTGL font object.
*
* @param font An FTGLfont* object.
@@ -391,7 +401,7 @@ FTGL_EXPORT unsigned int ftglGetFontFaceSize(FTGLfont* font);
* @param font An FTGLfont* object.
* @param depth The extrusion distance.
*/
-FTGL_EXPORT void ftglSetDepth(FTGLfont* font, float depth);
+FTGL_EXPORT void ftglSetFontDepth(FTGLfont* font, float depth);
/**
* Set the outset distance for the font. Only FTOutlineFont, FTPolygonFont
@@ -405,13 +415,13 @@ FTGL_EXPORT void ftglSetDepth(FTGLfont* font, float depth);
FTGL_EXPORT void ftglSetFontOutset(FTGLfont* font, float front, float back);
/**
- * Enable or disable the use of Display Lists inside FTGL
+ * Enable or disable the use of Display Lists inside FTGL.
*
* @param font An FTGLfont* object.
* @param useList 1 turns ON display lists.
* 0 turns OFF display lists.
*/
-FTGL_EXPORT void ftglFontUseDisplayList(FTGLfont* font, int useList);
+FTGL_EXPORT void ftglSetFontDisplayList(FTGLfont* font, int useList);
/**
* Get the global ascender height for the face.
@@ -470,8 +480,9 @@ FTGL_EXPORT float ftglGetFontAdvance(FTGLfont* font, const char *string);
FTGL_EXPORT void ftglRenderFont(FTGLfont* font, const char *string, int mode);
/**
- * Queries the Font for errors.
+ * Query a font for errors.
*
+ * @param font An FTGLfont* object.
* @return The current error code.
*/
FTGL_EXPORT FT_Error ftglGetFontError(FTGLfont* font);
diff --git a/src/FTGL/FTGlyph.h b/src/FTGL/FTGlyph.h
index e49aed5..3318f95 100644
--- a/src/FTGL/FTGlyph.h
+++ b/src/FTGL/FTGlyph.h
@@ -95,28 +95,67 @@ class FTGL_EXPORT FTGlyph
FTGL_BEGIN_C_DECLS
-FTGL_EXPORT FTGLglyph *ftglCreateBitmapGlyph(FT_GlyphSlot glyph);
-FTGL_EXPORT FTGLglyph *ftglCreateExtrudeGlyph(FT_GlyphSlot glyph, float depth,
- float frontOutset, float backOutset,
- int useDisplayList);
-FTGL_EXPORT FTGLglyph *ftglCreateOutlineGlyph(FT_GlyphSlot glyph, float outset,
- int useDisplayList);
-FTGL_EXPORT FTGLglyph *ftglCreatePixmapGlyph(FT_GlyphSlot glyph);
-FTGL_EXPORT FTGLglyph *ftglCreatePolyGlyph(FT_GlyphSlot glyph, float outset,
- int useDisplayList);
-FTGL_EXPORT FTGLglyph *ftglCreateTextureGlyph(FT_GlyphSlot glyph, int id,
- int xOffset, int yOffset,
- int width, int height);
-
-FTGL_EXPORT void ftglDestroyGlyph(FTGLglyph *g);
-
-FTGL_EXPORT void ftglGlyphRender(FTGLglyph *g, FTGL_DOUBLE penx,
+/**
+ * FTGLglyph is the base class for FTGL glyphs.
+ *
+ * It provides the interface between Freetype glyphs and their openGL
+ * renderable counterparts. This is an abstract class and derived classes
+ * must implement the ftglRenderGlyph() function.
+ */
+struct _FTGLGlyph;
+typedef struct _FTGLglyph FTGLglyph;
+
+/**
+ * Destroy an FTGL glyph object.
+ *
+ * @param glyph An FTGLglyph* object.
+ */
+FTGL_EXPORT void ftglDestroyGlyph(FTGLglyph *glyph);
+
+/**
+ * Render a glyph at the current pen position and compute the corresponding
+ * advance.
+ *
+ * @param glyph An FTGLglyph* object.
+ * @param penx The current pen's X position.
+ * @param peny The current pen's Y position.
+ * @param renderMode Render mode to display
+ * @param advancex A pointer to an FTGL_DOUBLE where to write the advance's X
+ * component.
+ * @param advancey A pointer to an FTGL_DOUBLE where to write the advance's Y
+ * component.
+ */
+FTGL_EXPORT void ftglRenderGlyph(FTGLglyph *glyph, FTGL_DOUBLE penx,
FTGL_DOUBLE peny, int renderMode,
FTGL_DOUBLE *advancex, FTGL_DOUBLE *advancey);
-FTGL_EXPORT void ftglGlyphAdvance(FTGLglyph *g, FTGL_DOUBLE *advancex,
- FTGL_DOUBLE *advancey);
-FTGL_EXPORT void ftglGlyphBBox(FTGLglyph *g, float *lx, float *ly, float *lz,
- float *ux, float *uy, float *uz);
+/**
+ * Return the advance for a glyph.
+ *
+ * @param glyph An FTGLglyph* object.
+ * @param advancex A pointer to an FTGL_DOUBLE where to write the advance's X
+ * component.
+ * @param advancey A pointer to an FTGL_DOUBLE where to write the advance's Y
+ * component.
+ */
+FTGL_EXPORT void ftglGetGlyphAdvance(FTGLglyph *glyph, FTGL_DOUBLE *advancex,
+ FTGL_DOUBLE *advancey);
+
+/**
+ * Return the bounding box for a glyph.
+ *
+ * @param glyph An FTGLglyph* object.
+ * @param bounds An array of 6 float values where the bounding box's lower
+ * left near and upper right far 3D coordinates will be stored.
+ */
+FTGL_EXPORT void ftglGetGlyphBBox(FTGLglyph *glyph, float bounds[6]);
+
+/**
+ * Query a glyph for errors.
+ *
+ * @param glyph An FTGLglyph* object.
+ * @return The current error code.
+ */
+FTGL_EXPORT FT_Error ftglGetGlyphError(FTGLglyph* glyph);
FTGL_END_C_DECLS
diff --git a/src/FTGL/FTLayout.h b/src/FTGL/FTLayout.h
index 939d700..ac0cb32 100644
--- a/src/FTGL/FTLayout.h
+++ b/src/FTGL/FTLayout.h
@@ -78,6 +78,9 @@ class FTGL_EXPORT FTLayout
FTGL_BEGIN_C_DECLS
+struct _FTGLlayout;
+typedef struct _FTGLlayout FTGLlayout;
+
FTGL_EXPORT FTGLlayout *ftglCreateSimpleLayout(void);
FTGL_EXPORT void ftglDestroyLayout(FTGLlayout*);
diff --git a/src/FTGL/FTOutlineGlyph.h b/src/FTGL/FTOutlineGlyph.h
index 55ce055..f3ef20a 100644
--- a/src/FTGL/FTOutlineGlyph.h
+++ b/src/FTGL/FTOutlineGlyph.h
@@ -65,5 +65,23 @@ class FTGL_EXPORT FTOutlineGlyph : public FTGlyph
#endif //__cplusplus
+FTGL_BEGIN_C_DECLS
+
+/**
+ * Create a specialisation of FTGLglyph for creating outlines.
+ *
+ * @param glyph The Freetype glyph to be processed
+ * @param outset outset contour size
+ * @param useDisplayList Enable or disable the use of Display Lists
+ * for this glyph
+ * <code>true</code> turns ON display lists.
+ * <code>false</code> turns OFF display lists.
+ * @return An FTGLglyph* object.
+ */
+FTGL_EXPORT FTGLglyph *ftglCreateOutlineGlyph(FT_GlyphSlot glyph, float outset,
+ int useDisplayList);
+
+FTGL_END_C_DECLS
+
#endif // __FTOutlineGlyph__
diff --git a/src/FTGL/FTPixmapGlyph.h b/src/FTGL/FTPixmapGlyph.h
index 645cc3c..77d6941 100644
--- a/src/FTGL/FTPixmapGlyph.h
+++ b/src/FTGL/FTPixmapGlyph.h
@@ -58,5 +58,17 @@ class FTGL_EXPORT FTPixmapGlyph : public FTGlyph
#endif //__cplusplus
+FTGL_BEGIN_C_DECLS
+
+/**
+ * Create a specialisation of FTGLglyph for creating pixmaps.
+ *
+ * @param glyph The Freetype glyph to be processed
+ * @return An FTGLglyph* object.
+ */
+FTGL_EXPORT FTGLglyph *ftglCreatePixmapGlyph(FT_GlyphSlot glyph);
+
+FTGL_END_C_DECLS
+
#endif // __FTPixmapGlyph__
diff --git a/src/FTGL/FTPolyGlyph.h b/src/FTGL/FTPolyGlyph.h
index 9dd53e3..ce2a239 100644
--- a/src/FTGL/FTPolyGlyph.h
+++ b/src/FTGL/FTPolyGlyph.h
@@ -68,5 +68,24 @@ class FTGL_EXPORT FTPolygonGlyph : public FTGlyph
#endif //__cplusplus
+FTGL_BEGIN_C_DECLS
+
+/**
+ * Create a specialisation of FTGLglyph for creating tessellated
+ * polygon glyphs.
+ *
+ * @param glyph The Freetype glyph to be processed
+ * @param outset outset contour size
+ * @param useDisplayList Enable or disable the use of Display Lists
+ * for this glyph
+ * <code>true</code> turns ON display lists.
+ * <code>false</code> turns OFF display lists.
+ * @return An FTGLglyph* object.
+ */
+FTGL_EXPORT FTGLglyph *ftglCreatePolyGlyph(FT_GlyphSlot glyph, float outset,
+ int useDisplayList);
+
+FTGL_END_C_DECLS
+
#endif // __FTPolygonGlyph__
diff --git a/src/FTGL/FTTextureGlyph.h b/src/FTGL/FTTextureGlyph.h
index fe451bd..1cfeec9 100644
--- a/src/FTGL/FTTextureGlyph.h
+++ b/src/FTGL/FTTextureGlyph.h
@@ -68,5 +68,24 @@ class FTGL_EXPORT FTTextureGlyph : public FTGlyph
#endif //__cplusplus
+FTGL_BEGIN_C_DECLS
+
+/**
+ * Create a specialisation of FTGLglyph for creating pixmaps.
+ *
+ * @param glyph The Freetype glyph to be processed.
+ * @param id The id of the texture that this glyph will be drawn in.
+ * @param xOffset The x offset into the parent texture to draw this glyph.
+ * @param yOffset The y offset into the parent texture to draw this glyph.
+ * @param width The width of the parent texture.
+ * @param height The height (number of rows) of the parent texture.
+ * @return An FTGLglyph* object.
+ */
+FTGL_EXPORT FTGLglyph *ftglCreateTextureGlyph(FT_GlyphSlot glyph, int id,
+ int xOffset, int yOffset,
+ int width, int height);
+
+FTGL_END_C_DECLS
+
#endif // __FTTextureGlyph__
diff --git a/src/FTGL/ftgl.h b/src/FTGL/ftgl.h
index 28e4720..6af16b5 100644
--- a/src/FTGL/ftgl.h
+++ b/src/FTGL/ftgl.h
@@ -45,17 +45,6 @@ typedef float FTGL_FLOAT;
# define FTGL_END_C_DECLS
#endif
-FTGL_BEGIN_C_DECLS
-
- struct _FTGLGlyph;
- typedef struct _FTGLglyph FTGLglyph;
- struct _FTGLFont;
- typedef struct _FTGLfont FTGLfont;
- struct _FTGLlayout;
- typedef struct _FTGLlayout FTGLlayout;
-
-FTGL_END_C_DECLS
-
#ifdef __cplusplus
namespace FTGL
{
diff --git a/src/FTGlyph/FTGlyphGlue.cpp b/src/FTGlyph/FTGlyphGlue.cpp
index 71e394f..a6870d4 100644
--- a/src/FTGlyph/FTGlyphGlue.cpp
+++ b/src/FTGlyph/FTGlyphGlue.cpp
@@ -140,47 +140,46 @@ void ftglDestroyGlyph(FTGLglyph *g)
}
// const FTPoint& FTGlyph::Render(const FTPoint& pen, int renderMode);
-C_FUN(static const FTPoint&, _ftglGlyphRender, (FTGLglyph *g,
+C_FUN(static const FTPoint&, _ftglRenderGlyph, (FTGLglyph *g,
const FTPoint& pen, int renderMode),
return static_ftpoint, Render, (pen, renderMode));
-void ftglGlyphRender(FTGLglyph *g, FTGL_DOUBLE penx, FTGL_DOUBLE peny,
+void ftglRenderGlyph(FTGLglyph *g, FTGL_DOUBLE penx, FTGL_DOUBLE peny,
int renderMode, FTGL_DOUBLE *advancex,
FTGL_DOUBLE *advancey)
{
FTPoint pen(penx, peny);
- FTPoint ret = _ftglGlyphRender(g, pen, renderMode);
+ FTPoint ret = _ftglRenderGlyph(g, pen, renderMode);
*advancex = ret.X();
*advancey = ret.Y();
}
// const FTPoint& FTGlyph::Advance() const;
-C_FUN(static const FTPoint&, _ftglGlyphAdvance, (FTGLglyph *g),
+C_FUN(static const FTPoint&, _ftglGetGlyphAdvance, (FTGLglyph *g),
return static_ftpoint, Advance, ());
-void ftglGlyphAdvance(FTGLglyph *g, FTGL_DOUBLE *advancex,
- FTGL_DOUBLE *advancey)
+void ftglGetGlyphAdvance(FTGLglyph *g, FTGL_DOUBLE *advancex,
+ FTGL_DOUBLE *advancey)
{
- FTPoint ret = _ftglGlyphAdvance(g);
+ FTPoint ret = _ftglGetGlyphAdvance(g);
*advancex = ret.X();
*advancey = ret.Y();
}
// const FTBBox& FTGlyph::BBox() const;
-C_FUN(static const FTBBox&, _ftglGlyphBBox, (FTGLglyph *g),
+C_FUN(static const FTBBox&, _ftglGetGlyphBBox, (FTGLglyph *g),
return static_ftbbox, BBox, ());
-void ftglGlyphBBox(FTGLglyph *g, float *lx, float *ly, float *lz,
- float *ux, float *uy, float *uz)
+void ftglGetGlyphBBox(FTGLglyph *g, float bounds[6])
{
- FTBBox ret = _ftglGlyphBBox(g);
+ FTBBox ret = _ftglGetGlyphBBox(g);
FTPoint lower = ret.Lower(), upper = ret.Upper();
- *lx = lower.X(); *ly = lower.Y(); *lz = lower.Z();
- *ux = upper.X(); *uy = upper.Y(); *uz = upper.Z();
+ bounds[0] = lower.X(); bounds[1] = lower.Y(); bounds[2] = lower.Z();
+ bounds[3] = upper.X(); bounds[4] = upper.Y(); bounds[5] = upper.Z();
}
// FT_Error FTGlyph::Error() const;
-C_FUN(FT_Error, ftglGlyphError, (FTGLglyph *g), return -1, Error, ());
+C_FUN(FT_Error, ftglGetGlyphError, (FTGLglyph *g), return -1, Error, ());
FTGL_END_C_DECLS