aboutsummaryrefslogtreecommitdiffstats
path: root/include/litehtml/font_description.h
blob: c4c3ee7224fa3c24b2f953f318cef12fc27573a7 (plain)
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
#ifndef LITEHTML_FONT_DESCRIPTION
#define LITEHTML_FONT_DESCRIPTION

#include <string>
#include "types.h"
#include "css_length.h"
#include "web_color.h"

namespace litehtml
{
	struct font_description
	{
		std::string				family;	// Font Family
		int						size = 0;	// Font size
		font_style				style = font_style_normal;	// Font stype, see the enum font_style
		int						weight;	// Font weight.
		int						decoration_line = text_decoration_line_none;	// Decoration line. A bitset of flags of the enum text_decoration_line
		css_length				decoration_thickness;	// Decoration line thickness in pixels. See predefined values in enumtext_decoration_thickness
		text_decoration_style	decoration_style = text_decoration_style_solid;	// Decoration line style. See enum text_decoration_style
		web_color				decoration_color = web_color::current_color;	// Decoration line color
		std::string				emphasis_style;	// Text emphasis style
		web_color				emphasis_color = web_color::current_color;	// Text emphasis color
		int						emphasis_position = text_emphasis_position_over;	// Text emphasis position

		std::string	hash() const
		{
			std::string out;
			out += family;
			out += ":sz=" + std::to_string(size);
			out += ":st=" + std::to_string(style);
			out += ":w=" + std::to_string(weight);
			out += ":dl=" + std::to_string(decoration_line);
			out += ":dt=" + decoration_thickness.to_string();
			out += ":ds=" + std::to_string(decoration_style);
			out += ":dc=" + decoration_color.to_string();
			out += ":ephs=" + emphasis_style;
			out += ":ephc=" + emphasis_color.to_string();
			out += ":ephp=" + std::to_string(emphasis_position);

			return out;
		}
	};
}

#endif