00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef FONTPOOL_H
00020 #define FONTPOOL_H
00021
00022 #include "pandabase.h"
00023
00024 #include "texture.h"
00025 #include "textFont.h"
00026
00027 #include "filename.h"
00028 #include "pmap.h"
00029
00030
00031
00032
00033
00034
00035
00036
00037 class EXPCL_PANDA FontPool {
00038 PUBLISHED:
00039
00040
00041
00042 INLINE static bool has_font(const string &filename);
00043 INLINE static bool verify_font(const string &filename);
00044 INLINE static TextFont *load_font(const string &filename);
00045 INLINE static void add_font(const string &filename, TextFont *font);
00046 INLINE static void release_font(const string &filename);
00047 INLINE static void release_all_fonts();
00048
00049 INLINE static int garbage_collect();
00050
00051 INLINE static void list_contents(ostream &out);
00052
00053 private:
00054 INLINE FontPool();
00055
00056 bool ns_has_font(const string &str);
00057 TextFont *ns_load_font(const string &str);
00058 void ns_add_font(const string &filename, TextFont *font);
00059 void ns_release_font(const string &filename);
00060 void ns_release_all_fonts();
00061 int ns_garbage_collect();
00062 void ns_list_contents(ostream &out);
00063
00064 static void lookup_filename(const string &str,
00065 Filename &filename, int &face_index);
00066
00067 static FontPool *get_ptr();
00068
00069 static FontPool *_global_ptr;
00070 typedef pmap<string, PT(TextFont) > Fonts;
00071 Fonts _fonts;
00072 };
00073
00074 #include "fontPool.I"
00075
00076 #endif