00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef DYNAMICTEXTPAGE_H
00020 #define DYNAMICTEXTPAGE_H
00021
00022 #include "pandabase.h"
00023
00024 #ifdef HAVE_FREETYPE
00025
00026 #include "texture.h"
00027 #include "dynamicTextGlyph.h"
00028 #include "pointerTo.h"
00029 #include "pvector.h"
00030
00031 class DynamicTextFont;
00032
00033
00034
00035
00036
00037
00038
00039
00040 class EXPCL_PANDA DynamicTextPage : public Texture {
00041 public:
00042 DynamicTextPage(DynamicTextFont *font);
00043
00044 DynamicTextGlyph *slot_glyph(int x_size, int y_size, int margin);
00045
00046 INLINE int get_x_size() const;
00047 INLINE int get_y_size() const;
00048
00049 PUBLISHED:
00050 INLINE bool is_empty() const;
00051
00052 private:
00053 int garbage_collect();
00054
00055 private:
00056 bool find_hole(int &x, int &y, int x_size, int y_size) const;
00057 DynamicTextGlyph *find_overlap(int x, int y, int x_size, int y_size) const;
00058
00059 typedef pvector< PT(DynamicTextGlyph) > Glyphs;
00060 Glyphs _glyphs;
00061
00062 int _x_size, _y_size;
00063
00064 DynamicTextFont *_font;
00065
00066 public:
00067 static TypeHandle get_class_type() {
00068 return _type_handle;
00069 }
00070 static void init_type() {
00071 Texture::init_type();
00072 register_type(_type_handle, "DynamicTextPage",
00073 Texture::get_class_type());
00074 }
00075 virtual TypeHandle get_type() const {
00076 return get_class_type();
00077 }
00078 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00079
00080 private:
00081 static TypeHandle _type_handle;
00082
00083 friend class DynamicTextFont;
00084 };
00085
00086 #include "dynamicTextPage.I"
00087
00088 #endif // HAVE_FREETYPE
00089
00090 #endif