4 #include <freetype/freetype.h>
5 #include <freetype/ftcache.h>
6 #include <freetype/cache/ftcglyph.h>
7 #include <freetype/cache/ftcimage.h>
8 #include <freetype/cache/ftcmanag.h>
9 #include <freetype/cache/ftcsbits.h>
10 #include <freetype/cache/ftlru.h>
13 #include <lib/gdi/fb.h>
14 #include <lib/gdi/esize.h>
15 #include <lib/gdi/epoint.h>
16 #include <lib/gdi/erect.h>
17 #include <lib/base/estring.h>
19 class FontRenderClass;
28 friend class eTextPara;
32 eString filename, face;
33 int scale; // 100 is 1:1
39 FTC_Manager cacheManager; /* the cache manager */
40 FTC_Image_Cache imageCache; /* the glyph image cache */
41 FTC_SBit_Cache sbitsCache; /* the glyph small bitmaps cache */
43 FTC_FaceID getFaceID(const eString &face);
44 FT_Error getGlyphBitmap(FTC_Image_Desc *font, FT_ULong glyph_index, FTC_SBit *sbit);
45 static fontRenderClass *instance;
47 float getLineHeight(const gFont& font);
48 eString AddFont(const eString &filename, const eString &name, int scale);
49 static fontRenderClass *getInstance();
50 FT_Error FTC_Face_Requester(FTC_FaceID face_id,
52 Font *getFont(const eString &face, int size, int tabwidth=-1);
75 typedef std::vector<pGlyph> glyphString;
82 Font *current_font, *replacement_font;
83 FT_Face current_face, replacement_face;
86 static eString replacement_facename;
95 int appendGlyph(Font *current_font, FT_Face current_face, FT_UInt glyphIndex, int flags, int rflags);
96 void newLine(int flags);
97 void setFont(Font *font, Font *replacement_font);
102 eTextPara(eRect area, ePoint start=ePoint(-1, -1))
103 : current_font(0), replacement_font(0), current_face(0), replacement_face(0),
104 area(area), cursor(start), maximum(0, 0), left(start.x()), refcnt(0), bboxValid(0)
109 static void setReplacementFont(eString font) { replacement_facename=font; }
114 void setFont(const gFont &font);
115 int renderString(const eString &string, int flags=0);
119 void blit(gPixmapDC &dc, const ePoint &offset, const gRGB &background, const gRGB &foreground);
123 dirLeft, dirRight, dirCenter, dirBlock
126 void realign(int dir);
128 const eRect & getBoundBox()
136 const eRect& getGlyphBBox(int num) const
138 return glyphs[num].bbox;
146 fontRenderClass *renderer;
148 FT_Error getGlyphBitmap(FT_ULong glyph_index, FTC_SBit *sbit);
154 Font(fontRenderClass *render, FTC_FaceID faceid, int isize, int tabwidth);
158 void unlock(); // deletes if ref==0
161 extern fontRenderClass *font;