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
00335 virtual FTPoint Render(const char* string, const int len = -1,
00336 FTPoint position = FTPoint(),
00337 FTPoint spacing = FTPoint(),
00338 int renderMode = FTGL::RENDER_ALL);
00339
00353 virtual FTPoint Render(const wchar_t *string, const int len = -1,
00354 FTPoint position = FTPoint(),
00355 FTPoint spacing = FTPoint(),
00356 int renderMode = FTGL::RENDER_ALL);
00357
00363 virtual FT_Error Error() const;
00364
00365 protected:
00366
00367 friend class FTFontImpl;
00368
00378 virtual FTGlyph* MakeGlyph(FT_GlyphSlot slot) = 0;
00379
00380 private:
00384 FTFontImpl *impl;
00385 };
00386
00387 #endif //__cplusplus
00388
00389 FTGL_BEGIN_C_DECLS
00390
00398 struct _FTGLFont;
00399 typedef struct _FTGLfont FTGLfont;
00400
00409 FTGL_EXPORT FTGLfont *ftglCreateCustomFont(char const *fontFilePath,
00410 void *data,
00411 FTGLglyph * (*makeglyphCallback) (FT_GlyphSlot, void *));
00412
00418 FTGL_EXPORT void ftglDestroyFont(FTGLfont* font);
00419
00429 FTGL_EXPORT int ftglAttachFile(FTGLfont* font, const char* path);
00430
00441 FTGL_EXPORT int ftglAttachData(FTGLfont* font, const unsigned char * data,
00442 size_t size);
00443
00451 FTGL_EXPORT int ftglSetFontCharMap(FTGLfont* font, FT_Encoding encoding);
00452
00459 FTGL_EXPORT unsigned int ftglGetFontCharMapCount(FTGLfont* font);
00460
00467 FTGL_EXPORT FT_Encoding* ftglGetFontCharMapList(FTGLfont* font);
00468
00478 FTGL_EXPORT int ftglSetFontFaceSize(FTGLfont* font, unsigned int size,
00479 unsigned int res);
00480
00487 FTGL_EXPORT unsigned int ftglGetFontFaceSize(FTGLfont* font);
00488
00496 FTGL_EXPORT void ftglSetFontDepth(FTGLfont* font, float depth);
00497
00507 FTGL_EXPORT void ftglSetFontOutset(FTGLfont* font, float front, float back);
00508
00516 FTGL_EXPORT void ftglSetFontDisplayList(FTGLfont* font, int useList);
00517
00524 FTGL_EXPORT float ftglGetFontAscender(FTGLfont* font);
00525
00532 FTGL_EXPORT float ftglGetFontDescender(FTGLfont* font);
00533
00540 FTGL_EXPORT float ftglGetFontLineHeight(FTGLfont* font);
00541
00552 FTGL_EXPORT void ftglGetFontBBox(FTGLfont* font, const char *string,
00553 int len, float bounds[6]);
00554
00562 FTGL_EXPORT float ftglGetFontAdvance(FTGLfont* font, const char *string);
00563
00571 FTGL_EXPORT void ftglRenderFont(FTGLfont* font, const char *string, int mode);
00572
00579 FTGL_EXPORT FT_Error ftglGetFontError(FTGLfont* font);
00580
00581 FTGL_END_C_DECLS
00582
00583 #endif // __FTFont__
00584