Font.cc
1.75 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
70
71
72
73
74
75
76
77
/*
* Font.cc
*
* Created on: 30 oct. 2013
* Author: CS
*/
#include "Font.hh"
#include "DefaultPlotConfiguration.hh"
#include <ostream>
namespace plot {
const std::vector<std::string> Font::sFamily = { "sans-serif", "serif", "monospace", "script", "symbol" };
const std::vector<std::string> Font::sStyle = { "upright", "italic", "oblique" };
const std::vector<std::string> Font::sWeight = { "medium", "bold" };
Font::Font(const std::string& pname, int psize) :
_name(pname), _size(psize), _style(Style::NORMAL), _weight(Weight::NORMAL) {
}
Font::Font(const Font& pfont) :
_name(pfont._name), _size(pfont._size), _style(pfont._style), _weight(pfont._weight) {
}
Font::~Font() {
}
void Font::setName (const std::string & name) {
_name = name;
}
void Font::setSize (int size) {
_size = size;
}
void Font::setStyle (Style style) {
_style = style;
}
void Font::setWeight (Weight weight) {
_weight = weight;
}
std::string Font::getName() const {
return _name;
}
int Font::getSize() const {
return _size;
}
Font::Style Font::getStyle() const {
return _style;
}
Font::Weight Font::getWeight() const {
return _weight;
}
void Font::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=" << _style << std::endl;
out << prefix << ".font.weight=" << _weight << std::endl;
}
std::ostream& operator <<(std::ostream& out,const Font& font) {
out << "[FONT]" << std::endl;
out << "font.name=" << font.getName() << std::endl;
out << "font.size=" << font.getSize() << std::endl;
out << "font.style=" << font.getStyle() << std::endl;
out << "font.weight=" << font.getWeight() << std::endl;
return out;
}
} /* namespace plot */