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);
77 typedef std::vector<pGlyph> glyphString;
82 class eTextPara: public iObject
84 DECLARE_REF(eTextPara);
86 ePtr<Font> current_font, replacement_font;
87 FT_Face current_face, replacement_face;
90 static std::string replacement_facename;
98 int appendGlyph(Font *current_font, FT_Face current_face, FT_UInt glyphIndex, int flags, int rflags);
99 void newLine(int flags);
100 void setFont(Font *font, Font *replacement_font);
105 eTextPara(eRect area, ePoint start=ePoint(-1, -1))
106 : current_font(0), replacement_font(0), current_face(0), replacement_face(0),
107 area(area), cursor(start), maximum(0, 0), left(start.x()), bboxValid(0)
110 virtual ~eTextPara();
112 static void setReplacementFont(std::string font) { replacement_facename=font; }
114 void setFont(const gFont *font);
115 int renderString(const std::string &string, int flags=0);
119 void blit(gDC &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 int size() const
138 return glyphs.size();
141 const eRect& getGlyphBBox(int num) const
144 assert(num < (int)glyphs.size());
145 return glyphs[num].bbox;
148 void setGlyphFlag(int g, int f)
151 assert(g < (int)glyphs.size());
152 glyphs[g].flags |= f;
155 void clearGlyphFlag(int g, int f)
158 assert(g < (int)glyphs.size());
159 glyphs[g].flags |= f;
163 class Font: public iObject
168 fontRenderClass *renderer;
169 FT_Error getGlyphBitmap(FT_ULong glyph_index, FTC_SBit *sbit);
175 Font(fontRenderClass *render, FTC_FaceID faceid, int isize, int tabwidth);
179 extern fontRenderClass *font;