FontCache.h
/*
* $Id: File.h 2967 2009-12-02 14:31:34Z karijes $
*
* Font database and cache facility
* Copyright (c) 2005-2011 edelib authors
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __EDELIB_FONTCACHE_H__
#define __EDELIB_FONTCACHE_H__
#include "edelib-global.h"
#include <FL/Enumerations.H>
EDELIB_NS_BEGIN
struct FontCache_P;
#define EDELIB_FONT_CACHE_FACE_LEN 64
struct EDELIB_API FontInfo {
char face[EDELIB_FONT_CACHE_FACE_LEN];
int sizes[64];
int nsizes;
int type;
};
class EDELIB_API FontCache {
private:
FontCache_P *priv;
E_DISABLE_CLASS_COPY(FontCache)
public:
FontCache() : priv(NULL) {}
~FontCache() { clear(); }
bool load(const char *dir, const char *db = "edelib-font-cache", const char *prefix = "ede");
bool load(void);
void clear(void);
int count(void) const;
bool find(const char *n, Fl_Font &font, int &size);
FontInfo *find(const char *n, int &size);
void for_each_font(void (*) (const char *n, FontInfo *, void *), void *data = NULL);
void for_each_font_sorted(void (*) (const char *n, FontInfo *, void *), void *data = NULL);
static int init_db(const char *dir, const char *db = "edelib-font-cache", const char *prefix = "ede");
static int init_db(void);
};
EDELIB_API bool font_cache_find(const char *face, Fl_Font &f, int &s, Fl_Font df = FL_HELVETICA, int ds = 12);
EDELIB_NS_END
#endif
edelib::FontCache::~FontCache
~FontCache()
Definition: FontCache.h:80
edelib::FontInfo
Base structure for storing font information; used by FontCache.
Definition: FontCache.h:45
edelib::FontCache::FontCache
FontCache()
Definition: FontCache.h:77
E_DISABLE_CLASS_COPY
#define E_DISABLE_CLASS_COPY(klass)
Definition: edelib-global.h:161
edelib::FontCache
Allow readable font names and cache their access.
Definition: FontCache.h:71
edelib::FontInfo::nsizes
int nsizes
Definition: FontCache.h:51
edelib::font_cache_find
bool font_cache_find(const char *face, Fl_Font &f, int &s, Fl_Font df=FL_HELVETICA, int ds=12)
edelib::FontInfo::type
int type
Definition: FontCache.h:53