00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef TEXTFONT_H
00016 #define TEXTFONT_H
00017
00018 #include "pandabase.h"
00019
00020 #include "textGlyph.h"
00021 #include "typedReferenceCount.h"
00022 #include "namable.h"
00023 #include "pmap.h"
00024 #include "pointerTo.h"
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 class EXPCL_PANDA_TEXT TextFont : public TypedReferenceCount, public Namable {
00037 public:
00038 TextFont();
00039 TextFont(const TextFont ©);
00040
00041 PUBLISHED:
00042 virtual ~TextFont();
00043
00044 enum RenderMode {
00045
00046 RM_texture,
00047
00048
00049 RM_wireframe,
00050
00051
00052 RM_polygon,
00053
00054
00055 RM_extruded,
00056
00057
00058 RM_solid,
00059
00060
00061 RM_invalid,
00062 };
00063
00064 enum WindingOrder {
00065 WO_default,
00066 WO_left,
00067 WO_right,
00068
00069 WO_invalid,
00070 };
00071
00072 virtual PT(TextFont) make_copy() const=0;
00073
00074 INLINE bool is_valid() const;
00075 INLINE operator bool () const;
00076 INLINE PN_stdfloat get_line_height() const;
00077 INLINE void set_line_height(PN_stdfloat line_height);
00078
00079 INLINE PN_stdfloat get_space_advance() const;
00080 INLINE void set_space_advance(PN_stdfloat space_advance);
00081
00082 virtual void write(ostream &out, int indent_level) const;
00083
00084 public:
00085 virtual bool get_glyph(int character, const TextGlyph *&glyph)=0;
00086 TextGlyph *get_invalid_glyph();
00087
00088 static RenderMode string_render_mode(const string &string);
00089 static WindingOrder string_winding_order(const string &string);
00090
00091 private:
00092 void make_invalid_glyph();
00093
00094 protected:
00095 bool _is_valid;
00096 PN_stdfloat _line_height;
00097 PN_stdfloat _space_advance;
00098 PT(TextGlyph) _invalid_glyph;
00099
00100 public:
00101 static TypeHandle get_class_type() {
00102 return _type_handle;
00103 }
00104 static void init_type() {
00105 TypedReferenceCount::init_type();
00106 register_type(_type_handle, "TextFont",
00107 TypedReferenceCount::get_class_type());
00108 }
00109 virtual TypeHandle get_type() const {
00110 return get_class_type();
00111 }
00112 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00113
00114 private:
00115 static TypeHandle _type_handle;
00116 };
00117
00118 EXPCL_PANDA_TEXT ostream &operator << (ostream &out, TextFont::RenderMode rm);
00119 EXPCL_PANDA_TEXT istream &operator >> (istream &in, TextFont::RenderMode &rm);
00120 EXPCL_PANDA_TEXT ostream &operator << (ostream &out, TextFont::WindingOrder wo);
00121 EXPCL_PANDA_TEXT istream &operator >> (istream &in, TextFont::WindingOrder &wo);
00122
00123 #include "textFont.I"
00124
00125 #endif