9 #include FT_CACHE_IMAGE_H
10 #include FT_CACHE_SMALL_BITMAPS_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>
18 #include <lib/base/object.h>
20 class FontRenderClass;
31 friend class eTextPara;
35 std::string filename, face;
36 int scale; // 100 is 1:1
42 FTC_Manager cacheManager; /* the cache manager */
43 FTC_Image_Cache imageCache; /* the glyph image cache */
44 FTC_SBit_Cache sbitsCache; /* the glyph small bitmaps cache */
46 FTC_FaceID getFaceID(const std::string &face);
47 FT_Error getGlyphBitmap(FTC_Image_Desc *font, FT_ULong glyph_index, FTC_SBit *sbit);
48 static fontRenderClass *instance;
51 float getLineHeight(const gFont& font);
52 static fontRenderClass *getInstance();
54 std::string AddFont(const std::string &filename, const std::string &name, int scale);
55 FT_Error FTC_Face_Requester(FTC_FaceID face_id, FT_Face* aface);
56 int getFont(ePtr<Font> &font, const std::string &face, int size, int tabwidth=-1);
84 typedef std::vector<pGlyph> glyphString;
89 class eTextPara: public iObject
91 DECLARE_REF(eTextPara);
93 ePtr<Font> current_font, replacement_font;
94 FT_Face current_face, replacement_face;
97 static std::string replacement_facename;
105 int appendGlyph(Font *current_font, FT_Face current_face, FT_UInt glyphIndex, int flags, int rflags);
106 void newLine(int flags);
107 void setFont(Font *font, Font *replacement_font);
112 eTextPara(eRect area, ePoint start=ePoint(-1, -1))
113 : current_font(0), replacement_font(0), current_face(0), replacement_face(0),
114 area(area), cursor(start), maximum(0, 0), left(start.x()), bboxValid(0)
117 virtual ~eTextPara();
119 static void setReplacementFont(std::string font) { replacement_facename=font; }
121 void setFont(const gFont *font);
122 int renderString(const std::string &string, int flags=0);
126 void blit(gDC &dc, const ePoint &offset, const gRGB &background, const gRGB &foreground);
130 dirLeft, dirRight, dirCenter, dirBlock
133 void realign(int dir);
135 const eRect & getBoundBox()
143 const int size() const
145 return glyphs.size();
148 const eRect& getGlyphBBox(int num) const
151 assert(num < (int)glyphs.size());
152 return glyphs[num].bbox;
155 void setGlyphFlag(int g, int f)
158 assert(g < (int)glyphs.size());
159 glyphs[g].flags |= f;
162 void clearGlyphFlag(int g, int f)
165 assert(g < (int)glyphs.size());
166 glyphs[g].flags |= f;
170 class Font: public iObject
175 fontRenderClass *renderer;
176 FT_Error getGlyphBitmap(FT_ULong glyph_index, FTC_SBit *sbit);
182 Font(fontRenderClass *render, FTC_FaceID faceid, int isize, int tabwidth);
186 extern fontRenderClass *font;