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