-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCFontStorage.h
46 lines (37 loc) · 938 Bytes
/
CFontStorage.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*CFontStorage
* --This is a Font Storage
* You can add here fonts and
* and use it anywhere in project,
* just add #include "CFontStorage.h"
* --Here uses library TFont.h frow Georgiy Gamarnik
*/
#pragma once
#include "./lib/TFont/TFont.h"
#define MAX_FONTS_COUNT 4
//#define ONDEBUG
struct sFont
{
char * fontName;
TFont *fontFile;
sFont(const char * AName, TFont* AFont) {
fontName = strcpy(new char[strlen(AName) + 1], AName);
fontFile = AFont;
}
~sFont() {
delete [] fontName;
delete fontFile;
}
};
class CFontStorage
{
private:
sFont *fonts[MAX_FONTS_COUNT];
int findFontName(char *fontName); //retunt font position in fonts massive; return -1 if name not found
sFont newFont(char *fontName, char *fontFile);
public:
CFontStorage();
~CFontStorage();
bool setFont(char *fontName, char *fontFile);
TFont* getFont(char *fontName);
};
extern CFontStorage * FontStorage;