00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef BFONTMANAGER_H
00013 #define BFONTMANAGER_H
00014
00015
00016
00017
00018
00019 #include "BFont.h"
00020
00027 class BFontManager {
00028 public:
00029 static BFontManager* get();
00030
00031 typedef struct {
00032 std::string name;
00033 bool bold;
00034 bool oblique;
00035 int height;
00036 BFont* font;
00037 std::string filename;
00038 } FontDescription;
00039
00040 void addFont(BFont* font);
00041 void scanDirectory(const std::string& dir);
00042
00043 int numFonts() { return _fonts.size(); }
00044
00045 const std::vector<std::string>& fontNames() { return _names; }
00046 std::vector<int> sizesForFont(const std::string& name);
00047 bool hasFont(const std::string& name, int size, bool bold, bool oblique);
00048 BFont* font(const std::string& name, int size, bool bold, bool oblique);
00049
00050 protected:
00051 friend class BFont;
00052 void fontIsDeleted(BFont* font);
00053
00054 private:
00055 bool fontAlreadyIn(const FontDescription& descr);
00056 void addUniqueFontName(const std::string& name);
00057
00058 std::vector<FontDescription> _fonts;
00059 std::vector<std::string> _names;
00060 static BFontManager* _fm;
00061 };
00062
00063 #endif