7 #include FT_CACHE_IMAGE_H
8 #include FT_CACHE_SMALL_BITMAPS_H
12 #include <lib/gdi/fb.h>
13 #include <lib/base/esize.h>
14 #include <lib/base/epoint.h>
15 #include <lib/base/erect.h>
16 #include <lib/base/estring.h>
18 class FontRenderClass
;
27 friend class eTextPara
;
31 eString filename
, face
;
32 int scale
; // 100 is 1:1
38 FTC_Manager cacheManager
; /* the cache manager */
39 FTC_Image_Cache imageCache
; /* the glyph image cache */
40 FTC_SBit_Cache sbitsCache
; /* the glyph small bitmaps cache */
42 FTC_FaceID
getFaceID(const eString
&face
);
43 FT_Error
getGlyphBitmap(FTC_Image_Desc
*font
, FT_ULong glyph_index
, FTC_SBit
*sbit
);
44 static fontRenderClass
*instance
;
46 float getLineHeight(const gFont
& font
);
47 eString
AddFont(const eString
&filename
, const eString
&name
, int scale
);
48 static fontRenderClass
*getInstance();
49 FT_Error
FTC_Face_Requester(FTC_FaceID face_id
,
51 Font
*getFont(const eString
&face
, int size
, int tabwidth
=-1);
74 typedef std::vector
<pGlyph
> glyphString
;
81 Font
*current_font
, *replacement_font
;
82 FT_Face current_face
, replacement_face
;
85 static eString 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
);
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);
117 void blit(gPixmapDC
&dc
, const ePoint
&offset
, const gRGB
&background
, const gRGB
&foreground
);
121 dirLeft
, dirRight
, dirCenter
, dirBlock
124 void realign(int dir
);
126 const eRect
& getBoundBox()
133 const eRect
& getGlyphBBox(int num
) const
135 return glyphs
[num
].bbox
;
143 fontRenderClass
*renderer
;
145 FT_Error
getGlyphBitmap(FT_ULong glyph_index
, FTC_SBit
*sbit
);
151 Font(fontRenderClass
*render
, FTC_FaceID faceid
, int isize
, int tabwidth
);
155 void unlock(); // deletes if ref==0
158 extern fontRenderClass
*font
;