fontist 1.13.0 → 1.14.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 43f3bc7643cf7694fb753d9c62509f7134a26d68fb41a2e06c9c9e25f33ae2c5
4
- data.tar.gz: 3269f7aedc78eed761697ff862701bf6ca27679e9be90972d8983e913a15beea
3
+ metadata.gz: 2c0b58f3af1125a6a560179502a5ce5845e76b4d4db1c466e5f63f9628203089
4
+ data.tar.gz: 2176708c4c71239768f8714cf21d393aae208b8a7757402b08ad369ec155ed25
5
5
  SHA512:
6
- metadata.gz: a92d2d69bed9e8e33fc9785f198c9878d1a02dda4de65f290ecff30336adec6117cfd18cc09d52545f318a917b40e02b4d796049384b6b6c12fee05d2056283f
7
- data.tar.gz: ffdb9a02c723a5a8c04c26c3f3d5a0d0bba4e875fd750bee67a3c68698d2f2e9057ff936019523d3eb9a359bbbf19de566c45acb99fff99b745952039add7e30
6
+ metadata.gz: c3875e506d599cfab2e7447e7a9f24518080a02f8bce0018f386b06c13a5048a78ce2e8fa61a4109e60e7445bb10164e84d45d33bcc109b4087ca3a2eeedac49
7
+ data.tar.gz: 61747670abc9194cba651cb01d5a69d46bbdc84ed99f9de50e0057606a24f2b2efb2b2df782d6cf9b3b99d1c678e33f20d665157655de460e9227075b3a28a0b
@@ -13,7 +13,7 @@ jobs:
13
13
  strategy:
14
14
  fail-fast: false
15
15
  matrix:
16
- ruby: [ '2.5', '2.6', '2.7', '3.0' ]
16
+ ruby: [ '2.6', '2.7', '3.0' ]
17
17
  os: [ ubuntu-latest, windows-latest, macos-latest ]
18
18
  experimental: [ true ]
19
19
  steps:
@@ -32,4 +32,6 @@ jobs:
32
32
  ruby-version: ${{ matrix.ruby }}
33
33
  bundler-cache: true
34
34
 
35
+ - uses: metanorma/metanorma-build-scripts/inkscape-setup-action@main
36
+
35
37
  - run: bundle exec rake
data/README.adoc CHANGED
@@ -51,71 +51,70 @@ has the following requirements:
51
51
 
52
52
  These dependencies are generally present on all systems.
53
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
54
 
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.
55
+ == Usage of the Fontist command-line interface
80
56
 
81
-
82
- == Usage of the `fontist` command
83
-
84
- === Fontist command-line interface
57
+ === The `fontist` command
85
58
 
86
59
  These commands makes possible to operate with fonts via command line.
87
60
 
88
61
  The CLI properly supports exit status, so in a case of error it returns a status
89
- code higher or equal than 1.
62
+ code higher or equal than `1`.
90
63
 
91
- All searches are case-insensitive for ease of use.
64
+ Searches are case-insensitive for ease of use.
92
65
 
93
- === Global options
66
+ All commands support the following global options:
94
67
 
95
- All commands support the following options:
68
+ `--preferred-family`:: Search using the "`preferred family`" name of a font.
69
+ (instead of the "`default family`" name, the default prior to Fontist v1.10.)
96
70
 
97
- * `--preferred-family` Use the preferred family names when searching for fonts. This format was used prior to v1.10.
71
+ NOTE: See <<preferred-family-change>> for the differences between
72
+ "`preferred family`" and "`default family`".
98
73
 
99
- === Install fonts
74
+
75
+ === Install fonts: `fontist install`
100
76
 
101
77
  Fontist checks whether this font is already installed, and if not, then installs
102
78
  the font and returns its installed paths.
103
79
 
104
- The font name is the only argument to be supplied (the font family name).
80
+ The font name is the only argument to be supplied.
105
81
 
106
82
  [source,sh]
107
83
  ----
108
84
  $ fontist install "segoe ui"
109
85
  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
86
+ - /Users/user/.fontist/fonts/SEGOEUI.TTF
87
+ - /Users/user/.fontist/fonts/SEGOEUIB.TTF
88
+ - /Users/user/.fontist/fonts/SEGOEUII.TTF
89
+ - /Users/user/.fontist/fonts/SEGOEUIZ.TTF
114
90
  ----
115
91
 
116
- NOTE: Specifying the formula's name or the font's filename is not supported.
92
+ By default, all matching styles (according to the font's "`default family`" name)
93
+ are installed.
117
94
 
118
- NOTE: The `install` command is similar to the `Font.install` library call.
95
+ NOTE: Prior to v1.10, the font's "`preferred family`" name is used to match
96
+ styles for search. See <<preferred-family-change>> for details of that change.
97
+
98
+ To install all fonts specified in a Fontist formula, use the `-F, --formula`
99
+ option.
100
+
101
+ [source,sh]
102
+ ----
103
+ $ fontist install --formula 'courier_prime'
104
+ Downloading font ...
105
+ Installing font "courier_prime".
106
+ Fonts installed at:
107
+ - /Users/user/.fontist/fonts/Courier Prime Bold Italic.ttf
108
+ - /Users/user/.fontist/fonts/Courier Prime Bold.ttf
109
+ - /Users/user/.fontist/fonts/Courier Prime Italic.ttf
110
+ - /Users/user/.fontist/fonts/Courier Prime.ttf
111
+ ----
112
+
113
+ Here, `courier_prime` is the filename of the formula located at the public
114
+ Fontist Formula repository
115
+ (https://github.com/fontist/formulas/blob/v3/Formulas/courier_prime.yml[`courier_prime.yml`]).
116
+
117
+ NOTE: Specifying the formula's name or the font's filename is not supported.
119
118
 
120
119
  If there are several formulas with a requested font, then `fontist` searches
121
120
  for the newest version of the font among formulas with size below a limit
@@ -126,17 +125,23 @@ available formulas would be installed.
126
125
 
127
126
  Supported options:
128
127
 
129
- -f, [--force]:: Install even if it's already installed in system
130
- -a, [--accept-all-licenses]:: Accept all license agreements
131
- -h, [--hide-licenses]:: Hide license texts
132
- -p, [--no-progress]:: Hide download progress
133
- -V, [--version=VERSION]:: Install particular version of a font
134
- -s, [--smallest]:: Install the smallest formula
135
- -n, [--newest]:: Install the newest version of a font
136
- -S, [--size-limit=N]:: Specify size limit for a formula to be installed
128
+ `-f, [--force]`:: Install even if already installed in system
129
+ `-F, [--formula]`:: Install whole formula instead of a font
130
+ `-a, [--accept-all-licenses]`:: Accept all license agreements
131
+ `-h, [--hide-licenses]`:: Hide license texts
132
+ `-p, [--no-progress]`:: Hide download progress
133
+ `-V, [--version=VERSION]`:: Install particular version of a font
134
+ `-s, [--smallest]`:: Install the smallest font by file size if several
135
+ `-n, [--newest]`:: Install the newest version of a font if several
136
+ `-S, [--size-limit=N]`:: Specify upper limit for file size of a formula to be installed
137
137
  (default is 300 MB)
138
+ `-u, [--update-fontconfig]`:: Update Fontconfig
138
139
 
139
- === Uninstall fonts
140
+
141
+ NOTE: The `install` command is similar to the `Font.install` library call.
142
+
143
+
144
+ === Uninstall fonts: `fontist uninstall`
140
145
 
141
146
  Uninstalls any font supported by Fontist.
142
147
 
@@ -153,7 +158,7 @@ These fonts are removed:
153
158
  /Users/user/.fontist/fonts/SEGOEUI.TTF
154
159
  ----
155
160
 
156
- === Status
161
+ === Status: `fontist status`
157
162
 
158
163
  Prints installed font paths grouped by formula and font.
159
164
 
@@ -168,7 +173,7 @@ segoe_ui
168
173
  Bold Italic (/Users/user/.fontist/fonts/SEGOEUIZ.TTF)
169
174
  ----
170
175
 
171
- === List
176
+ === List: `fontist list`
172
177
 
173
178
  Lists installation status of fonts supported by Fontist.
174
179
 
@@ -192,7 +197,7 @@ google/roboto_mono
192
197
  Italic (uninstalled)
193
198
  ----
194
199
 
195
- === List installed font paths
200
+ === List installed font paths: `fontist manifest-locations`
196
201
 
197
202
  Returns locations of fonts specified in a YAML file as an input.
198
203
 
@@ -243,7 +248,7 @@ Roboto Mono:
243
248
 
244
249
  Since "`Segoe UI`" is installed, but "`Roboto Mono`" is not.
245
250
 
246
- === Install fonts from manifest
251
+ === Install fonts from manifest: `fontist manifest-install`
247
252
 
248
253
  Install fonts from a YAML Fontist manifest:
249
254
 
@@ -273,7 +278,31 @@ Roboto Mono:
273
278
  - "/Users/user/.fontist/fonts/RobotoMono-VariableFont_wght.ttf"
274
279
  ----
275
280
 
276
- === Help
281
+ === Work with Fontconfig: `fontist fontconfig`
282
+
283
+ Fontconfig is a software designed to provide fonts to other programs. It is
284
+ typically used on Linux, but also available on macOS and Windows. Fontconfig is
285
+ used by LibreOffice, GIMP, and many other programs.
286
+
287
+ It order to find fontist fonts, Fontconfig should be updated to include fontist
288
+ paths. It can be done with the `--update-fontconfig` option of the `install`
289
+ command, or by calling a special one:
290
+
291
+ [source,sh]
292
+ ----
293
+ $ fontist fontconfig update
294
+ ----
295
+
296
+ It would create a config in `~/.config/fontconfig/conf.d/10-fontist.conf`.
297
+
298
+ To remove it, please use:
299
+
300
+ [source,sh]
301
+ ----
302
+ $ fontist fontconfig remove
303
+ ----
304
+
305
+ === Help: `fontist help`
277
306
 
278
307
  List of all commands could be seen by:
279
308
 
@@ -371,7 +400,7 @@ Fontist::Formula.find("Calibri")
371
400
  ----
372
401
 
373
402
  This method will search and return a Fontist formula for the provided keyword
374
- which allows for further processing, such as licence checks or proceeding with
403
+ which allows for further processing, such as license checks or proceeding with
375
404
  installation of the font in your system.
376
405
 
377
406
  ==== List font styles supported by a formula
@@ -516,7 +545,36 @@ Fontist::Manifest::Locations.from_file("manifest.yml")
516
545
  Fontist::Manifest::Install.from_file("manifest.yml", confirmation: "yes")
517
546
  ----
518
547
 
519
- == Using Fontist with proxies
548
+ === `Fontist::Fontconfig`
549
+
550
+ Fontist supports work with Fontconfig via the Ruby interface:
551
+
552
+ [source,ruby]
553
+ ----
554
+ Fontist::Fontconfig.update # let detect fontist fonts
555
+ Fontist::Fontconfig.remove # disable detection
556
+ Fontist::Fontconfig.remove(force: true) # do not fail if no config exists
557
+ ----
558
+
559
+ === Installing macOS-specific add-on fonts
560
+
561
+ The purpose of Fontist allowing macOS-specific add-on fonts is to allow CI jobs
562
+ on macOS environments to use these specially licensed fonts that are not
563
+ available on other platforms.
564
+
565
+ The "Canela" font is a commercial font that comes free with macOS.
566
+
567
+ Run this command to install Canela on macOS.
568
+
569
+ [source,sh]
570
+ ----
571
+ $ fontist install Canela
572
+ ----
573
+
574
+ WARNING: Fontist does not allow installing macOS-specific fonts on non-macOS
575
+ platforms due to font licensing of those fonts.
576
+
577
+ == Using Fontist with proxy servers
520
578
 
521
579
  Fontist uses Git internally for fetching formulas and fonts.
522
580
 
@@ -575,7 +633,64 @@ https://github.com/evantoli[evantoli]).
575
633
 
576
634
  == Authoring Fontist formulas
577
635
 
578
- === Creating a Fontist formula from a font archive
636
+ === Private Fontist formulas and font repositories
637
+
638
+ Fontist supports installing private fonts via private Fontist repositories.
639
+
640
+ A Fontist repository is a Git repo which contains YAML Formula files.
641
+ Formulas can be created manually
642
+ (see https://github.com/fontist/formulas/tree/master/Formulas[examples]),
643
+ or <<create-formula,auto-generated from an archive>>.
644
+
645
+ A repository can be either a HTTPS or SSH Git repo. In case of SSH, a
646
+ corresponding SSH key should be setup with `ssh-agent` in order to access this
647
+ private repository.
648
+
649
+ The `fontist repo setup` command fetches a repository's formulas, and saves the
650
+ repository's name and URL for later use.
651
+
652
+ Internally, all repositories are stored at
653
+ `~/.fontist/formulas/Formulas/private`.
654
+
655
+ [source,sh]
656
+ ----
657
+ fontist repo setup NAME URL
658
+ ----
659
+
660
+ E.g.
661
+
662
+ [source,sh]
663
+ ----
664
+ fontist repo setup acme https://example.com/acme/formulas.git
665
+ # or
666
+ fontist repo setup acme git@example.com:acme/formulas.git
667
+ ----
668
+
669
+ Then you can just install fonts from this repo:
670
+
671
+ [source,sh]
672
+ ----
673
+ fontist install "private font"
674
+ ----
675
+
676
+ If the private Fontist formula repository is updated, you can fetch the updates
677
+ with the `repo update` command:
678
+
679
+ [source,sh]
680
+ ----
681
+ fontist repo update acme
682
+ ----
683
+
684
+ If there is a need to avoid using private formulas, the repo can be removed
685
+ with:
686
+
687
+ [source,sh]
688
+ ----
689
+ fontist repo remove acme
690
+ ----
691
+
692
+ [[create-formula]]
693
+ === Auto-generate a Fontist formula from a font archive
579
694
 
580
695
  A formula could be generated from a fonts archive. Just specify a URL to the
581
696
  archive:
@@ -587,7 +702,7 @@ cp lato.yml ~/.fontist/formulas/Formulas/
587
702
  ----
588
703
 
589
704
  Though indexes are auto-generated now, maintainers should rebuild indexes in the
590
- main repo for backward compatibility with Fontist versinos prior to 1.9.x.
705
+ main repo for backward compatibility with Fontist versions prior to v1.9.x.
591
706
 
592
707
  A formula index should be rebuilt when a new formula is generated or an existing
593
708
  one changed:
@@ -607,6 +722,56 @@ git add Formulas/lato.yml index.yml filename_index.yml
607
722
  git commit -m "Add Lato formula"
608
723
  ----
609
724
 
725
+ === Authentication for private formulas or private formula repositories
726
+
727
+ Authorization of private archives in private formulas can be implemented with
728
+ headers.
729
+
730
+ Here is an example which works with Github releases:
731
+
732
+ [source,yaml]
733
+ ----
734
+ resources:
735
+ fonts.zip:
736
+ urls:
737
+ - url: https://example.com/repos/acme/formulas/releases/assets/38777461
738
+ headers:
739
+ Accept: application/octet-stream
740
+ Authorization: token ghp_1234567890abcdefghi
741
+ ----
742
+
743
+ A token can be obtained on the
744
+ https://github.com/settings/tokens[GitHub Settings > Tokens page].
745
+ This token should have at least the `repo` scope for access to these assets.
746
+
747
+
748
+ === Upgrading Fontist
749
+
750
+ [[preferred-family-change]]
751
+ ==== To v1.10+
752
+
753
+ Fontist versions beyond v1.10 utilize a new formula format.
754
+ After the upgrade, please run `fontist update` to fetch the latest formulas.
755
+
756
+ Starting from v1.10, Fontist uses the "`default family`" instead of the
757
+ "`preferred family`" when grouping styles.
758
+
759
+ For example, a request for the "`Lato`" font prior to v1.10 will return all
760
+ styles: "`Black`", "`Black Italic`", "`Bold`", and 15 other styles.
761
+
762
+ From v1.10 onwards, Fontist will return _only_ the 4 default styles:
763
+ "`Regular`", "`Italic`", "`Bold`" and "`Bold Italic`".
764
+
765
+ In order to fetch other styles, you have to specify the exact font
766
+ "`subfamily`", such as "`Lato Black`", or "`Lato Heavy`", or use
767
+ the `--preferred-family` option with CLI and `Fontist.preferred_family = true`
768
+ with the Ruby library.
769
+
770
+ NOTE: Prior to v1.10 there was a bug with the "`Courier`" font formula, which
771
+ allowed the font to be installed when requesting the font name "`Courier`", but
772
+ its font location was only obtainable using the full "`Courier New`" font name.
773
+ From v1.10 onwards the behavior has been made consistent -- only the proper
774
+ "`Courier New`" name should be used.
610
775
 
611
776
 
612
777
 
@@ -629,7 +794,7 @@ In case an update is found, it could be fetched to the library by:
629
794
 
630
795
  [source,sh]
631
796
  ----
632
- bin/fontist google import
797
+ bin/fontist import google
633
798
  ----
634
799
 
635
800
  The script would update formulas which should be committed to a separate
@@ -658,7 +823,7 @@ They can be updated with:
658
823
 
659
824
  [source,sh]
660
825
  ----
661
- fontist import-sil
826
+ fontist import sil
662
827
  cd ~/.fontist/versions/{last_version}/formulas
663
828
  git add Formulas/sil
664
829
  git commit -m "SIL fonts update"
@@ -668,8 +833,8 @@ git push
668
833
  === Dynamically importing formulas from macOS
669
834
 
670
835
  macOS provides https://support.apple.com/en-om/HT211240#download[fonts] which
671
- can be manually downloaded with the Font Book app. When such font is requested,
672
- fontist prints information on how to install it.
836
+ can be manually downloaded with `Font Book.app`. When such font is requested,
837
+ Fontist prints information on how to install it.
673
838
 
674
839
  In order to know which fonts are available in a current version of macOS,
675
840
  for each version there is a formula containing all supported fonts.
@@ -686,7 +851,7 @@ git push
686
851
  ----
687
852
 
688
853
  Here `--fonts-link` is a link to a page containing a list of available fonts
689
- in the Font Book app.
854
+ in the `Font Book.app`.
690
855
 
691
856
  If the import is run on a different version of macOS, then a proper version
692
857
  should be set in the `platforms` attribute of the generated formula:
@@ -731,82 +896,6 @@ https://github.com/fontist/formulas[formulas] repository.
731
896
  If you'd like to add a new formula repository or change settings for an existing
732
897
  one, please refer to its documentation.
733
898
 
734
- === Private Fontist formulas and font repositories
735
-
736
- There is an ability to use private fonts via private Fontist repositories.
737
-
738
- A Fontist repository is a Git repo which contains YAML formula files. Formulas can be created
739
- manually (see https://github.com/fontist/formulas/tree/master/Formulas[examples]),
740
- or xref:Authoring Fontist formulas[auto-generated from an archive].
741
-
742
- A repository can be either a HTTPS or SSH Git repo. In case of SSH, a
743
- corresponding SSH key should be setup with `ssh-agent` in order to access this
744
- private repository.
745
-
746
- The `fontist repo setup` command fetches a repository's formulas, and saves the
747
- repository's name and URL for later use.
748
-
749
- Internally, all repositories are stored at
750
- `~/.fontist/formulas/Formulas/private`.
751
-
752
- [source,sh]
753
- ----
754
- fontist repo setup NAME URL
755
- ----
756
-
757
- E.g.
758
-
759
- [source,sh]
760
- ----
761
- fontist repo setup acme https://example.com/acme/formulas.git
762
- # or
763
- fontist repo setup acme git@example.com:acme/formulas.git
764
- ----
765
-
766
- Then you can just install fonts from this repo:
767
-
768
- [source,sh]
769
- ----
770
- fontist install "private font"
771
- ----
772
-
773
- If the private Fontist formula repository is updated, you can fetch the updates
774
- with the `repo update` command:
775
-
776
- [source,sh]
777
- ----
778
- fontist repo update acme
779
- ----
780
-
781
- If there is a need to avoid using private formulas, the repo can be removed
782
- with:
783
-
784
- [source,sh]
785
- ----
786
- fontist repo remove acme
787
- ----
788
-
789
- === Private formulas
790
-
791
- Authorization of private archives in private formulas can be implemented with
792
- headers.
793
-
794
- Here is an example which works with Github releases:
795
-
796
- [source,yaml]
797
- ----
798
- resources:
799
- fonts.zip:
800
- urls:
801
- - url: https://example.com/repos/acme/formulas/releases/assets/38777461
802
- headers:
803
- Accept: application/octet-stream
804
- Authorization: token ghp_1234567890abcdefghi
805
- ----
806
-
807
- A token can be obtained on the
808
- https://github.com/settings/tokens[GitHub Settings > Tokens page].
809
- This token should have at least the `repo` scope for access to these assets.
810
899
 
811
900
  === Releasing
812
901
 
@@ -0,0 +1,14 @@
1
+ module Fontist
2
+ class CLI < Thor
3
+ module ClassOptions
4
+ def handle_class_options(options)
5
+ Fontist.preferred_family = options[:preferred_family]
6
+ Fontist.log_level = options[:quiet] ? :fatal : :info
7
+
8
+ if options[:formulas_path]
9
+ Fontist.formulas_path = Pathname.new(options[:formulas_path])
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
data/lib/fontist/cli.rb CHANGED
@@ -1,10 +1,13 @@
1
1
  require "thor"
2
+ require "fontist/cli/class_options"
2
3
  require "fontist/repo_cli"
3
4
  require "fontist/import_cli"
4
- require "fontist/google_cli"
5
+ require "fontist/fontconfig_cli"
5
6
 
6
7
  module Fontist
7
8
  class CLI < Thor
9
+ include ClassOptions
10
+
8
11
  STATUS_SUCCESS = 0
9
12
  STATUS_UNKNOWN_ERROR = 1
10
13
  STATUS_NON_SUPPORTED_FONT_ERROR = 2
@@ -18,6 +21,9 @@ module Fontist
18
21
  STATUS_REPO_COULD_NOT_BE_UPDATED = 10
19
22
  STATUS_MANUAL_FONT_ERROR = 11
20
23
  STATUS_SIZE_LIMIT_ERROR = 12
24
+ STATUS_FORMULA_NOT_FOUND = 13
25
+ STATUS_FONTCONFIG_NOT_FOUND = 14
26
+ STATUS_FONTCONFIG_FILE_NOT_FOUND = 15
21
27
 
22
28
  ERROR_TO_STATUS = {
23
29
  Fontist::Errors::UnsupportedFontError => [STATUS_NON_SUPPORTED_FONT_ERROR],
@@ -39,6 +45,10 @@ module Fontist
39
45
  Fontist::Errors::FontIndexCorrupted => [STATUS_FONT_INDEX_CORRUPTED],
40
46
  Fontist::Errors::RepoNotFoundError => [STATUS_REPO_NOT_FOUND],
41
47
  Fontist::Errors::MainRepoNotFoundError => [STATUS_MAIN_REPO_NOT_FOUND],
48
+ Fontist::Errors::FormulaNotFoundError => [STATUS_FORMULA_NOT_FOUND],
49
+ Fontist::Errors::FontconfigNotFoundError => [STATUS_FONTCONFIG_NOT_FOUND],
50
+ Fontist::Errors::FontconfigFileNotFoundError =>
51
+ [STATUS_FONTCONFIG_FILE_NOT_FOUND],
42
52
  }.freeze
43
53
 
44
54
  def self.exit_on_failure?
@@ -49,9 +59,18 @@ module Fontist
49
59
  type: :boolean,
50
60
  desc: "Use Preferred Family when available"
51
61
 
62
+ class_option :quiet,
63
+ aliases: :q,
64
+ type: :boolean,
65
+ desc: "Hide all messages"
66
+
67
+ class_option :formulas_path, type: :string, desc: "Path to formulas"
68
+
52
69
  desc "install FONT", "Install font"
53
70
  option :force, type: :boolean, aliases: :f,
54
- desc: "Install even if it's already installed in system"
71
+ desc: "Install even if already installed in system"
72
+ option :formula, type: :boolean, aliases: :F,
73
+ desc: "Install whole formula instead of a font"
55
74
  option :accept_all_licenses, type: :boolean,
56
75
  aliases: ["--confirm-license", :a],
57
76
  desc: "Accept all license agreements"
@@ -62,13 +81,15 @@ module Fontist
62
81
  option :version, type: :string, aliases: :V,
63
82
  desc: "Specify particular version of a font"
64
83
  option :smallest, type: :boolean, aliases: :s,
65
- desc: "Install the smallest formula if several"
84
+ desc: "Install the smallest font by file size if several"
66
85
  option :newest, type: :boolean, aliases: :n,
67
86
  desc: "Install the newest version of a font if several"
68
87
  option :size_limit,
69
88
  type: :numeric, aliases: :S,
70
- desc: "Specify size limit for formula " \
89
+ desc: "Specify upper limit for file size of a formula to be installed" \
71
90
  "(default is #{Fontist.formula_size_limit_in_megabytes} MB)"
91
+ option :update_fontconfig, type: :boolean, aliases: :u,
92
+ desc: "Update fontconfig"
72
93
  def install(font)
73
94
  handle_class_options(options)
74
95
  confirmation = options[:accept_all_licenses] ? "yes" : "no"
@@ -134,8 +155,12 @@ module Fontist
134
155
  end
135
156
 
136
157
  desc "manifest-install MANIFEST", "Install fonts from MANIFEST (yaml)"
137
- option :accept_all_licenses, type: :boolean, aliases: "--confirm-license", desc: "Accept all license agreements"
138
- option :hide_licenses, type: :boolean, desc: "Hide license texts"
158
+ option :accept_all_licenses, type: :boolean,
159
+ aliases: ["--confirm-license", :a],
160
+ desc: "Accept all license agreements"
161
+ option :hide_licenses, type: :boolean,
162
+ aliases: :h,
163
+ desc: "Hide license texts"
139
164
  def manifest_install(manifest)
140
165
  handle_class_options(options)
141
166
  paths = Fontist::Manifest::Install.from_file(
@@ -178,28 +203,17 @@ module Fontist
178
203
  STATUS_SUCCESS
179
204
  end
180
205
 
181
- desc "import-sil", "Import formulas from SIL"
182
- def import_sil
183
- handle_class_options(options)
184
- require "fontist/import/sil_import"
185
- Fontist::Import::SilImport.new.call
186
- end
187
-
188
206
  desc "repo SUBCOMMAND ...ARGS", "Manage custom repositories"
189
207
  subcommand "repo", Fontist::RepoCLI
190
208
 
191
209
  desc "import SUBCOMMAND ...ARGS", "Manage imports"
192
210
  subcommand "import", Fontist::ImportCLI
193
211
 
194
- desc "google SUBCOMMAND ...ARGS", "Manage Google formulas"
195
- subcommand "google", Fontist::GoogleCLI
212
+ desc "fontconfig SUBCOMMAND ...ARGS", "Manage fontconfig"
213
+ subcommand "fontconfig", Fontist::FontconfigCLI
196
214
 
197
215
  private
198
216
 
199
- def handle_class_options(options)
200
- Fontist.preferred_family = options[:preferred_family]
201
- end
202
-
203
217
  def success
204
218
  STATUS_SUCCESS
205
219
  end