00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __EDELIB_FONTCACHE_H__
00022 #define __EDELIB_FONTCACHE_H__
00023
00024 #include "edelib-global.h"
00025 #include <FL/Enumerations.H>
00026
00027 EDELIB_NS_BEGIN
00028
00029 struct FontCache_P;
00030
00035 #define EDELIB_FONT_CACHE_FACE_LEN 64
00036
00045 struct FontInfo {
00047 char face[EDELIB_FONT_CACHE_FACE_LEN];
00049 int sizes[64];
00051 int nsizes;
00053 int type;
00054 };
00055
00071 class FontCache {
00072 private:
00073 FontCache_P *priv;
00074 E_DISABLE_CLASS_COPY(FontCache)
00075 public:
00077 FontCache() : priv(NULL) {}
00078
00080 ~FontCache() { clear(); }
00081
00086 bool load(const char *dir, const char *db = "edelib-font-cache", const char *prefix = "ede");
00087
00089 bool load(void);
00090
00092 void clear(void);
00093
00095 int count(void) const;
00096
00101 bool find(const char *n, Fl_Font &font, int &size);
00102
00107 void for_each_font(void (*) (const char *n, FontInfo *, void *), void *data = NULL);
00108
00115 void for_each_font_sorted(void (*) (const char *n, FontInfo *, void *), void *data = NULL);
00116
00125 static int init_db(const char *dir, const char *db = "edelib-font-cache", const char *prefix = "ede");
00126
00128 static int init_db(void);
00129 };
00130
00136 bool font_cache_find(const char *face, Fl_Font &f, int &s, Fl_Font df = FL_HELVETICA, int ds = 12);
00137
00138 EDELIB_NS_END
00139 #endif
00140