/* * Font.cc * * Created on: 30 oct. 2013 * Author: CS */ #include "Font.hh" #include "DefaultPlotConfiguration.hh" #include namespace plot { const std::vector Font::sFamily = { "sans-serif", "serif", "monospace", "script", "symbol" }; const std::vector Font::sStyle = { "upright", "italic", "oblique" }; const std::vector Font::sWeight = { "medium", "bold" }; Font::Font(const std::string& pname, int psize) : _name(pname), _size(psize), _style(0), _weight(0) { } 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 (const std::string & style) { for (size_t i = 0; i < sStyle.size(); ++i) { if (style.compare(sStyle[i]) == 0) { _style = i; } } } void Font::setWeight (const std::string & weight) { for (size_t i = 0; i < sWeight.size(); ++i) { if (weight.compare(sWeight[i]) == 0) { _weight = i; } } } std::ostream& operator <<(std::ostream& out,const Font& font) { out << "[FONT]" << std::endl; out << "font.name=" << font._name << std::endl; out << "font.size=" << font._size << std::endl; out << "font.style=" << font.sStyle[font._style] << std::endl; out << "font.weight=" << font.sWeight[font._weight] << std::endl; return out; } } /* namespace plot */