-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.js
139 lines (135 loc) · 4.32 KB
/
main.js
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
var skip = [
'leco_20_bold_numbers_lower',
'leco_20_bold_numbers_latin',
'leco_26_bold_numbers_am_pm_lower',
'leco_26_bold_numbers_am_pm_latin',
'leco_32_bold_numbers_upper',
'leco_32_bold_numbers_lower',
'leco_32_bold_numbers_latin',
'leco_36_bold_numbers_upper',
'leco_36_bold_numbers_lower',
'leco_36_bold_numbers_latin',
'leco_38_bold_numbers_upper',
'leco_38_bold_numbers_lower',
'leco_38_bold_numbers_latin',
'leco_42_numbers_upper',
'leco_42_numbers_lower',
'leco_42_numbers_latin',
'leco_28_light_numbers_upper',
'leco_28_light_numbers_lower',
'leco_28_light_numbers_latin',
'bitham_18_light_subset_upper',
'bitham_18_light_subset_numbers',
'bitham_18_light_subset_latin',
'bitham_34_medium_numbers_upper',
'bitham_34_medium_numbers_lower',
'bitham_34_medium_numbers_symbols',
'bitham_34_medium_numbers_latin',
'bitham_34_light_subset_upper',
'bitham_34_light_subset_numbers',
'bitham_34_light_subset_latin',
'bitham_42_medium_numbers_upper',
'bitham_42_medium_numbers_lower',
'bitham_42_medium_numbers_latin',
'roboto_bold_subset_49_upper',
'roboto_bold_subset_49_lower',
'roboto_bold_subset_49_symbols',
'roboto_bold_subset_49_latin',
]
var flags = {
'gothic_14': ['emoji-s'], 'gothic_14_bold': ['emoji-s'],
'gothic_18': ['emoji-s'], 'gothic_18_bold': ['emoji-s'],
'gothic_24': ['emoji-l'], 'gothic_24_bold': ['emoji-l'],
'gothic_28': ['emoji-l'], 'gothic_28_bold': ['emoji-l'],
'droid_serif_28_bold': ['emoji-l'],
'bitham_18_light_subset': ['emoji-s'],
'leco_28_light_numbers': ['emoji-l']
}
var fonts = {
"gothic": [
"09",
"14",
"14_bold",
"18",
"18_bold",
"24",
"24_bold",
"28",
"28_bold"
],
"leco": [
"20_bold_numbers",
"26_bold_numbers_am_pm",
"28_light_numbers",
"32_bold_numbers",
"36_bold_numbers",
"38_bold_numbers",
"42_numbers"
],
"bitham": [
"18_light_subset",
"30_black",
"34_medium_numbers",
"34_light_subset",
"42_bold",
"42_light",
"42_medium_numbers"
],
"roboto": [
"condensed_21",
"bold_subset_49"
],
"droid_serif": [
"28_bold"
]
}
var screens = [
"upper",
"lower",
"numbers",
"special",
"latin",
]
var listEl = document.querySelector('#main')
for (var family in fonts) {
var familyEl = document.createElement('section')
familyEl.setAttribute('data-family', family)
var titleEl = document.createElement('h2')
titleEl.innerText = family.replace(/_/, ' ')
familyEl.appendChild(titleEl)
for (var style in fonts[family]) {
var styleEl = document.createElement('figure')
styleEl.setAttribute('tab-order', '-1');
styleEl.setAttribute('id', family + '_' + fonts[family][style]);
styleEl.setAttribute('data-style', fonts[family][style])
for (var screen in screens) {
if (skip.indexOf(family + '_' + fonts[family][style] + '_' +
screens[screen]) != -1)
continue
var imageWrapper = document.createElement('div')
imageWrapper.classList.add('image-wrapper')
var imageEl = document.createElement('img')
imageEl.setAttribute('data-original',
'screenshots/' + family + '_' + fonts[family][style] + '_' +
screens[screen] + '.png')
imageWrapper.appendChild(imageEl)
styleEl.appendChild(imageWrapper)
}
var metaEl = document.createElement('p')
metaEl.classList.add('metadata')
if (family + '_' + fonts[family][style] in flags) {
metaEl.classList.add(flags[family + '_' + fonts[family][style]])
}
metaEl.innerHTML += '<span class="friendly">' +
family.replace(/_/g, ' ') + ' ' +
fonts[family][style].replace(/_/g, ' ') +
'</span> <span class="technical">' +
'<span class="invisible">FONT_KEY_</span>' +
family.toUpperCase() + '_' +
fonts[family][style].toUpperCase() +
'</span>'
styleEl.appendChild(metaEl)
familyEl.appendChild(styleEl)
}
listEl.appendChild(familyEl)
}