15 #ifndef FREETYPEFONT_H 16 #define FREETYPEFONT_H 18 #include "pandabase.h" 22 #include "config_pnmtext.h" 28 #include "freetypeFace.h" 31 #include FT_FREETYPE_H 41 class EXPCL_PANDA_PNMTEXT FreetypeFont :
public Namable {
44 FreetypeFont(
const FreetypeFont ©);
46 bool load_font(
const Filename &font_filename,
int face_index);
47 bool load_font(
const char *font_data,
int data_length,
int face_index);
51 INLINE ~FreetypeFont();
53 INLINE
bool set_point_size(PN_stdfloat point_size);
54 INLINE PN_stdfloat get_point_size()
const;
56 INLINE
bool set_pixels_per_unit(PN_stdfloat pixels_per_unit);
57 INLINE PN_stdfloat get_pixels_per_unit()
const;
59 INLINE
bool set_pixel_size(PN_stdfloat pixel_size);
60 INLINE PN_stdfloat get_pixel_size()
const;
62 INLINE
bool set_scale_factor(PN_stdfloat scale_factor);
63 INLINE PN_stdfloat get_scale_factor()
const;
65 INLINE
void set_native_antialias(
bool native_antialias);
66 INLINE
bool get_native_antialias()
const;
68 INLINE
int get_font_pixel_size()
const;
70 INLINE PN_stdfloat get_line_height()
const;
71 INLINE PN_stdfloat get_space_advance()
const;
73 INLINE
static PN_stdfloat get_points_per_unit();
74 INLINE
static PN_stdfloat get_points_per_inch();
77 INLINE FT_Face acquire_face()
const;
78 INLINE
void release_face(FT_Face face)
const;
80 bool load_glyph(FT_Face face,
int glyph_index,
bool prerender =
true);
81 void copy_bitmap_to_pnmimage(
const FT_Bitmap &bitmap,
PNMImage &image);
87 PN_stdfloat _point_size;
88 PN_stdfloat _requested_pixels_per_unit;
89 PN_stdfloat _tex_pixels_per_unit;
90 PN_stdfloat _requested_scale_factor;
91 PN_stdfloat _scale_factor;
92 bool _native_antialias;
93 PN_stdfloat _font_pixels_per_unit;
96 PN_stdfloat _line_height;
97 PN_stdfloat _space_advance;
99 PT(FreetypeFace) _face;
106 static const PN_stdfloat _points_per_unit;
107 static const PN_stdfloat _points_per_inch;
110 #include "freetypeFont.I" 112 #endif // HAVE_FREETYPE The name of this class derives from the fact that we originally implemented it as a layer on top of t...
A base class for all things which can have a name.
The name of a file, such as a texture file or an Egg file.