Font.cc 1.75 KB
/*
 * 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 */