20 #ifndef AGG_FONT_FREETYPE_INCLUDED 21 #define AGG_FONT_FREETYPE_INCLUDED 24 #include FT_FREETYPE_H 28 #include "agg_scanline_storage_aa.h" 29 #include "agg_scanline_storage_bin.h" 30 #include "agg_scanline_u.h" 31 #include "agg_scanline_bin.h" 32 #include "agg_path_storage_integer.h" 33 #include "agg_rasterizer_scanline_aa.h" 34 #include "agg_conv_curve.h" 35 #include "agg_font_cache_manager.h" 36 #include "agg_font_cache_manager2.h" 37 #include "agg_trans_affine.h" 52 glyph_data_type data_type;
67 , m_rendering( glyph_ren_native_gray8 )
70 , m_char_map( FT_ENCODING_NONE )
77 FT_Done_Face( m_ft_face);
81 unsigned num_faces()
const 83 return m_ft_face->num_faces;
86 const char *name()
const 91 unsigned resolution()
const 106 double ascent()
const 108 return m_ft_face->ascender*height()/m_ft_face->height;
111 double descent()
const 113 return m_ft_face->descender*height()/m_ft_face->height;
116 double ascent_b()
const 118 return m_ft_face->bbox.yMax*height()/m_ft_face->height;
121 double descent_b()
const 123 return m_ft_face->bbox.yMin*height()/m_ft_face->height;
141 FT_Encoding char_map()
const 146 void set_hinting(
bool h )
165 void select_instance(
169 glyph_rendering rendering )
171 rendering=capable_rendering(rendering);
173 if( m_height != height ||
175 m_hinting != hinting ||
176 m_rendering != rendering )
181 m_rendering = rendering;
186 glyph_rendering capable_rendering( glyph_rendering rendering )
const 190 case glyph_ren_native_mono:
191 case glyph_ren_native_gray8:
194 case glyph_ren_outline:
195 if(!FT_IS_SCALABLE(m_ft_face))
196 rendering = glyph_ren_native_gray8;
199 case glyph_ren_agg_mono:
200 if(!FT_IS_SCALABLE(m_ft_face))
201 rendering = glyph_ren_native_mono;
204 case glyph_ren_agg_gray8:
205 if(!FT_IS_SCALABLE(m_ft_face))
206 rendering = glyph_ren_native_gray8;
212 void update_char_size()
215 FT_Set_Char_Size( m_ft_face,
int(m_width*64),
int(m_height*64), m_dpi, m_dpi );
217 FT_Set_Pixel_Sizes( m_ft_face,
int(m_width),
int(m_height) );
220 bool prepare_glyph(
unsigned glyph_code,
prepared_glyph *prepared )
const;
221 bool add_kerning(
unsigned first,
unsigned second,
double* x,
double* y);
225 void set_face_name();
237 glyph_rendering m_rendering;
241 FT_Encoding m_char_map;
256 loaded_face *load_face(
const void* buffer, std::size_t bytes);
257 loaded_face *load_face_file(
const char* file_name);
263 template<
class GammaF>
void gamma(
const GammaF& f)
265 m_rasterizer.gamma(f);
274 bool m_library_initialized;
275 FT_Library m_library;
283 scanlines_aa_type m_scanlines_aa;
284 scanlines_bin_type m_scanlines_bin;