Font.hh
1.37 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
* Font.hh
*
* Created on: 30 oct. 2013
* Author: CS
*/
#ifndef FONT_HH_
#define FONT_HH_
#include <string>
#include <vector>
#include <plplot/plstream.h>
#include <ostream>
namespace plot {
class Label;
class Font {
public:
Font(const std::string& pname, int psize);
Font(const Font& pfont);
virtual ~Font();
std::string _name;
int _size;
int _style;
int _weight;
static const std::vector<std::string> sFamily;
static const std::vector<std::string> sStyle;
static const std::vector<std::string> sWeight;
static const float DEFAULT_CHARACTER_SIZE;
bool isSet(){
return !_name.empty() && _size > 0;
}
void setName (const std::string & name);
void setSize (int size);
void setStyle (const std::string & style);
void setWeight (const std::string & weight);
void dump(std::ostream& out, std::string& prefix) {
out << prefix << ".font.name=" << _name << std::endl;
out << prefix << ".font.size=" << _size << std::endl;
out << prefix << ".font.style=" << sStyle[_style] << std::endl;
out << prefix << ".font.weight=" << sWeight[_weight] << std::endl;
}
};
std::ostream& operator << (std::ostream& out, const Font& font);
PLINT getPlFontFamily(Font& font);
PLFLT getPlFontScaleFactor(Font& font);
PLFLT getPlFontDef(Font& font);
PLINT getPlFontStyle(Font& font);
PLINT getPlFontWeight(Font& font);
} /* namespace plot */
#endif /* FONT_HH_ */