-
Notifications
You must be signed in to change notification settings - Fork 1
/
el_font.cpp
60 lines (51 loc) · 1.1 KB
/
el_font.cpp
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include "litehtml/html.h"
#include "litehtml/el_font.h"
litehtml::el_font::el_font(const std::shared_ptr<litehtml::document>& doc) : html_tag(doc)
{
}
litehtml::el_font::~el_font()
{
}
void litehtml::el_font::parse_attributes()
{
const tchar_t* str = get_attr(_t("color"));
if(str)
{
m_style.add_property(_t("color"), str, 0, false);
}
str = get_attr(_t("face"));
if(str)
{
m_style.add_property(_t("font-face"), str, 0, false);
}
str = get_attr(_t("size"));
if(str)
{
int sz = t_atoi(str);
if(sz <= 1)
{
m_style.add_property(_t("font-size"), _t("x-small"), 0, false);
} else if(sz >= 6)
{
m_style.add_property(_t("font-size"), _t("xx-large"), 0, false);
} else
{
switch(sz)
{
case 2:
m_style.add_property(_t("font-size"), _t("small"), 0, false);
break;
case 3:
m_style.add_property(_t("font-size"), _t("medium"), 0, false);
break;
case 4:
m_style.add_property(_t("font-size"), _t("large"), 0, false);
break;
case 5:
m_style.add_property(_t("font-size"), _t("x-large"), 0, false);
break;
}
}
}
html_tag::parse_attributes();
}