14 #ifndef FREETYPEFONT_H 15 #define FREETYPEFONT_H 30 #include FT_FREETYPE_H 40 class EXPCL_PANDA_PNMTEXT FreetypeFont :
public Namable {
43 FreetypeFont(
const FreetypeFont ©);
45 bool load_font(
const Filename &font_filename,
int face_index);
46 bool load_font(
const char *font_data,
int data_length,
int face_index);
50 INLINE ~FreetypeFont();
60 INLINE
bool set_point_size(PN_stdfloat point_size);
61 INLINE PN_stdfloat get_point_size()
const;
63 INLINE
bool set_pixels_per_unit(PN_stdfloat pixels_per_unit);
64 INLINE PN_stdfloat get_pixels_per_unit()
const;
66 INLINE
bool set_pixel_size(PN_stdfloat pixel_size);
67 INLINE PN_stdfloat get_pixel_size()
const;
69 INLINE
bool set_scale_factor(PN_stdfloat scale_factor);
70 INLINE PN_stdfloat get_scale_factor()
const;
72 INLINE
void set_native_antialias(
bool native_antialias);
73 INLINE
bool get_native_antialias()
const;
75 INLINE
int get_font_pixel_size()
const;
77 INLINE PN_stdfloat get_line_height()
const;
78 INLINE PN_stdfloat get_space_advance()
const;
80 INLINE
static PN_stdfloat get_points_per_unit();
81 INLINE
static PN_stdfloat get_points_per_inch();
83 INLINE
void set_winding_order(WindingOrder winding_order);
84 INLINE WindingOrder get_winding_order()
const;
85 MAKE_PROPERTY(winding_order, get_winding_order, set_winding_order);
88 static WindingOrder string_winding_order(
const std::string &
string);
91 INLINE FT_Face acquire_face()
const;
92 INLINE
void release_face(FT_Face face)
const;
94 bool load_glyph(FT_Face face,
int glyph_index,
bool prerender =
true);
95 void copy_bitmap_to_pnmimage(
const FT_Bitmap &bitmap,
PNMImage &image);
96 void render_distance_field(
PNMImage &image,
int radius,
int min_x,
int min_y);
98 void decompose_outline(FT_Outline &outline);
103 static int outline_move_to(
const FT_Vector *to,
void *user);
104 static int outline_line_to(
const FT_Vector *to,
void *user);
105 static int outline_conic_to(
const FT_Vector *control,
106 const FT_Vector *to,
void *user);
107 static int outline_cubic_to(
const FT_Vector *control1,
108 const FT_Vector *control2,
109 const FT_Vector *to,
void *user);
113 PN_stdfloat _point_size;
114 PN_stdfloat _requested_pixels_per_unit;
115 PN_stdfloat _tex_pixels_per_unit;
116 PN_stdfloat _requested_scale_factor;
117 PN_stdfloat _scale_factor;
118 bool _native_antialias;
119 PN_stdfloat _font_pixels_per_unit;
120 WindingOrder _winding_order;
122 int _font_pixel_size;
123 PN_stdfloat _line_height;
124 PN_stdfloat _space_advance;
126 PT(FreetypeFace) _face;
134 INLINE ContourPoint(
const LPoint2 &p,
const LVector2 &in,
135 const LVector2 &out);
136 INLINE ContourPoint(PN_stdfloat px, PN_stdfloat py, PN_stdfloat tx, PN_stdfloat ty);
137 INLINE
void connect_to(
const LVector2 &out);
160 static const PN_stdfloat _points_per_unit;
161 static const PN_stdfloat _points_per_inch;
166 EXPCL_PANDA_PNMTEXT std::ostream &operator << (std::ostream &out, FreetypeFont::WindingOrder wo);
167 EXPCL_PANDA_PNMTEXT std::istream &operator >> (std::istream &in, FreetypeFont::WindingOrder &wo);
169 #endif // HAVE_FREETYPE PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
The name of this class derives from the fact that we originally implemented it as a layer on top of t...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is our own Panda specialization on the default STL vector.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
The result of a NurbsCurveEvaluator.