fontist 1.10.0 → 1.11.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,28 +0,0 @@
1
- name: check_google
2
-
3
- on:
4
- schedule:
5
- - cron: '0 0 * * *'
6
-
7
- jobs:
8
- check:
9
- runs-on: ubuntu-latest
10
-
11
- steps:
12
- - uses: actions/checkout@v2
13
-
14
- - uses: actions/setup-ruby@v1
15
- with:
16
- ruby-version: 2.6
17
-
18
- - name: Install otfinfo
19
- run: sudo apt-get install lcdf-typetools
20
-
21
- - name: Install bundler
22
- run: gem install bundler
23
-
24
- - name: Setup
25
- run: bin/setup
26
-
27
- - name: Check new fonts
28
- run: TEST_ENV=CI bin/check_google
data/README.md DELETED
@@ -1,570 +0,0 @@
1
- # Fontist
2
-
3
- [![Build Status](https://github.com/fontist/fontist/actions/workflows/rspec.yml/badge.svg)](https://github.com/fontist/fontist/actions/workflows/rspec.yml)
4
- [![Gem Version](https://img.shields.io/gem/v/fontist.svg)](https://rubygems.org/gems/fontist)
5
- [![Pull Requests](https://img.shields.io/github/issues-pr-raw/fontist/fontist.svg)](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
- Add this line to your application's Gemfile:
12
-
13
- ```ruby
14
- gem "fontist"
15
- ```
16
-
17
- And then execute:
18
-
19
- ```sh
20
- bundle install
21
- ```
22
-
23
- Or install it yourself as:
24
-
25
- ```sh
26
- gem install fontist
27
- ```
28
-
29
- ### Fetch formulas
30
-
31
- After installation please fetch formulas to your system:
32
-
33
- ```sh
34
- fontist update
35
- ```
36
-
37
- ### Dependencies
38
-
39
- Depends on
40
- [ffi-libarchive-binary](https://github.com/fontist/ffi-libarchive-binary) which
41
- has the following requirements:
42
-
43
- * zlib
44
- * Expat
45
- * OpenSSL (for Linux only)
46
-
47
- These dependencies are generally present on all systems.
48
-
49
- ## Usage
50
-
51
- ### Font
52
-
53
- The `Fontist::Font` is your go to place to deal with any font using fontist. This
54
- interface will allow you to find a font or install a font. Lets start with how
55
- can we find a font in your system.
56
-
57
- #### Finding a font
58
-
59
- The `Fontist::Font.find` interface can be used a find a font in your system.
60
- It will look into the operating system specific font directories, and also the
61
- fontist specific `~/.fontist` directory.
62
-
63
- ```ruby
64
- Fontist::Font.find(name)
65
- ```
66
-
67
- If fontist find a font then it will return the paths, but if not found then it
68
- will could raise an unsupported font error or maybe an installation instruction
69
- for that specific font.
70
-
71
- #### Install a font
72
-
73
- The `Fontist::Font.install` interface can be used to install any supported font.
74
- This interface first checks if you already have that font installed or not and
75
- if you do then it will return the paths.
76
-
77
- If you don't but supported by fontist, then it will download the font and copy
78
- it to `~/.fontist` directory and also return the paths.
79
-
80
- ```ruby
81
- Fontist::Font.install(name, confirmation: "no")
82
- ```
83
-
84
- If there are some issue with the provided font, like not supported or some other
85
- issue then it will raise those errors.
86
-
87
- #### List all fonts
88
-
89
- The `Fontist::Font` interface exposes an interface to list all supported fonts,
90
- this might be useful if want to know the name of the font or the available
91
- styles. You can do that by using:
92
-
93
- ```ruby
94
- Fontist::Font.all
95
- ```
96
-
97
- The return values are ` OpenStruct` object, so you can easily do any other
98
- operation you would do in any ruby object.
99
-
100
- ### Formula
101
-
102
- The `fontist` gem internally usages the `Fontist::Formula` interface to find a
103
- registered formula or fonts supported by any formula. Unless, you need to do
104
- anything with that you shouldn't need to work with this interface directly. But
105
- if you do then these are the public interface it offers.
106
-
107
- #### Find a formula
108
-
109
- The `Fontist::Formula.find` interface allows you to find any of the registered
110
- formula. This interface takes a font name as an argument and it looks through
111
- each of the registered formula that offers this font installation. Usages:
112
-
113
- ```ruby
114
- Fontist::Formula.find("Calibri")
115
- ```
116
-
117
- The above method will find which formula offers this font and then it will
118
- return a installable formula that can be used to check licences or install that
119
- fonts in your system.
120
-
121
- #### Find formula fonts
122
-
123
- Normally, each font name can be associated with multiple styles or collection, for
124
- example the `Calibri` font might contains a `regular`, `bold` or `italic` styles
125
- fonts and if you want a interface that can return the complete list then this is
126
- your friend. You can use it as following:
127
-
128
- ```ruby
129
- Fontist::Formula.find_fonts("Calibri")
130
- ```
131
-
132
-
133
- #### List all formulas
134
-
135
- The `Fontist::Formula` interface exposes an interface to list all registered
136
- font formula. This might be useful if want to know the name of the formula or
137
- what type fonts can be installed using that formula. Usages:
138
-
139
- ```ruby
140
- Fontist::Formula.all
141
- ```
142
-
143
- The return values are ` OpenStruct` object, so you can easily do any other
144
- operation you would do in any ruby object.
145
-
146
-
147
- ### Manifest
148
-
149
- #### Locations
150
-
151
- Fontist lets find font locations from a manifest of the following format:
152
-
153
- ```ruby
154
- {"Segoe UI"=>["Regular", "Bold"],
155
- "Roboto Mono"=>["Regular"]}
156
- ```
157
-
158
- Calling the following code returns a nested hash with font paths and names.
159
- Font name is useful to choose a specific font in a font collection file (TTC).
160
-
161
- ```ruby
162
- Fontist::Manifest::Locations.from_hash(manifest)
163
- ```
164
-
165
- ```ruby
166
- {"Segoe UI"=> {
167
- "Regular"=>{"full_name"=>"Segoe UI",
168
- "paths"=>["/Users/user/.fontist/fonts/SEGOEUI.TTF"]},
169
- "Bold"=>{"full_name"=>"Segoe UI Bold",
170
- "paths"=>["/Users/user/.fontist/fonts/SEGOEUIB.TTF"]}},
171
- "Roboto Mono"=> {
172
- "Regular"=>{"full_name"=>nil,
173
- "paths"=>[]}}}
174
- ```
175
-
176
- #### Install
177
-
178
- Fontist lets not only to get font locations but also to install fonts from the
179
- manifest:
180
-
181
- ```ruby
182
- Fontist::Manifest::Install.from_hash(manifest, confirmation: "yes")
183
- ```
184
-
185
- It will install fonts and return their locations:
186
-
187
- ```ruby
188
- {"Segoe UI"=> {
189
- "Regular"=>{"full_name"=>"Segoe UI",
190
- "paths"=>["/Users/user/.fontist/fonts/SEGOEUI.TTF"]},
191
- "Bold"=>{"full_name"=>"Segoe UI Bold",
192
- "paths"=>["/Users/user/.fontist/fonts/SEGOEUIB.TTF"]}},
193
- "Roboto Mono"=> {
194
- "Regular"=>{"full_name"=>"Roboto Mono Regular",
195
- "paths"=>["/Users/user/.fontist/fonts/RobotoMono-VariableFont_wght.ttf"]}}}
196
- ```
197
-
198
- #### Support of YAML format
199
-
200
- Both commands support a YAML file as an input with a `from_file` method. For
201
- example, if there is a `manifest.yml` file containing:
202
-
203
- ```yaml
204
- Segoe UI:
205
- - Regular
206
- - Bold
207
- Roboto Mono:
208
- - Regular
209
- ```
210
-
211
- Then the following calls would return font names and paths, as from the
212
- `from_hash` method (see [Locations](#locations) and [Install](#install)).
213
-
214
- ```ruby
215
- Fontist::Manifest::Locations.from_file("manifest.yml")
216
- Fontist::Manifest::Install.from_file("manifest.yml", confirmation: "yes")
217
- ```
218
-
219
- ### CLI
220
-
221
- These commands makes possible to operate with fonts via command line. The CLI
222
- properly supports exit status, so in a case of error it returns a status code
223
- higher or equal than 1.
224
-
225
- All searches are case-insensitive for ease of use.
226
-
227
- #### Install
228
-
229
- The `install` command is similar to the `Font.install` call. It first checks
230
- whether this font is already installed, and if not, then installs the font and
231
- returns its paths. Only font name (not formula name, nor font filename) could
232
- be used as a parameter.
233
-
234
- ```
235
- $ fontist install "segoe ui"
236
- These fonts are found or installed:
237
- /Users/user/.fontist/fonts/SEGOEUI.TTF
238
- /Users/user/.fontist/fonts/SEGOEUIB.TTF
239
- /Users/user/.fontist/fonts/SEGOEUII.TTF
240
- /Users/user/.fontist/fonts/SEGOEUIZ.TTF
241
- ```
242
-
243
- #### Uninstall
244
-
245
- Uninstalls any font supported by Fontist. Returns paths of an uninstalled font,
246
- or prints an error telling that the font isn't installed or could not be found
247
- in Fontist formulas. Aliased as `remove`.
248
-
249
- ```
250
- $ fontist uninstall "segoe ui"
251
- These fonts are removed:
252
- /Users/user/.fontist/fonts/SEGOEUII.TTF
253
- /Users/user/.fontist/fonts/SEGOEUIZ.TTF
254
- /Users/user/.fontist/fonts/SEGOEUIB.TTF
255
- /Users/user/.fontist/fonts/SEGOEUI.TTF
256
- ```
257
-
258
- #### Status
259
-
260
- Prints installed font paths grouped by formula and font.
261
-
262
- ```
263
- $ fontist status "segoe ui"
264
- segoe_ui
265
- Segoe UI
266
- Regular (/Users/user/.fontist/fonts/SEGOEUI.TTF)
267
- Bold (/Users/user/.fontist/fonts/SEGOEUIB.TTF)
268
- Italic (/Users/user/.fontist/fonts/SEGOEUII.TTF)
269
- Bold Italic (/Users/user/.fontist/fonts/SEGOEUIZ.TTF)
270
- ```
271
-
272
- #### List
273
-
274
- Lists installation status of fonts supported by Fontist.
275
-
276
- ```
277
- $ fontist list "segoe ui"
278
- segoe_ui
279
- Segoe UI
280
- Regular (installed)
281
- Bold (installed)
282
- Italic (installed)
283
- Bold Italic (installed)
284
- ```
285
-
286
- ```
287
- $ fontist list "roboto mono"
288
- google/roboto_mono
289
- Roboto Mono
290
- Regular (uninstalled)
291
- Italic (uninstalled)
292
- ```
293
-
294
- #### Locations from manifest
295
-
296
- Returns locations of fonts specified in a YAML file as an input.
297
-
298
- For example, if there is a file `manifest.yml`:
299
-
300
- ```yml
301
- Segoe UI:
302
- - Regular
303
- - Bold
304
- Roboto Mono:
305
- - Regular
306
- ```
307
-
308
- Then the command will return the following YAML output:
309
-
310
- ```yml
311
- $ fontist manifest-locations manifest.yml
312
- ---
313
- Segoe UI:
314
- Regular:
315
- full_name: Segoe UI
316
- paths:
317
- - "/Users/user/.fontist/fonts/SEGOEUI.TTF"
318
- Bold:
319
- full_name: Segoe UI Bold
320
- paths:
321
- - "/Users/user/.fontist/fonts/SEGOEUIB.TTF"
322
- Roboto Mono:
323
- Regular:
324
- full_name:
325
- paths: []
326
- ```
327
-
328
- Since Segoe UI is installed, but Roboto Mono is not.
329
-
330
- #### Install from manifest
331
-
332
- Install fonts from a YAML manifest:
333
-
334
- ```yml
335
- $ fontist manifest-install --confirm-license manifest.yml
336
- ---
337
- Segoe UI:
338
- Regular:
339
- full_name: Segoe UI
340
- paths:
341
- - "/Users/user/.fontist/fonts/SEGOEUI.TTF"
342
- Bold:
343
- full_name: Segoe UI Bold
344
- paths:
345
- - "/Users/user/.fontist/fonts/SEGOEUIB.TTF"
346
- Roboto Mono:
347
- Regular:
348
- full_name: Roboto Mono Regular
349
- paths:
350
- - "/Users/user/.fontist/fonts/RobotoMono-VariableFont_wght.ttf"
351
- ```
352
-
353
- #### Help
354
-
355
- List of all commands could be seen by:
356
-
357
- ```
358
- fontist help
359
- ```
360
-
361
- ### Configuration
362
-
363
- By default Fontist uses the `~/.fontist` directory to store fonts and its
364
- files. It could be changed with the `FONTIST_PATH` environment variable.
365
-
366
- ```sh
367
- FONTIST_PATH=~/.fontist_new fontist update
368
- ```
369
-
370
- ## Development
371
-
372
- We are following Sandi Metz's Rules for this gem, you can read the
373
- [description of the rules here][sandi-metz] All new code should follow these
374
- rules. If you make changes in a pre-existing file that violates these rules you
375
- should fix the violations as part of your contribution.
376
-
377
- ### Setup
378
-
379
- Clone the repository.
380
-
381
- ```sh
382
- git clone https://github.com/fontist/fontist
383
- ```
384
-
385
- Setup your environment.
386
-
387
- ```sh
388
- bin/setup
389
- ```
390
-
391
- Run the test suite
392
-
393
- ```sh
394
- bin/rspec
395
- ```
396
-
397
- ### Formulas storage
398
-
399
- All formulas are kept in the [formulas][fontist-formulas] repository. If you'd
400
- like to add a new one or change any existing, please refer to its documentation.
401
-
402
- ### Private repos
403
-
404
- There is an ability to use private fonts via private fontist repo. Fontist repo
405
- is a git repo which contains YAML formula files. Formulas can be created
406
- manually (see [examples](https://github.com/fontist/formulas/tree/master/Formulas)),
407
- or [auto-generated from an archive](#auto-generate-a-formula).
408
-
409
- A repo can be either HTTPS or SSH Git repo. In case of SSH, a corresponding SSH key
410
- should be setup with ssh-agent in order to access this private repo.
411
-
412
- The `repo setup` command fetches a repo's formulas, and saves repo's name and url
413
- for later use.
414
-
415
- Internally all repos are stored at `~/.fontist/formulas/Formulas/private`.
416
-
417
- ```sh
418
- fontist repo setup NAME URL
419
- ```
420
-
421
- E.g.
422
-
423
- ```sh
424
- fontist repo setup acme https://example.com/acme/formulas.git
425
- # or
426
- fontist repo setup acme git@example.com:acme/formulas.git
427
- ```
428
-
429
- Then you can just install fonts from this repo:
430
-
431
- ```sh
432
- fontist install "private font"
433
- ```
434
-
435
- There is no need in any additional command to be run, but if you add new
436
- formulas to your repo, you can fetch them with the `repo update` command:
437
-
438
- ```sh
439
- fontist repo update acme
440
- ```
441
-
442
- If there is a need to avoid using private formulas, the repo can be removed with:
443
-
444
- ```sh
445
- fontist repo remove acme
446
- ```
447
-
448
- ### Private formulas
449
-
450
- Authorization of private archives in private formulas can be implemented with
451
- headers. Here is an example which works with Github releases:
452
-
453
- ```yaml
454
- resources:
455
- fonts.zip:
456
- urls:
457
- - url: https://example.com/repos/acme/formulas/releases/assets/38777461
458
- headers:
459
- Accept: application/octet-stream
460
- Authorization: token ghp_1234567890abcdefghi
461
- ```
462
-
463
- A token can be obtained on [this page](https://github.com/settings/tokens).
464
- It should have at least the `repo` scope.
465
-
466
- ### Auto-generate a formula
467
-
468
- A formula could be generated from a fonts archive. Just specify a URL to the
469
- archive:
470
-
471
- ```sh
472
- fontist create-formula https://www.latofonts.com/download/lato2ofl-zip/
473
- cp lato.yml ~/.fontist/formulas/Formulas/
474
- ```
475
-
476
- Though indexes are auto-generated now, maintainers should rebuild indexes
477
- in the main repo for backward compatibility with fontist prior to 1.9.x versions.
478
- A formula index should be rebuild, when a new formula is generated or an
479
- existing one changed:
480
-
481
- ```sh
482
- fontist rebuild-index --main-repo
483
- ```
484
-
485
- Then, both the formula and the updated indexes should be commited and pushed to
486
- the formula repository:
487
-
488
- ```sh
489
- cd ~/.fontist/formulas
490
- git add Formulas/lato.yml index.yml filename_index.yml
491
- git commit -m "Add Lato formula"
492
- ```
493
-
494
- ### Google Import
495
-
496
- The library contains formulas for [Google Foonts][google-fonts]. A GHA workflow
497
- checks for fonts update every day. In case an update is found, it could be
498
- fetched to the library by:
499
-
500
- ```
501
- bin/import_google
502
- ```
503
-
504
- The script would update formulas which should be committed to a separate
505
- repository [formulas][fontist-formulas]:
506
-
507
- ```
508
- cd ~/.fontist/formulas
509
- git add Formulas/google index.yml filename_index.yml
510
- git commit -m "Google Fonts update"
511
- git push
512
- ```
513
-
514
- ### Import of SIL fonts
515
-
516
- Fontist contains formulas of [SIL fonts](https://software.sil.org/fonts/). They
517
- can be updated with:
518
-
519
- ```sh
520
- fontist import-sil
521
- cd ~/.fontist/formulas
522
- git add Formulas/sil index.yml filename_index.yml
523
- git commit -m "SIL fonts update"
524
- git push
525
- ```
526
-
527
- ### Releasing
528
-
529
- Releasing is done automatically with GitHub Action. Just bump and tag with `gem-release`.
530
-
531
- For a patch release (0.0.x) use:
532
-
533
- ```sh
534
- gem bump --version patch --tag --push
535
- ```
536
-
537
- For a minor release (0.x.0) use:
538
-
539
- ```sh
540
- gem bump --version minor --tag --push
541
- ```
542
-
543
- ## Contributing
544
-
545
- First, thank you for contributing! We love pull requests from everyone. By
546
- participating in this project, you hereby grant [Ribose Inc.][riboseinc] the
547
- right to grant or transfer an unlimited number of non exclusive licenses or
548
- sub-licenses to third parties, under the copyright covering the contribution
549
- to use the contribution by all means.
550
-
551
- Here are a few technical guidelines to follow:
552
-
553
- 1. Open an [issue][issues] to discuss a new feature.
554
- 1. Write tests to support your new feature.
555
- 1. Make sure the entire test suite passes locally and on CI.
556
- 1. Open a Pull Request.
557
- 1. [Squash your commits][squash] after receiving feedback.
558
- 1. Party!
559
-
560
-
561
- ## Credit
562
-
563
- This gem is developed, maintained and funded by [Ribose Inc.][riboseinc]
564
-
565
- [riboseinc]: https://www.ribose.com
566
- [issues]: https://github.com/fontist/fontist/issues
567
- [squash]: https://github.com/thoughtbot/guides/tree/master/protocol/git#write-a-feature
568
- [sandi-metz]: http://robots.thoughtbot.com/post/50655960596/sandi-metz-rules-for-developers
569
- [fontist-formulas]: https://github.com/fontist/formulas
570
- [google-fonts]: https://fonts.google.com