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