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
|
# File 'lacci/lib/shoes/drawables/font_helper.rb', line 3
def parse_font(font)
input = font
regex = /\s+(?=(?:[^']*'[^']*')*[^']*$)(?![^']*,[^']*')/
result = input.split(regex)
fs = nil
fv = nil
fw = nil
fss = nil
ff = ""
fos = ["italic", "oblique"]
fov = ["small-caps", "initial", "inherit"]
fow = ["bold", "bolder", "lighter", "100", "200", "300", "400", "500", "600", "700", "800", "900"]
foss = ["xx-small", "x-small", "small","large", "x-large", "xx-large", "smaller", "larger"]
result.each do |i|
if fos.include?(i)
fs = i
next
elsif fov.include?(i)
fv = i
next
elsif fow.include?(i)
fw = i
next
elsif foss.include?(i)
fss = i
next
else
if contains_number?(i)
fss=i;
elsif i != "normal" && i != "medium" && i.strip != ""
if ff == "Arial"
ff = i
else
ff = ff+" "+i
end
end
end
end
[fs, fv , fw , fss , ff.strip]
end
|