Font.hh 1.37 KB
/*
 * 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_ */