-
Notifications
You must be signed in to change notification settings - Fork 11
/
iosevka.rb
310 lines (265 loc) · 13.2 KB
/
iosevka.rb
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
require "language/node"
class Iosevka < Formula
desc "Monospace font family for programming built from code"
homepage "https://be5invis.github.io/Iosevka"
url "https://github.com/be5invis/Iosevka/archive/v2.2.0.tar.gz"
sha256 "af573349647976d714facbbc8ff13ee14bd050571919aedb5c90681a6f831966"
head "https://github.com/be5invis/Iosevka.git"
option "without-sans", "skip building the default sans variant"
option "with-slab", "additionally build the serif variant"
option "with-woff", "additionally build the webfonts (woff)"
option "with-woff2", "additionally build the webfonts (woff2)"
option "with-unhinted", "additionally build unhinted TTF"
option "with-ss01", "build set based on the style of Andale Mono"
option "with-ss02", "build set based on the style of Anonymous Pro"
option "with-ss03", "build set based on the style of Consolas"
option "with-ss04", "build set based on the style of Menlo"
option "with-ss05", "build set based on the style of Fira Mono"
option "with-ss06", "build set based on the style of Liberation Mono"
option "with-ss07", "build set based on the style of Monaco"
option "with-ss08", "build set based on the style of Pragmata Pro"
option "with-ss09", "build set based on the style of Source Code Pro"
option "with-ss10", "build set based on the style of Envy Code R"
option "with-ss11", "build set based on the style of X Windows Fixed"
option "with-term", "disable ligations and exact monospace"
option "with-termlig", "like term but ligations are present"
option "with-type", "make symbols fullwidth"
option "with-stress-fw", "full-width characters varying form U+FF00 to U+FFFF will be boxed to present a clear distinguish between ASCII and Full-width"
option "with-ligset-haskell", "default ligation set would be assigned to Haskell"
option "with-ligset-idris", "default ligation set would be assigned to Idris"
option "with-ligset-coq", "default ligation set would be assigned to Coq (contains all possible ligatures)"
option "with-ligset-elm", "default ligation set would be assigned to Elm"
option "with-ligset-ml", "default ligation set would be assigned to ML"
option "with-ligset-fs", "default ligation set would be assigned to F#"
option "with-ligset-fstar", "default ligation set would be assigned to F*"
option "with-ligset-swift", "default ligation set would be assigned to Swift"
option "with-ligset-purescript", "default ligation set would be assigned to PureScript"
# TODO: leading-*
# TODO: powerline-*
option "with-experimental-expanded", "build with 10% wider characters"
option "with-experimental-compressed", "build with 10% narrower characters"
option "with-zero-dotted"
option "with-zero-unslashed"
option "with-zero-slashed"
option "with-at-long"
option "with-at-short"
option "with-at-fourfold"
option "with-tilde-high"
option "with-tilde-low"
option "with-asterisk-high"
option "with-asterisk-low"
option "with-asterisk-hexhigh"
option "with-asterisk-hexlow"
option "with-paragraph-high"
option "with-paragraph-low"
option "with-caret-high"
option "with-caret-low"
option "with-underscore-high"
option "with-underscore-low"
option "with-percent-dots"
option "with-percent-rings"
option "with-eszet-traditional"
option "with-eszet-sulzbacher"
option "with-brace-curly"
option "with-brace-straight"
option "with-g-singlestorey"
option "with-g-opendoublestorey"
option "with-g-doublestorey"
option "with-numbersign-slanted"
option "with-numbersign-straight"
option "with-dollar-through"
option "with-dollar-open"
option "with-dollar-opencap"
option "with-dollar-throughcap"
option "with-q-straight"
option "with-q-taily"
option "with-t-standard"
option "with-t-cross"
option "with-three-flattop"
option "with-three-twoarcs"
option "with-a-singlestorey"
option "with-a-doublestorey"
option "with-m-shortleg"
option "with-m-longleg"
option "with-l-hooky"
option "with-l-zshaped"
option "with-l-serifed"
option "with-l-italic"
option "with-l-tailed"
option "with-l-hookybottom"
option "with-i-hooky"
option "with-i-zshaped"
option "with-i-serified"
option "with-i-italic"
option "with-i-line"
option "with-j-serifed"
option "with-j-line"
option "with-f-straight"
option "with-f-tailed"
option "with-y-straight"
option "with-y-curly"
option "with-one-serifed"
option "with-one-hooky"
option "without-weight-thin", "skip building the 'thin' (100) weight"
option "without-weight-extralight", "skip building the 'extralight' (200) weight"
option "without-weight-light", "skip building the 'light' (300) weight"
option "without-weight-regular", "skip building the 'regular' (400) weight"
option "without-weight-medium", "skip building the 'medium' (500) weight"
option "without-weight-semibold", "skip building the 'semibold' (600) weight"
option "without-weight-bold", "skip building the 'bold' (700) weight"
option "without-weight-extrabold", "skip building the 'extrabold' (800) weight"
option "without-weight-heavy", "skip building the 'heavy' (900) weight"
option "without-slant-upright", "skip building the 'upright' slant vaiant"
option "without-slant-italic", "skip building the 'italic' slant vaiant"
option "without-slant-oblique", "skip building the 'oblique' slant vaiant"
def return_if_build_option(val, prefix = "")
return "#{prefix}#{val}" if build.with? val
end
def return_if_experimental_build_option(val)
return val if build.with? "experimental-#{val}"
end
def return_variant_if_build_option(val)
return return_if_build_option(val, "v-")
end
depends_on "caryll/tap/otfcc-mac64" => :build
depends_on "node" => :build
depends_on "ttfautohint" => :build
def install
design = []
design << "sans" if build.with? "sans"
design << return_if_build_option("slab")
# predefined stylistic sets
design << return_if_build_option("ss01")
design << return_if_build_option("ss02")
design << return_if_build_option("ss03")
design << return_if_build_option("ss04")
design << return_if_build_option("ss05")
design << return_if_build_option("ss06")
design << return_if_build_option("ss07")
design << return_if_build_option("ss08")
design << return_if_build_option("ss09")
design << return_if_build_option("ss10")
design << return_if_build_option("ss11")
# ligature/spacing styles
design << return_if_build_option("term")
design << return_if_build_option("termlig")
design << return_if_build_option("type")
design << return_if_build_option("stress-fw")
design << return_if_build_option("ligset-haskell")
design << return_if_build_option("ligset-idris")
design << return_if_build_option("ligset-coq")
design << return_if_build_option("ligset-elm")
design << return_if_build_option("ligset-ml")
design << return_if_build_option("ligset-fs")
design << return_if_build_option("ligset-fstar")
design << return_if_build_option("ligset-swift")
design << return_if_build_option("ligset-purescript")
# character variants
design << return_variant_if_build_option("zero-dotted")
design << return_variant_if_build_option("zero-unslashed")
design << return_variant_if_build_option("zero-slashed")
design << return_variant_if_build_option("at-long")
design << return_variant_if_build_option("at-short")
design << return_variant_if_build_option("at-fourfold")
design << return_variant_if_build_option("tilde-high")
design << return_variant_if_build_option("tilde-low")
design << return_variant_if_build_option("asterisk-high")
design << return_variant_if_build_option("asterisk-low")
design << return_variant_if_build_option("asterisk-hexhigh")
design << return_variant_if_build_option("asterisk-hexlow")
design << return_variant_if_build_option("paragraph-high")
design << return_variant_if_build_option("paragraph-low")
design << return_variant_if_build_option("caret-high")
design << return_variant_if_build_option("caret-low")
design << return_variant_if_build_option("underscore-high")
design << return_variant_if_build_option("underscore-low")
design << return_variant_if_build_option("percent-dots")
design << return_variant_if_build_option("percent-rings")
design << return_variant_if_build_option("eszet-traditional")
design << return_variant_if_build_option("eszet-sulzbacher")
design << return_variant_if_build_option("brace-curly")
design << return_variant_if_build_option("brace-straight")
design << return_variant_if_build_option("g-singlestorey")
design << return_variant_if_build_option("g-opendoublestorey")
design << return_variant_if_build_option("g-doublestorey")
design << return_variant_if_build_option("numbersign-slanted")
design << return_variant_if_build_option("numbersign-straight")
design << return_variant_if_build_option("dollar-through")
design << return_variant_if_build_option("dollar-opencap")
design << return_variant_if_build_option("dollar-throughcap")
design << return_variant_if_build_option("dollar-open")
design << return_variant_if_build_option("q-straight")
design << return_variant_if_build_option("q-taily")
design << return_variant_if_build_option("t-standard")
design << return_variant_if_build_option("t-cross")
design << return_variant_if_build_option("three-flattop")
design << return_variant_if_build_option("three-twoarcs")
design << return_variant_if_build_option("a-singlestorey")
design << return_variant_if_build_option("a-doublestorey")
design << return_variant_if_build_option("m-shortleg")
design << return_variant_if_build_option("m-longleg")
design << return_variant_if_build_option("l-hooky")
design << return_variant_if_build_option("l-zshaped")
design << return_variant_if_build_option("l-serifed")
design << return_variant_if_build_option("l-italic")
design << return_variant_if_build_option("l-tailed")
design << return_variant_if_build_option("l-hookybottom")
design << return_variant_if_build_option("i-hooky")
design << return_variant_if_build_option("i-zshaped")
design << return_variant_if_build_option("i-serified")
design << return_variant_if_build_option("i-italic")
design << return_variant_if_build_option("i-line")
design << return_variant_if_build_option("j-serified")
design << return_variant_if_build_option("j-line")
design << return_variant_if_build_option("f-straight")
design << return_variant_if_build_option("f-tailed")
design << return_variant_if_build_option("y-straight")
design << return_variant_if_build_option("y-curly")
design << return_variant_if_build_option("one-serifed")
design << return_variant_if_build_option("one-hooky")
design.delete_if &:nil? # cleanup design array
# experimental width mods (can only apply one at a time)
# if both we choose expanded
with_mod = return_if_experimental_build_option("compressed")
with_mod = return_if_experimental_build_option("expanded")
design << with_mod unless with_mod.nil?
system "npm", "install", *Language::Node.local_npm_install_args
File.open("private-build-plans.toml", "w:UTF-8") do |f|
f.puts "[buildPlans.iosevka-brew]"
f.puts "family = \"Iosevka Brew\""
f.puts "design = [\"#{design.join('", "')}\"]"
f.puts "\n"
f.puts "[buildPlans.iosevka-brew.weights.thin]\nshape=100\ncss=100" if build.with? "weight-thin"
f.puts "[buildPlans.iosevka-brew.weights.extralight]\nshape=200\ncss=200" if build.with? "weight-extralight"
f.puts "[buildPlans.iosevka-brew.weights.light]\nshape=300\ncss=300" if build.with? "weight-light"
f.puts "[buildPlans.iosevka-brew.weights.regular]\nshape=400\ncss=400" if build.with? "weight-regular"
f.puts "[buildPlans.iosevka-brew.weights.medium]\nshape=500\ncss=500" if build.with? "weight-medium"
f.puts "[buildPlans.iosevka-brew.weights.semibold]\nshape=600\ncss=600" if build.with? "weight-semibold"
f.puts "[buildPlans.iosevka-brew.weights.bold]\nshape=700\ncss=700" if build.with? "weight-bold"
f.puts "[buildPlans.iosevka-brew.weights.extrabold]\nshape=800\ncss=800" if build.with? "weight-extrabold"
f.puts "[buildPlans.iosevka-brew.weights.heavy]\nshape=900\ncss=900" if build.with? "weight-heavy"
f.puts "\n"
unless build.without? "slant-upright" and build.without? "slant-italic" and build.without? "slant-oblique"
f.puts "[buildPlans.iosevka-brew.slants]"
f.puts "upright = \"normal\"" if build.with? "slant-upright"
f.puts "italic = \"italic\"" if build.with? "slant-italic"
f.puts "oblique = \"oblique\"" if build.with? "slant-oblique"
end
end
system "npm", "run", "build", "--", "ttf::iosevka-brew" unless build.with? "woff" or build.with? "woff2"
system "npm", "run", "build", "--", "woff::iosevka-brew" if build.with? "woff"
system "npm", "run", "build", "--", "woff2::iosevka-brew" if build.with? "woff2"
system "npm", "run", "build", "--", "ttf-unhinted::iosevka-brew" if build.with? "unhinted"
share.install Dir["dist/*"]
end
def caveats
<<~EOS
Homebrew does not allow Formulas to move files to arbitrary locations in the filesystem.
To install the font please do:
cp -fr #{share}/ ~/Library/Fonts/iosevka
EOS
end
test do
opoo "no tests"
end
end