fontist 1.10.0 → 1.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.adoc +758 -0
- data/README.md +12 -0
- data/exe/fontist +24 -2
- data/fontist.gemspec +2 -0
- data/lib/fontist/version.rb +1 -1
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d84a50748e0877ef76056095c21debe35d0d3c158cdb52288ee179045e3e7bc
|
4
|
+
data.tar.gz: fd7254ad078c082f72e22098cace2f937afbbc7715b30c830d76db5aef9ad82f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dcc9e36af40e5ec08170151f0c9177e3f21f3e0a6cbdf87b7b0ea8b7f6aa3505c05a31828bbc20953787e50232e9805e4f2506c3f17723521001d0d47877370b
|
7
|
+
data.tar.gz: '0045179af59b9639c89d05a9c8b21a2bae720df2513f832af5f0006fe16c1d8ff32c524040e3c9ea60046671750594a9d46fc74452487fb23889d4629e38a41f'
|
data/README.adoc
ADDED
@@ -0,0 +1,758 @@
|
|
1
|
+
= Fontist
|
2
|
+
|
3
|
+
image:https://github.com/fontist/fontist/actions/workflows/rspec.yml/badge.svg["Build Status", link="https://github.com/fontist/fontist/actions/workflows/rspec.yml"]
|
4
|
+
image:https://img.shields.io/gem/v/fontist.svg["Gem Version", link="https://rubygems.org/gems/fontist"]
|
5
|
+
image:https://img.shields.io/github/issues-pr-raw/fontist/fontist.svg["Pull Requests", link="https://github.com/fontist/fontist/pulls"]
|
6
|
+
|
7
|
+
A simple library to find and download fonts for Windows, Linux and Mac.
|
8
|
+
|
9
|
+
== Installation
|
10
|
+
|
11
|
+
Install it directly as:
|
12
|
+
|
13
|
+
[source,sh]
|
14
|
+
----
|
15
|
+
gem install fontist
|
16
|
+
----
|
17
|
+
|
18
|
+
Or use it as part of your bundle by adding this line to your application's
|
19
|
+
`Gemfile`:
|
20
|
+
|
21
|
+
[source,ruby]
|
22
|
+
----
|
23
|
+
gem "fontist"
|
24
|
+
----
|
25
|
+
|
26
|
+
And then execute:
|
27
|
+
|
28
|
+
[source,sh]
|
29
|
+
----
|
30
|
+
bundle install
|
31
|
+
----
|
32
|
+
|
33
|
+
=== Fetch formulas
|
34
|
+
|
35
|
+
After installation, please fetch formulas via the `fontist` command:
|
36
|
+
|
37
|
+
[source,sh]
|
38
|
+
----
|
39
|
+
fontist update
|
40
|
+
----
|
41
|
+
|
42
|
+
=== Dependencies
|
43
|
+
|
44
|
+
Depends on
|
45
|
+
https://github.com/fontist/ffi-libarchive-binary[ffi-libarchive-binary] which
|
46
|
+
has the following requirements:
|
47
|
+
|
48
|
+
* zlib
|
49
|
+
* Expat
|
50
|
+
* OpenSSL (for Linux only)
|
51
|
+
|
52
|
+
These dependencies are generally present on all systems.
|
53
|
+
|
54
|
+
== Usage of the `fontist` command
|
55
|
+
|
56
|
+
=== Fontist command-line interface
|
57
|
+
|
58
|
+
These commands makes possible to operate with fonts via command line.
|
59
|
+
|
60
|
+
The CLI properly supports exit status, so in a case of error it returns a status
|
61
|
+
code higher or equal than 1.
|
62
|
+
|
63
|
+
All searches are case-insensitive for ease of use.
|
64
|
+
|
65
|
+
=== Install fonts
|
66
|
+
|
67
|
+
Fontist checks whether this font is already installed, and if not, then installs
|
68
|
+
the font and returns its installed paths.
|
69
|
+
|
70
|
+
Only the font name (not formula name, nor font filename) could be used as its
|
71
|
+
argument.
|
72
|
+
|
73
|
+
[source,sh]
|
74
|
+
----
|
75
|
+
$ fontist install "segoe ui"
|
76
|
+
These fonts are found or installed:
|
77
|
+
/Users/user/.fontist/fonts/SEGOEUI.TTF
|
78
|
+
/Users/user/.fontist/fonts/SEGOEUIB.TTF
|
79
|
+
/Users/user/.fontist/fonts/SEGOEUII.TTF
|
80
|
+
/Users/user/.fontist/fonts/SEGOEUIZ.TTF
|
81
|
+
----
|
82
|
+
|
83
|
+
NOTE: The `install` command is similar to the `Font.install` library call.
|
84
|
+
|
85
|
+
=== Uninstall fonts
|
86
|
+
|
87
|
+
Uninstalls any font supported by Fontist.
|
88
|
+
|
89
|
+
Returns paths of an uninstalled font, or prints an error telling that the font
|
90
|
+
isn't installed or could not be found in Fontist formulas. Aliased as `remove`.
|
91
|
+
|
92
|
+
[source,sh]
|
93
|
+
----
|
94
|
+
$ fontist uninstall "segoe ui"
|
95
|
+
These fonts are removed:
|
96
|
+
/Users/user/.fontist/fonts/SEGOEUII.TTF
|
97
|
+
/Users/user/.fontist/fonts/SEGOEUIZ.TTF
|
98
|
+
/Users/user/.fontist/fonts/SEGOEUIB.TTF
|
99
|
+
/Users/user/.fontist/fonts/SEGOEUI.TTF
|
100
|
+
----
|
101
|
+
|
102
|
+
=== Status
|
103
|
+
|
104
|
+
Prints installed font paths grouped by formula and font.
|
105
|
+
|
106
|
+
[source,sh]
|
107
|
+
----
|
108
|
+
$ fontist status "segoe ui"
|
109
|
+
segoe_ui
|
110
|
+
Segoe UI
|
111
|
+
Regular (/Users/user/.fontist/fonts/SEGOEUI.TTF)
|
112
|
+
Bold (/Users/user/.fontist/fonts/SEGOEUIB.TTF)
|
113
|
+
Italic (/Users/user/.fontist/fonts/SEGOEUII.TTF)
|
114
|
+
Bold Italic (/Users/user/.fontist/fonts/SEGOEUIZ.TTF)
|
115
|
+
----
|
116
|
+
|
117
|
+
=== List
|
118
|
+
|
119
|
+
Lists installation status of fonts supported by Fontist.
|
120
|
+
|
121
|
+
[source,sh]
|
122
|
+
----
|
123
|
+
$ fontist list "segoe ui"
|
124
|
+
segoe_ui
|
125
|
+
Segoe UI
|
126
|
+
Regular (installed)
|
127
|
+
Bold (installed)
|
128
|
+
Italic (installed)
|
129
|
+
Bold Italic (installed)
|
130
|
+
----
|
131
|
+
|
132
|
+
[source,sh]
|
133
|
+
----
|
134
|
+
$ fontist list "roboto mono"
|
135
|
+
google/roboto_mono
|
136
|
+
Roboto Mono
|
137
|
+
Regular (uninstalled)
|
138
|
+
Italic (uninstalled)
|
139
|
+
----
|
140
|
+
|
141
|
+
=== List installed font paths
|
142
|
+
|
143
|
+
Returns locations of fonts specified in a YAML file as an input.
|
144
|
+
|
145
|
+
[source,sh]
|
146
|
+
----
|
147
|
+
$ fontist manifest-locations MANIFEST_FILE
|
148
|
+
----
|
149
|
+
|
150
|
+
`MANIFEST_FILE` is the location of a manifest file that contains specification
|
151
|
+
of one or multiple font and font styles.
|
152
|
+
|
153
|
+
A manifest file `manifest.yml` could look like:
|
154
|
+
====
|
155
|
+
[source,yml]
|
156
|
+
----
|
157
|
+
Segoe UI:
|
158
|
+
- Regular
|
159
|
+
- Bold
|
160
|
+
Roboto Mono:
|
161
|
+
- Regular
|
162
|
+
----
|
163
|
+
====
|
164
|
+
|
165
|
+
The following command will return the following YAML output:
|
166
|
+
|
167
|
+
[source,sh]
|
168
|
+
----
|
169
|
+
$ fontist manifest-locations manifest.yml
|
170
|
+
----
|
171
|
+
|
172
|
+
[source,yml]
|
173
|
+
----
|
174
|
+
---
|
175
|
+
Segoe UI:
|
176
|
+
Regular:
|
177
|
+
full_name: Segoe UI
|
178
|
+
paths:
|
179
|
+
- "/Users/user/.fontist/fonts/SEGOEUI.TTF"
|
180
|
+
Bold:
|
181
|
+
full_name: Segoe UI Bold
|
182
|
+
paths:
|
183
|
+
- "/Users/user/.fontist/fonts/SEGOEUIB.TTF"
|
184
|
+
Roboto Mono:
|
185
|
+
Regular:
|
186
|
+
full_name:
|
187
|
+
paths: []
|
188
|
+
----
|
189
|
+
|
190
|
+
Since "`Segoe UI`" is installed, but "`Roboto Mono`" is not.
|
191
|
+
|
192
|
+
=== Install fonts from manifest
|
193
|
+
|
194
|
+
Install fonts from a YAML Fontist manifest:
|
195
|
+
|
196
|
+
[source,sh]
|
197
|
+
----
|
198
|
+
$ fontist manifest-install --confirm-license manifest.yml
|
199
|
+
----
|
200
|
+
|
201
|
+
Where `manifest.yaml` is:
|
202
|
+
|
203
|
+
[source,yml]
|
204
|
+
----
|
205
|
+
---
|
206
|
+
Segoe UI:
|
207
|
+
Regular:
|
208
|
+
full_name: Segoe UI
|
209
|
+
paths:
|
210
|
+
- "/Users/user/.fontist/fonts/SEGOEUI.TTF"
|
211
|
+
Bold:
|
212
|
+
full_name: Segoe UI Bold
|
213
|
+
paths:
|
214
|
+
- "/Users/user/.fontist/fonts/SEGOEUIB.TTF"
|
215
|
+
Roboto Mono:
|
216
|
+
Regular:
|
217
|
+
full_name: Roboto Mono Regular
|
218
|
+
paths:
|
219
|
+
- "/Users/user/.fontist/fonts/RobotoMono-VariableFont_wght.ttf"
|
220
|
+
----
|
221
|
+
|
222
|
+
=== Help
|
223
|
+
|
224
|
+
List of all commands could be seen by:
|
225
|
+
|
226
|
+
[source,sh]
|
227
|
+
----
|
228
|
+
fontist help
|
229
|
+
----
|
230
|
+
|
231
|
+
=== Configuration
|
232
|
+
|
233
|
+
By default Fontist uses the `~/.fontist` directory to store fonts and its
|
234
|
+
files. It could be changed with the `FONTIST_PATH` environment variable.
|
235
|
+
|
236
|
+
[source,sh]
|
237
|
+
----
|
238
|
+
FONTIST_PATH=~/.fontist_new fontist update
|
239
|
+
----
|
240
|
+
|
241
|
+
|
242
|
+
== Usage of the Fontist Ruby library
|
243
|
+
|
244
|
+
=== `Fontist::Font`
|
245
|
+
|
246
|
+
The `Fontist::Font` is your go-to place to deal with any font using Fontist.
|
247
|
+
|
248
|
+
This interface allows you to find a font or install a font.
|
249
|
+
|
250
|
+
==== Finding a font
|
251
|
+
|
252
|
+
The `Fontist::Font.find` interface can be used a find a font in your system.
|
253
|
+
|
254
|
+
It will look into the operating system specific font directories, and also the
|
255
|
+
fontist specific `~/.fontist` directory.
|
256
|
+
|
257
|
+
[source,ruby]
|
258
|
+
----
|
259
|
+
Fontist::Font.find(name)
|
260
|
+
----
|
261
|
+
|
262
|
+
* If Fontist finds a font, then it will return the paths.
|
263
|
+
|
264
|
+
* Otherwise, it will either raise an unsupported font error, or trigger display
|
265
|
+
of installation instructions for that specific font.
|
266
|
+
|
267
|
+
==== Install a font
|
268
|
+
|
269
|
+
The `Fontist::Font.install` interface can be used to install any supported font.
|
270
|
+
|
271
|
+
This interface first checks if you already have that font installed or not and
|
272
|
+
if you do then it will return the paths.
|
273
|
+
|
274
|
+
If you don't have a font but that font is supported by Fontist, then it will
|
275
|
+
download the font and copy it to `~/.fontist` directory and also return the
|
276
|
+
paths.
|
277
|
+
|
278
|
+
[source,ruby]
|
279
|
+
----
|
280
|
+
Fontist::Font.install(name, confirmation: "no")
|
281
|
+
----
|
282
|
+
|
283
|
+
If there are issues detected with the provided font, such as the font is not
|
284
|
+
supported, those errors would be raised.
|
285
|
+
|
286
|
+
==== List all fonts
|
287
|
+
|
288
|
+
The `Fontist::Font` interface exposes an interface to list all supported fonts.
|
289
|
+
|
290
|
+
This might be useful if want to know the name of the font or the available
|
291
|
+
styles. You can do that by using:
|
292
|
+
|
293
|
+
[source,ruby]
|
294
|
+
----
|
295
|
+
Fontist::Font.all
|
296
|
+
----
|
297
|
+
|
298
|
+
The return values are `OpenStruct` objects, so you can easily do any other
|
299
|
+
operation you would do in any ruby object.
|
300
|
+
|
301
|
+
=== `Fontist::Formula`
|
302
|
+
|
303
|
+
The `fontist` gem internally usages the `Fontist::Formula` interface to find a
|
304
|
+
registered formula or fonts supported by any formula. Unless, you need to do
|
305
|
+
anything with that you shouldn't need to work with this interface directly. But
|
306
|
+
if you do then these are the public interface it offers.
|
307
|
+
|
308
|
+
==== Find a formula
|
309
|
+
|
310
|
+
The `Fontist::Formula.find` interface allows you to find any of the registered
|
311
|
+
formula. This interface takes a font name as an argument and it looks through
|
312
|
+
each of the registered formula that offers this font installation. Usages:
|
313
|
+
|
314
|
+
[source,ruby]
|
315
|
+
----
|
316
|
+
Fontist::Formula.find("Calibri")
|
317
|
+
----
|
318
|
+
|
319
|
+
This method will search and return a Fontist formula for the provided keyword
|
320
|
+
which allows for further processing, such as licence checks or proceeding with
|
321
|
+
installation of the font in your system.
|
322
|
+
|
323
|
+
==== List font styles supported by a formula
|
324
|
+
|
325
|
+
Normally, each font name can be associated with multiple styles or collection,
|
326
|
+
for example the `Calibri` font might contains a `regular`, `bold` or `italic`
|
327
|
+
styles fonts and if you want a interface that can return the complete list then
|
328
|
+
this is your friend.
|
329
|
+
|
330
|
+
You can use it as following:
|
331
|
+
|
332
|
+
[source,ruby]
|
333
|
+
----
|
334
|
+
Fontist::Formula.find_fonts("Calibri")
|
335
|
+
----
|
336
|
+
|
337
|
+
==== List all formulas
|
338
|
+
|
339
|
+
The `Fontist::Formula` interface exposes an interface to list all registered
|
340
|
+
font formula. This might be useful if want to know the name of the formula or
|
341
|
+
what type fonts can be installed using that formula. Usages:
|
342
|
+
|
343
|
+
[source,ruby]
|
344
|
+
----
|
345
|
+
Fontist::Formula.all
|
346
|
+
----
|
347
|
+
|
348
|
+
The return values are `OpenStruct` objects, so you can easily do any other
|
349
|
+
operation you would do in any ruby object.
|
350
|
+
|
351
|
+
=== `Fontist::Manifest`
|
352
|
+
|
353
|
+
[[fontist-locations]]
|
354
|
+
==== `Fontist::Manifest::Locations`
|
355
|
+
|
356
|
+
Fontist lets you find font locations from a defined manifest Hash in the
|
357
|
+
following format:
|
358
|
+
|
359
|
+
[source,ruby]
|
360
|
+
----
|
361
|
+
{
|
362
|
+
"Segoe UI"=>["Regular", "Bold"],
|
363
|
+
"Roboto Mono"=>["Regular"]
|
364
|
+
}
|
365
|
+
----
|
366
|
+
|
367
|
+
Calling the following code returns a nested Hash with font paths and names.
|
368
|
+
Font name is useful to choose a specific font in a font collection file (TTC).
|
369
|
+
|
370
|
+
[source,ruby]
|
371
|
+
----
|
372
|
+
Fontist::Manifest::Locations.from_hash(manifest)
|
373
|
+
----
|
374
|
+
|
375
|
+
[source,ruby]
|
376
|
+
----
|
377
|
+
{
|
378
|
+
"Segoe UI"=> {
|
379
|
+
"Regular"=>{
|
380
|
+
"full_name"=>"Segoe UI",
|
381
|
+
"paths"=>["/Users/user/.fontist/fonts/SEGOEUI.TTF"]
|
382
|
+
},
|
383
|
+
"Bold"=>{
|
384
|
+
"full_name"=>"Segoe UI Bold",
|
385
|
+
"paths"=>["/Users/user/.fontist/fonts/SEGOEUIB.TTF"]
|
386
|
+
}
|
387
|
+
},
|
388
|
+
"Roboto Mono"=> {
|
389
|
+
"Regular"=>{
|
390
|
+
"full_name"=>nil,
|
391
|
+
"paths"=>[]
|
392
|
+
}
|
393
|
+
}
|
394
|
+
}
|
395
|
+
----
|
396
|
+
|
397
|
+
[[fontist-install]]
|
398
|
+
==== `Fontist::Manifest::Install`
|
399
|
+
|
400
|
+
Fontist lets you not only to obtain font locations but also to install fonts
|
401
|
+
from the manifest:
|
402
|
+
|
403
|
+
[source,ruby]
|
404
|
+
----
|
405
|
+
Fontist::Manifest::Install.from_hash(manifest, confirmation: "yes")
|
406
|
+
----
|
407
|
+
|
408
|
+
It will install fonts and return their locations:
|
409
|
+
|
410
|
+
[source,ruby]
|
411
|
+
----
|
412
|
+
{
|
413
|
+
"Segoe UI"=> {
|
414
|
+
"Regular"=>{
|
415
|
+
"full_name"=>"Segoe UI",
|
416
|
+
"paths"=>["/Users/user/.fontist/fonts/SEGOEUI.TTF"]},
|
417
|
+
"Bold"=>{
|
418
|
+
"full_name"=>"Segoe UI Bold",
|
419
|
+
"paths"=>["/Users/user/.fontist/fonts/SEGOEUIB.TTF"]
|
420
|
+
}
|
421
|
+
},
|
422
|
+
"Roboto Mono"=> {
|
423
|
+
"Regular"=>{
|
424
|
+
"full_name"=>"Roboto Mono Regular",
|
425
|
+
"paths"=>["/Users/user/.fontist/fonts/RobotoMono-VariableFont_wght.ttf"]
|
426
|
+
}
|
427
|
+
}
|
428
|
+
}
|
429
|
+
----
|
430
|
+
|
431
|
+
==== Support of YAML format
|
432
|
+
|
433
|
+
Both commands support a YAML file as an input with a `from_file` method. For
|
434
|
+
example, if there is a `manifest.yml` file containing:
|
435
|
+
|
436
|
+
[source,yaml]
|
437
|
+
----
|
438
|
+
---
|
439
|
+
Segoe UI:
|
440
|
+
- Regular
|
441
|
+
- Bold
|
442
|
+
Roboto Mono:
|
443
|
+
- Regular
|
444
|
+
----
|
445
|
+
|
446
|
+
Then the following calls would return font names and paths, as from the
|
447
|
+
`from_hash` method (see <<fontist-install>> and <<fontist-locations>>).
|
448
|
+
|
449
|
+
[source,ruby]
|
450
|
+
----
|
451
|
+
Fontist::Manifest::Locations.from_file("manifest.yml")
|
452
|
+
Fontist::Manifest::Install.from_file("manifest.yml", confirmation: "yes")
|
453
|
+
----
|
454
|
+
|
455
|
+
== Using Fontist with proxies
|
456
|
+
|
457
|
+
Fontist uses Git internally for fetching formulas and fonts.
|
458
|
+
|
459
|
+
In order to use Git functionality behind a proxy, you need to update your own
|
460
|
+
Git config via the `git config` command or the `~/.gitconfig` preference file.
|
461
|
+
|
462
|
+
There are many ways to configure your local Git install to use proxies.
|
463
|
+
|
464
|
+
The simplest, global way of setting a proxy for Git is the following.
|
465
|
+
|
466
|
+
* For HTTP
|
467
|
+
+
|
468
|
+
[source,sh]
|
469
|
+
----
|
470
|
+
git config --global http.proxy http://{user}:{pass}@{proxyhost}:{port}
|
471
|
+
----
|
472
|
+
|
473
|
+
* For HTTPS, you may need to handle SSL/TLS verification errors after setting
|
474
|
+
the proxy since the encryption end is located at your HTTPS proxy endpoint:
|
475
|
+
+
|
476
|
+
[source,sh]
|
477
|
+
----
|
478
|
+
git config --global http.proxy https://{user}:{pass}@{proxyhost}:{port}
|
479
|
+
git config --global https.proxy https://{user}:{pass}@{proxyhost}:{port}
|
480
|
+
----
|
481
|
+
|
482
|
+
* For SOCKS, you will need to decide on the SOCKS protocol
|
483
|
+
+
|
484
|
+
[source,sh]
|
485
|
+
----
|
486
|
+
git config --global http.proxy '{protocol}://{user}:{pass}@{proxyhost}:{port}'
|
487
|
+
git config --global https.proxy '{protocol}://{user}:{pass}@{proxyhost}:{port}'
|
488
|
+
----
|
489
|
+
+
|
490
|
+
For example,
|
491
|
+
+
|
492
|
+
[source,sh]
|
493
|
+
----
|
494
|
+
git config --global http.proxy 'socks5h://user:pass@socks-proxy.example.org'
|
495
|
+
git config --global https.proxy 'socks5h://user:pass@socks-proxy.example.org'
|
496
|
+
----
|
497
|
+
|
498
|
+
The list of supported SOCKS protocols for the `{protocol}` field:
|
499
|
+
|
500
|
+
* `socks://`: for SOCKS below v5
|
501
|
+
* `socks5://`: for SOCKS v5
|
502
|
+
* `socks5h://`: for SOCKS below v5 + host resolution via SOCKS
|
503
|
+
|
504
|
+
You could actually set different proxy behavior for individual Git repositories
|
505
|
+
-- please see this
|
506
|
+
https://gist.github.com/evantoli/f8c23a37eb3558ab8765[great guide]
|
507
|
+
on how to use Git proxies (thanks to the GitHub user
|
508
|
+
https://github.com/evantoli[evantoli]).
|
509
|
+
|
510
|
+
|
511
|
+
|
512
|
+
== Authoring Fontist formulas
|
513
|
+
|
514
|
+
=== Creating a Fontist formula from a font archive
|
515
|
+
|
516
|
+
A formula could be generated from a fonts archive. Just specify a URL to the
|
517
|
+
archive:
|
518
|
+
|
519
|
+
[source,sh]
|
520
|
+
----
|
521
|
+
fontist create-formula https://www.latofonts.com/download/lato2ofl-zip/
|
522
|
+
cp lato.yml ~/.fontist/formulas/Formulas/
|
523
|
+
----
|
524
|
+
|
525
|
+
Though indexes are auto-generated now, maintainers should rebuild indexes in the
|
526
|
+
main repo for backward compatibility with Fontist versinos prior to 1.9.x.
|
527
|
+
|
528
|
+
A formula index should be rebuilt when a new formula is generated or an existing
|
529
|
+
one changed:
|
530
|
+
|
531
|
+
[source,sh]
|
532
|
+
----
|
533
|
+
fontist rebuild-index --main-repo
|
534
|
+
----
|
535
|
+
|
536
|
+
Then, both the formula and the updated indexes should be committed and pushed to
|
537
|
+
the formula repository:
|
538
|
+
|
539
|
+
[source,sh]
|
540
|
+
----
|
541
|
+
cd ~/.fontist/formulas
|
542
|
+
git add Formulas/lato.yml index.yml filename_index.yml
|
543
|
+
git commit -m "Add Lato formula"
|
544
|
+
----
|
545
|
+
|
546
|
+
|
547
|
+
|
548
|
+
|
549
|
+
== Maintenance (for Fontist maintainers only!)
|
550
|
+
|
551
|
+
WARNING: This section is only for Fontist maintainers.
|
552
|
+
|
553
|
+
=== Dynamically importing formulas from Google Fonts
|
554
|
+
|
555
|
+
https://fonts.google.com[Google Fonts] provides probably the largest collection
|
556
|
+
of widely-used, freely and openly licensed fonts.
|
557
|
+
|
558
|
+
Fontist's https://github.com/fonitist/formula[formula library] includes support
|
559
|
+
for all openly-licensed fonts provided through Google Fonts, and maintains
|
560
|
+
Fontist formulas for all such fonts.
|
561
|
+
|
562
|
+
A GHA workflow checks for updated fonts on Google Fonts daily.
|
563
|
+
|
564
|
+
In case an update is found, it could be fetched to the library by:
|
565
|
+
|
566
|
+
[source,sh]
|
567
|
+
----
|
568
|
+
bin/import_google
|
569
|
+
----
|
570
|
+
|
571
|
+
The script would update formulas which should be committed to a separate
|
572
|
+
repository https://github.com/fontist/formulas[formulas]:
|
573
|
+
|
574
|
+
[source,sh]
|
575
|
+
----
|
576
|
+
cd ~/.fontist/formulas
|
577
|
+
git add Formulas/google index.yml filename_index.yml
|
578
|
+
git commit -m "Google Fonts update"
|
579
|
+
git push
|
580
|
+
----
|
581
|
+
|
582
|
+
=== Dynamically importing formulas from SIL
|
583
|
+
|
584
|
+
https://www.sil.org[SIL International] is an internationally recognized
|
585
|
+
faith-based nonprofit organization that serves language communities worldwide.
|
586
|
+
|
587
|
+
SIL provides a number of unique fonts that support smaller language communities
|
588
|
+
that with Unicode code often not (yet) supported by mainstream fonts.
|
589
|
+
|
590
|
+
Fontist aims to support all https://software.sil.org/fonts/[SIL fonts] and
|
591
|
+
provides their formulas in the default Fontist formula repository.
|
592
|
+
|
593
|
+
They can be updated with:
|
594
|
+
|
595
|
+
[source,sh]
|
596
|
+
----
|
597
|
+
fontist import-sil
|
598
|
+
cd ~/.fontist/formulas
|
599
|
+
git add Formulas/sil index.yml filename_index.yml
|
600
|
+
git commit -m "SIL fonts update"
|
601
|
+
git push
|
602
|
+
----
|
603
|
+
|
604
|
+
|
605
|
+
== Development
|
606
|
+
|
607
|
+
=== Setup
|
608
|
+
|
609
|
+
Clone the repository.
|
610
|
+
|
611
|
+
[source,sh]
|
612
|
+
----
|
613
|
+
git clone https://github.com/fontist/fontist
|
614
|
+
----
|
615
|
+
|
616
|
+
Setup your environment.
|
617
|
+
|
618
|
+
[source,sh]
|
619
|
+
----
|
620
|
+
bin/setup
|
621
|
+
----
|
622
|
+
|
623
|
+
Run the test suite
|
624
|
+
|
625
|
+
[source,sh]
|
626
|
+
----
|
627
|
+
bin/rspec
|
628
|
+
----
|
629
|
+
|
630
|
+
=== Formula storage
|
631
|
+
|
632
|
+
All official Fontist formulas are kept in the
|
633
|
+
https://github.com/fontist/formulas[formulas] repository.
|
634
|
+
|
635
|
+
If you'd like to add a new formula repository or change settings for an existing
|
636
|
+
one, please refer to its documentation.
|
637
|
+
|
638
|
+
=== Private Fontist formulas and font repositories
|
639
|
+
|
640
|
+
There is an ability to use private fonts via private Fontist repositories.
|
641
|
+
|
642
|
+
A Fontist repository is a Git repo which contains YAML formula files. Formulas can be created
|
643
|
+
manually (see https://github.com/fontist/formulas/tree/master/Formulas)[examples],
|
644
|
+
or #auto-generate-a-formula[auto-generated from an archive].
|
645
|
+
|
646
|
+
A repository can be either a HTTPS or SSH Git repo. In case of SSH, a
|
647
|
+
corresponding SSH key should be setup with `ssh-agent` in order to access this
|
648
|
+
private repository.
|
649
|
+
|
650
|
+
The `fontist repo setup` command fetches a repository's formulas, and saves the
|
651
|
+
repository's name and URL for later use.
|
652
|
+
|
653
|
+
Internally, all repositories are stored at
|
654
|
+
`~/.fontist/formulas/Formulas/private`.
|
655
|
+
|
656
|
+
[source,sh]
|
657
|
+
----
|
658
|
+
fontist repo setup NAME URL
|
659
|
+
----
|
660
|
+
|
661
|
+
E.g.
|
662
|
+
|
663
|
+
[source,sh]
|
664
|
+
----
|
665
|
+
fontist repo setup acme https://example.com/acme/formulas.git
|
666
|
+
# or
|
667
|
+
fontist repo setup acme git@example.com:acme/formulas.git
|
668
|
+
----
|
669
|
+
|
670
|
+
Then you can just install fonts from this repo:
|
671
|
+
|
672
|
+
[source,sh]
|
673
|
+
----
|
674
|
+
fontist install "private font"
|
675
|
+
----
|
676
|
+
|
677
|
+
If the private Fontist formula repository is updated, you can fetch the updates
|
678
|
+
with the `repo update` command:
|
679
|
+
|
680
|
+
[source,sh]
|
681
|
+
----
|
682
|
+
fontist repo update acme
|
683
|
+
----
|
684
|
+
|
685
|
+
If there is a need to avoid using private formulas, the repo can be removed
|
686
|
+
with:
|
687
|
+
|
688
|
+
[source,sh]
|
689
|
+
----
|
690
|
+
fontist repo remove acme
|
691
|
+
----
|
692
|
+
|
693
|
+
=== Private formulas
|
694
|
+
|
695
|
+
Authorization of private archives in private formulas can be implemented with
|
696
|
+
headers.
|
697
|
+
|
698
|
+
Here is an example which works with Github releases:
|
699
|
+
|
700
|
+
[source,yaml]
|
701
|
+
----
|
702
|
+
resources:
|
703
|
+
fonts.zip:
|
704
|
+
urls:
|
705
|
+
- url: https://example.com/repos/acme/formulas/releases/assets/38777461
|
706
|
+
headers:
|
707
|
+
Accept: application/octet-stream
|
708
|
+
Authorization: token ghp_1234567890abcdefghi
|
709
|
+
----
|
710
|
+
|
711
|
+
A token can be obtained on the
|
712
|
+
https://github.com/settings/tokens[GitHub Settings > Tokens page].
|
713
|
+
This token should have at least the `repo` scope for access to these assets.
|
714
|
+
|
715
|
+
=== Releasing
|
716
|
+
|
717
|
+
Releasing is done automatically with GitHub Actions. Just bump and tag with
|
718
|
+
`gem-release`.
|
719
|
+
|
720
|
+
For a patch release (0.0.x) use:
|
721
|
+
|
722
|
+
[source,sh]
|
723
|
+
----
|
724
|
+
gem bump --version patch --tag --push
|
725
|
+
----
|
726
|
+
|
727
|
+
For a minor release (0.x.0) use:
|
728
|
+
|
729
|
+
[source,sh]
|
730
|
+
----
|
731
|
+
gem bump --version minor --tag --push
|
732
|
+
----
|
733
|
+
|
734
|
+
== Contributing
|
735
|
+
|
736
|
+
First, thank you for contributing! We love pull requests from everyone. By
|
737
|
+
participating in this project, you hereby grant https://www.ribose.com[Ribose]
|
738
|
+
the right to grant or transfer an unlimited number of non exclusive licenses or
|
739
|
+
sub-licenses to third parties, under the copyright covering the contribution to
|
740
|
+
use the contribution by all means.
|
741
|
+
|
742
|
+
We are following Sandi Metz's Rules for this gem, you can read the
|
743
|
+
http://robots.thoughtbot.com/post/50655960596/sandi-metz-rules-for-developers[description of the rules here] All new code should follow these
|
744
|
+
rules. If you make changes in a pre-existing file that violates these rules you
|
745
|
+
should fix the violations as part of your contribution.
|
746
|
+
|
747
|
+
Here are a few technical guidelines to follow:
|
748
|
+
|
749
|
+
. Open an https://github.com/fontist/fontist/issues[issue] to discuss a new feature.
|
750
|
+
. Write tests to support your new feature.
|
751
|
+
. Make sure the entire test suite passes locally and on CI.
|
752
|
+
. Open a Pull Request.
|
753
|
+
. https://github.com/thoughtbot/guides/tree/master/protocol/git#write-a-feature[Squash your commits] after receiving feedback.
|
754
|
+
. Party!
|
755
|
+
|
756
|
+
== Credit
|
757
|
+
|
758
|
+
This gem is developed, maintained and funded by https://www.ribose.com[Ribose].
|
data/README.md
CHANGED
@@ -524,6 +524,18 @@ git commit -m "SIL fonts update"
|
|
524
524
|
git push
|
525
525
|
```
|
526
526
|
|
527
|
+
### Using with proxy
|
528
|
+
|
529
|
+
`fontist` can read proxy settings from environemnt variables:
|
530
|
+
|
531
|
+
* `HTTP_PROXY`
|
532
|
+
* `SOCKS_PROXY`
|
533
|
+
|
534
|
+
Also because `fontist` uses git under the hood, proxy must be configured in `~/.gitconfig` separately.
|
535
|
+
Check [nice guide](https://gist.github.com/evantoli/f8c23a37eb3558ab8765) about how it can be configured for more details
|
536
|
+
|
537
|
+
Also as for regular URL you can pass username and password, like `http://username:password@example.com/` for SOCKS it's similar
|
538
|
+
|
527
539
|
### Releasing
|
528
540
|
|
529
541
|
Releasing is done automatically with GitHub Action. Just bump and tag with `gem-release`.
|
data/exe/fontist
CHANGED
@@ -3,5 +3,27 @@
|
|
3
3
|
require "fontist"
|
4
4
|
require "fontist/cli"
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
fontist_cli = proc {
|
7
|
+
status_code = Fontist::CLI.start(ARGV)
|
8
|
+
exit status_code.is_a?(Integer) ? status_code : 1
|
9
|
+
}
|
10
|
+
|
11
|
+
if ENV["SOCKS_PROXY"]
|
12
|
+
require "socksify"
|
13
|
+
require "uri"
|
14
|
+
begin
|
15
|
+
proxy = URI.parse(ENV["SOCKS_PROXY"])
|
16
|
+
if proxy.userinfo
|
17
|
+
user, pass = proxy.userinfo.split(":")
|
18
|
+
TCPSocket::socks_username = user
|
19
|
+
TCPSocket::socks_password = pass
|
20
|
+
end
|
21
|
+
Socksify::proxy(proxy.host, proxy.port, &fontist_cli)
|
22
|
+
rescue URI::InvalidURIError
|
23
|
+
warn "Value of ENV.SOCKS_PROXY=#{ENV['SOCKS_PROXY']} is invalid! Droping it"
|
24
|
+
ENV.delete("SOCKS_PROXY")
|
25
|
+
fontist_cli.call
|
26
|
+
end
|
27
|
+
else
|
28
|
+
fontist_cli.call
|
29
|
+
end
|
data/fontist.gemspec
CHANGED
data/lib/fontist/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fontist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.10.
|
4
|
+
version: 1.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-07-
|
11
|
+
date: 2021-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: down
|
@@ -234,6 +234,20 @@ dependencies:
|
|
234
234
|
- - "~>"
|
235
235
|
- !ruby/object:Gem::Version
|
236
236
|
version: '1.0'
|
237
|
+
- !ruby/object:Gem::Dependency
|
238
|
+
name: socksify
|
239
|
+
requirement: !ruby/object:Gem::Requirement
|
240
|
+
requirements:
|
241
|
+
- - ">="
|
242
|
+
- !ruby/object:Gem::Version
|
243
|
+
version: '0'
|
244
|
+
type: :runtime
|
245
|
+
prerelease: false
|
246
|
+
version_requirements: !ruby/object:Gem::Requirement
|
247
|
+
requirements:
|
248
|
+
- - ">="
|
249
|
+
- !ruby/object:Gem::Version
|
250
|
+
version: '0'
|
237
251
|
description: Install openly-licensed fonts on Windows, Linux and Mac!
|
238
252
|
email:
|
239
253
|
- open.source@ribose.com
|
@@ -252,6 +266,7 @@ files:
|
|
252
266
|
- ".rubocop.yml"
|
253
267
|
- Gemfile
|
254
268
|
- LICENSE.txt
|
269
|
+
- README.adoc
|
255
270
|
- README.md
|
256
271
|
- Rakefile
|
257
272
|
- exe/fontist
|