00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
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 __FTFont__
00034 #define __FTFont__
00035
00036 #ifdef __cplusplus
00037
00038 class FTFontImpl;
00039
00056 class FTGL_EXPORT FTFont
00057 {
00058 protected:
00064 FTFont(char const *fontFilePath);
00065
00074 FTFont(const unsigned char *pBufferBytes, size_t bufferSizeInBytes);
00075
00076 private:
00077
00078 friend class FTBitmapFont;
00079 friend class FTBufferFont;
00080 friend class FTExtrudeFont;
00081 friend class FTOutlineFont;
00082 friend class FTPixmapFont;
00083 friend class FTPolygonFont;
00084 friend class FTTextureFont;
00085
00092 FTFont(FTFontImpl *pImpl);
00093
00094 public:
00095 virtual ~FTFont();
00096
00106 virtual bool Attach(const char* fontFilePath);
00107
00118 virtual bool Attach(const unsigned char *pBufferBytes,
00119 size_t bufferSizeInBytes);
00120
00128 virtual void GlyphLoadFlags(FT_Int flags);
00129
00137 virtual bool CharMap(FT_Encoding encoding);
00138
00144 virtual unsigned int CharMapCount() const;
00145
00151 virtual FT_Encoding* CharMapList();
00152
00160 virtual bool FaceSize(const unsigned int size,
00161 const unsigned int res = 72);
00162
00168 virtual unsigned int FaceSize() const;
00169
00176 virtual void Depth(float depth);
00177
00184 virtual void Outset(float outset);
00185
00193 virtual void Outset(float front, float back);
00194
00201 virtual void UseDisplayList(bool useList);
00202
00208 virtual float Ascender() const;
00209
00215 virtual float Descender() const;
00216
00222 virtual float LineHeight() const;
00223
00236 virtual FTBBox BBox(const char *string, const int len = -1,
00237 FTPoint position = FTPoint(),
00238 FTPoint spacing = FTPoint());
00239
00251 void BBox(const char* string, float& llx, float& lly, float& llz,
00252 float& urx, float& ury, float& urz)
00253 {
00254 FTBBox b = BBox(string);
00255 llx = b.Lower().Xf(); lly = b.Lower().Yf(); llz = b.Lower().Zf();
00256 urx = b.Upper().Xf(); ury = b.Upper().Yf(); urz = b.Upper().Zf();
00257 }
00258
00271 virtual FTBBox BBox(const wchar_t *string, const int len = -1,
00272 FTPoint position = FTPoint(),
00273 FTPoint spacing = FTPoint());
00274
00286 void BBox(const wchar_t* string, float& llx, float& lly, float& llz,
00287 float& urx, float& ury, float& urz)
00288 {
00289 FTBBox b = BBox(string);
00290 llx = b.Lower().Xf(); lly = b.Lower().Yf(); llz = b.Lower().Zf();
00291 urx = b.Upper().Xf(); ury = b.Upper().Yf(); urz = b.Upper().Zf();
00292 }
00293
00305 virtual float Advance(const char* string, const int len = -1,
00306 FTPoint spacing = FTPoint());
00307
00319 virtual float Advance(const wchar_t* string, const int len = -1,
00320 FTPoint spacing = FTPoint());
00321
00342 virtual FTPoint Render(const char* string, const int len = -1,
00343 FTPoint position = FTPoint(),
00344 FTPoint spacing = FTPoint(),
00345 int renderMode = FTGL::RENDER_ALL);
00346
00367 virtual FTPoint Render(const wchar_t *string, const int len = -1,
00368 FTPoint position = FTPoint(),
00369 FTPoint spacing = FTPoint(),
00370 int renderMode = FTGL::RENDER_ALL);
00371
00377 virtual FT_Error Error() const;
00378
00379 protected:
00380
00381 friend class FTFontImpl;
00382
00392 virtual FTGlyph* MakeGlyph(FT_GlyphSlot slot) = 0;
00393
00394 private:
00398 FTFontImpl *impl;
00399 };
00400
00401 #endif //__cplusplus
00402
00403 FTGL_BEGIN_C_DECLS
00404
00412 struct _FTGLFont;
00413 typedef struct _FTGLfont FTGLfont;
00414
00423 FTGL_EXPORT FTGLfont *ftglCreateCustomFont(char const *fontFilePath,
00424 void *data,
00425 FTGLglyph * (*makeglyphCallback) (FT_GlyphSlot, void *));
00426
00436 FTGL_EXPORT FTGLfont *ftglCreateCustomFontFromMem(const unsigned char *bytes,
00437 size_t len, void *data,
00438 FTGLglyph * (*makeglyphCallback) (FT_GlyphSlot, void *));
00439
00445 FTGL_EXPORT void ftglDestroyFont(FTGLfont* font);
00446
00456 FTGL_EXPORT int ftglAttachFile(FTGLfont* font, const char* path);
00457
00468 FTGL_EXPORT int ftglAttachData(FTGLfont* font, const unsigned char * data,
00469 size_t size);
00470
00479 FTGL_EXPORT void ftglSetFontGlyphLoadFlags(FTGLfont* font, FT_Int flags);
00480
00488 FTGL_EXPORT int ftglSetFontCharMap(FTGLfont* font, FT_Encoding encoding);
00489
00496 FTGL_EXPORT unsigned int ftglGetFontCharMapCount(FTGLfont* font);
00497
00504 FTGL_EXPORT FT_Encoding* ftglGetFontCharMapList(FTGLfont* font);
00505
00515 FTGL_EXPORT int ftglSetFontFaceSize(FTGLfont* font, unsigned int size,
00516 unsigned int res);
00517
00524 FTGL_EXPORT unsigned int ftglGetFontFaceSize(FTGLfont* font);
00525
00533 FTGL_EXPORT void ftglSetFontDepth(FTGLfont* font, float depth);
00534
00544 FTGL_EXPORT void ftglSetFontOutset(FTGLfont* font, float front, float back);
00545
00553 FTGL_EXPORT void ftglSetFontDisplayList(FTGLfont* font, int useList);
00554
00561 FTGL_EXPORT float ftglGetFontAscender(FTGLfont* font);
00562
00569 FTGL_EXPORT float ftglGetFontDescender(FTGLfont* font);
00570
00577 FTGL_EXPORT float ftglGetFontLineHeight(FTGLfont* font);
00578
00589 FTGL_EXPORT void ftglGetFontBBox(FTGLfont* font, const char *string,
00590 int len, float bounds[6]);
00591
00599 FTGL_EXPORT float ftglGetFontAdvance(FTGLfont* font, const char *string);
00600
00608 FTGL_EXPORT void ftglRenderFont(FTGLfont* font, const char *string, int mode);
00609
00616 FTGL_EXPORT FT_Error ftglGetFontError(FTGLfont* font);
00617
00618 FTGL_END_C_DECLS
00619
00620 #endif // __FTFont__
00621