Blame view

src/ParamOutputImpl/Plot/Font.cc 1.75 KB
fbe3c2bb   Benjamin Renard   First commit
1
2
3
4
5
6
7
8
9
10
11
12
13
/*
 * Font.cc
 *
 *  Created on: 30 oct. 2013
 *      Author: CS
 */

#include "Font.hh"
#include "DefaultPlotConfiguration.hh"
#include <ostream>

namespace plot {

c6a67968   Benjamin Renard   Fix some violatio...
14
15
16
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" };
fbe3c2bb   Benjamin Renard   First commit
17

fbe3c2bb   Benjamin Renard   First commit
18
Font::Font(const std::string& pname, int psize) :
df45df5e   Benjamin Renard   Introduce AxisLeg...
19
		_name(pname), _size(psize), _style(Style::NORMAL), _weight(Weight::NORMAL) {
fbe3c2bb   Benjamin Renard   First commit
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
}

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;
}

df45df5e   Benjamin Renard   Introduce AxisLeg...
37
38
void Font::setStyle (Style style) {
	_style = style;
fbe3c2bb   Benjamin Renard   First commit
39
40
}

df45df5e   Benjamin Renard   Introduce AxisLeg...
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
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;
fbe3c2bb   Benjamin Renard   First commit
66
67
68
69
}

std::ostream& operator <<(std::ostream& out,const Font& font) {
	out << "[FONT]" << std::endl;
df45df5e   Benjamin Renard   Introduce AxisLeg...
70
71
72
73
	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;
fbe3c2bb   Benjamin Renard   First commit
74
75
76
	return out;
}

fbe3c2bb   Benjamin Renard   First commit
77
} /* namespace plot */