Cogs.Core
el_font.cpp
1#include "html.h"
2#include "el_font.h"
3
4
5litehtml::el_font::el_font(const std::shared_ptr<litehtml::document>& doc) : html_tag(doc)
6{
7
8}
9
10litehtml::el_font::~el_font()
11{
12
13}
14
15void litehtml::el_font::parse_attributes()
16{
17 const tchar_t* str = get_attr(_t("color"));
18 if(str)
19 {
20 m_style.add_property(_t("color"), str, 0, false);
21 }
22
23 str = get_attr(_t("face"));
24 if(str)
25 {
26 m_style.add_property(_t("font-face"), str, 0, false);
27 }
28
29 str = get_attr(_t("size"));
30 if(str)
31 {
32 int sz = t_atoi(str);
33 if(sz <= 1)
34 {
35 m_style.add_property(_t("font-size"), _t("x-small"), 0, false);
36 } else if(sz >= 6)
37 {
38 m_style.add_property(_t("font-size"), _t("xx-large"), 0, false);
39 } else
40 {
41 switch(sz)
42 {
43 case 2:
44 m_style.add_property(_t("font-size"), _t("small"), 0, false);
45 break;
46 case 3:
47 m_style.add_property(_t("font-size"), _t("medium"), 0, false);
48 break;
49 case 4:
50 m_style.add_property(_t("font-size"), _t("large"), 0, false);
51 break;
52 case 5:
53 m_style.add_property(_t("font-size"), _t("x-large"), 0, false);
54 break;
55 }
56 }
57 }
58
59 html_tag::parse_attributes();
60}