7 #include FT_CACHE_IMAGE_H
8 #include FT_CACHE_SMALL_BITMAPS_H
12 #include <lib/gdi/fb.h>
13 #include <lib/gdi/esize.h>
14 #include <lib/gdi/epoint.h>
15 #include <lib/gdi/erect.h>
17 #include <lib/base/object.h>
19 class FontRenderClass;
28 friend class eTextPara;
32 std::string 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 std::string &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 std::string AddFont(const std::string &filename, const std::string &name, int scale);
49 static fontRenderClass *getInstance();
50 FT_Error FTC_Face_Requester(FTC_FaceID face_id,
52 int getFont(ePtr<Font> &font, const std::string &face, int size, int tabwidth=-1);
75 typedef std::vector<pGlyph> glyphString;
80 class eTextPara: public iObject
82 DECLARE_REF(eTextPara);
84 ePtr<Font> current_font, replacement_font;
85 FT_Face current_face, replacement_face;
88 static std::string replacement_facename;
96 int appendGlyph(Font *current_font, FT_Face current_face, FT_UInt glyphIndex, int flags, int rflags);
97 void newLine(int flags);
98 void setFont(Font *font, Font *replacement_font);
103 eTextPara(eRect area, ePoint start=ePoint(-1, -1))
104 : current_font(0), replacement_font(0), current_face(0), replacement_face(0),
105 area(area), cursor(start), maximum(0, 0), left(start.x()), bboxValid(0)
108 virtual ~eTextPara();
110 static void setReplacementFont(std::string font) { replacement_facename=font; }
112 void setFont(const gFont *font);
113 int renderString(const std::string &string, int flags=0);
117 void blit(gDC &dc, const ePoint &offset, const gRGB &background, const gRGB &foreground);
121 dirLeft, dirRight, dirCenter, dirBlock
124 void realign(int dir);
126 const eRect & getBoundBox()
134 const int size() const
136 return glyphs.size();
139 const eRect& getGlyphBBox(int num) const
142 assert(num < (int)glyphs.size());
143 return glyphs[num].bbox;
147 class Font: public iObject
152 fontRenderClass *renderer;
153 FT_Error getGlyphBitmap(FT_ULong glyph_index, FTC_SBit *sbit);
159 Font(fontRenderClass *render, FTC_FaceID faceid, int isize, int tabwidth);
163 extern fontRenderClass *font;