fontist 1.13.2 → 1.14.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2e0bff9ea15b251c5c03206705574e12cfc9fc4bc779d197d73d20a05977e745
4
- data.tar.gz: 33a6538507cc014c1fd4a0b1b11fa908560ae8319e9de13d33120c02a86953b4
3
+ metadata.gz: 2c0b58f3af1125a6a560179502a5ce5845e76b4d4db1c466e5f63f9628203089
4
+ data.tar.gz: 2176708c4c71239768f8714cf21d393aae208b8a7757402b08ad369ec155ed25
5
5
  SHA512:
6
- metadata.gz: bf17d3b2dd7a687f97db3bd24200d0bd07821bab47ac0c0ce8eeb1156ec1fc95b39660dfb75e6eb13e00080968de1168c83cca7d54caee0c09139d0a167651d6
7
- data.tar.gz: 18b6c0294686dcf739b2d1654b8c3e8488d823cb2de1d62659f834c7f8ca443615170d29f3f3bb2b705b27b07cb8a79d80ca6a185d09979c8c0f2f37f8af547f
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,18 +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
- -F, [--formula]:: Install by formula instead of font
131
- -a, [--accept-all-licenses]:: Accept all license agreements
132
- -h, [--hide-licenses]:: Hide license texts
133
- -p, [--no-progress]:: Hide download progress
134
- -V, [--version=VERSION]:: Install particular version of a font
135
- -s, [--smallest]:: Install the smallest formula
136
- -n, [--newest]:: Install the newest version of a font
137
- -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
138
137
  (default is 300 MB)
138
+ `-u, [--update-fontconfig]`:: Update Fontconfig
139
139
 
140
- === Uninstall fonts
140
+
141
+ NOTE: The `install` command is similar to the `Font.install` library call.
142
+
143
+
144
+ === Uninstall fonts: `fontist uninstall`
141
145
 
142
146
  Uninstalls any font supported by Fontist.
143
147
 
@@ -154,7 +158,7 @@ These fonts are removed:
154
158
  /Users/user/.fontist/fonts/SEGOEUI.TTF
155
159
  ----
156
160
 
157
- === Status
161
+ === Status: `fontist status`
158
162
 
159
163
  Prints installed font paths grouped by formula and font.
160
164
 
@@ -169,7 +173,7 @@ segoe_ui
169
173
  Bold Italic (/Users/user/.fontist/fonts/SEGOEUIZ.TTF)
170
174
  ----
171
175
 
172
- === List
176
+ === List: `fontist list`
173
177
 
174
178
  Lists installation status of fonts supported by Fontist.
175
179
 
@@ -193,7 +197,7 @@ google/roboto_mono
193
197
  Italic (uninstalled)
194
198
  ----
195
199
 
196
- === List installed font paths
200
+ === List installed font paths: `fontist manifest-locations`
197
201
 
198
202
  Returns locations of fonts specified in a YAML file as an input.
199
203
 
@@ -244,7 +248,7 @@ Roboto Mono:
244
248
 
245
249
  Since "`Segoe UI`" is installed, but "`Roboto Mono`" is not.
246
250
 
247
- === Install fonts from manifest
251
+ === Install fonts from manifest: `fontist manifest-install`
248
252
 
249
253
  Install fonts from a YAML Fontist manifest:
250
254
 
@@ -274,7 +278,31 @@ Roboto Mono:
274
278
  - "/Users/user/.fontist/fonts/RobotoMono-VariableFont_wght.ttf"
275
279
  ----
276
280
 
277
- === 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`
278
306
 
279
307
  List of all commands could be seen by:
280
308
 
@@ -372,7 +400,7 @@ Fontist::Formula.find("Calibri")
372
400
  ----
373
401
 
374
402
  This method will search and return a Fontist formula for the provided keyword
375
- 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
376
404
  installation of the font in your system.
377
405
 
378
406
  ==== List font styles supported by a formula
@@ -517,7 +545,36 @@ Fontist::Manifest::Locations.from_file("manifest.yml")
517
545
  Fontist::Manifest::Install.from_file("manifest.yml", confirmation: "yes")
518
546
  ----
519
547
 
520
- == 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
521
578
 
522
579
  Fontist uses Git internally for fetching formulas and fonts.
523
580
 
@@ -576,7 +633,64 @@ https://github.com/evantoli[evantoli]).
576
633
 
577
634
  == Authoring Fontist formulas
578
635
 
579
- === 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
580
694
 
581
695
  A formula could be generated from a fonts archive. Just specify a URL to the
582
696
  archive:
@@ -588,7 +702,7 @@ cp lato.yml ~/.fontist/formulas/Formulas/
588
702
  ----
589
703
 
590
704
  Though indexes are auto-generated now, maintainers should rebuild indexes in the
591
- 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.
592
706
 
593
707
  A formula index should be rebuilt when a new formula is generated or an existing
594
708
  one changed:
@@ -608,6 +722,56 @@ git add Formulas/lato.yml index.yml filename_index.yml
608
722
  git commit -m "Add Lato formula"
609
723
  ----
610
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.
611
775
 
612
776
 
613
777
 
@@ -630,7 +794,7 @@ In case an update is found, it could be fetched to the library by:
630
794
 
631
795
  [source,sh]
632
796
  ----
633
- bin/fontist google import
797
+ bin/fontist import google
634
798
  ----
635
799
 
636
800
  The script would update formulas which should be committed to a separate
@@ -659,7 +823,7 @@ They can be updated with:
659
823
 
660
824
  [source,sh]
661
825
  ----
662
- fontist import-sil
826
+ fontist import sil
663
827
  cd ~/.fontist/versions/{last_version}/formulas
664
828
  git add Formulas/sil
665
829
  git commit -m "SIL fonts update"
@@ -669,8 +833,8 @@ git push
669
833
  === Dynamically importing formulas from macOS
670
834
 
671
835
  macOS provides https://support.apple.com/en-om/HT211240#download[fonts] which
672
- can be manually downloaded with the Font Book app. When such font is requested,
673
- 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.
674
838
 
675
839
  In order to know which fonts are available in a current version of macOS,
676
840
  for each version there is a formula containing all supported fonts.
@@ -687,7 +851,7 @@ git push
687
851
  ----
688
852
 
689
853
  Here `--fonts-link` is a link to a page containing a list of available fonts
690
- in the Font Book app.
854
+ in the `Font Book.app`.
691
855
 
692
856
  If the import is run on a different version of macOS, then a proper version
693
857
  should be set in the `platforms` attribute of the generated formula:
@@ -732,82 +896,6 @@ https://github.com/fontist/formulas[formulas] repository.
732
896
  If you'd like to add a new formula repository or change settings for an existing
733
897
  one, please refer to its documentation.
734
898
 
735
- === Private Fontist formulas and font repositories
736
-
737
- There is an ability to use private fonts via private Fontist repositories.
738
-
739
- A Fontist repository is a Git repo which contains YAML formula files. Formulas can be created
740
- manually (see https://github.com/fontist/formulas/tree/master/Formulas[examples]),
741
- or xref:Authoring Fontist formulas[auto-generated from an archive].
742
-
743
- A repository can be either a HTTPS or SSH Git repo. In case of SSH, a
744
- corresponding SSH key should be setup with `ssh-agent` in order to access this
745
- private repository.
746
-
747
- The `fontist repo setup` command fetches a repository's formulas, and saves the
748
- repository's name and URL for later use.
749
-
750
- Internally, all repositories are stored at
751
- `~/.fontist/formulas/Formulas/private`.
752
-
753
- [source,sh]
754
- ----
755
- fontist repo setup NAME URL
756
- ----
757
-
758
- E.g.
759
-
760
- [source,sh]
761
- ----
762
- fontist repo setup acme https://example.com/acme/formulas.git
763
- # or
764
- fontist repo setup acme git@example.com:acme/formulas.git
765
- ----
766
-
767
- Then you can just install fonts from this repo:
768
-
769
- [source,sh]
770
- ----
771
- fontist install "private font"
772
- ----
773
-
774
- If the private Fontist formula repository is updated, you can fetch the updates
775
- with the `repo update` command:
776
-
777
- [source,sh]
778
- ----
779
- fontist repo update acme
780
- ----
781
-
782
- If there is a need to avoid using private formulas, the repo can be removed
783
- with:
784
-
785
- [source,sh]
786
- ----
787
- fontist repo remove acme
788
- ----
789
-
790
- === Private formulas
791
-
792
- Authorization of private archives in private formulas can be implemented with
793
- headers.
794
-
795
- Here is an example which works with Github releases:
796
-
797
- [source,yaml]
798
- ----
799
- resources:
800
- fonts.zip:
801
- urls:
802
- - url: https://example.com/repos/acme/formulas/releases/assets/38777461
803
- headers:
804
- Accept: application/octet-stream
805
- Authorization: token ghp_1234567890abcdefghi
806
- ----
807
-
808
- A token can be obtained on the
809
- https://github.com/settings/tokens[GitHub Settings > Tokens page].
810
- This token should have at least the `repo` scope for access to these assets.
811
899
 
812
900
  === Releasing
813
901
 
data/lib/fontist/cli.rb CHANGED
@@ -2,7 +2,7 @@ require "thor"
2
2
  require "fontist/cli/class_options"
3
3
  require "fontist/repo_cli"
4
4
  require "fontist/import_cli"
5
- require "fontist/google_cli"
5
+ require "fontist/fontconfig_cli"
6
6
 
7
7
  module Fontist
8
8
  class CLI < Thor
@@ -22,6 +22,8 @@ module Fontist
22
22
  STATUS_MANUAL_FONT_ERROR = 11
23
23
  STATUS_SIZE_LIMIT_ERROR = 12
24
24
  STATUS_FORMULA_NOT_FOUND = 13
25
+ STATUS_FONTCONFIG_NOT_FOUND = 14
26
+ STATUS_FONTCONFIG_FILE_NOT_FOUND = 15
25
27
 
26
28
  ERROR_TO_STATUS = {
27
29
  Fontist::Errors::UnsupportedFontError => [STATUS_NON_SUPPORTED_FONT_ERROR],
@@ -44,6 +46,9 @@ module Fontist
44
46
  Fontist::Errors::RepoNotFoundError => [STATUS_REPO_NOT_FOUND],
45
47
  Fontist::Errors::MainRepoNotFoundError => [STATUS_MAIN_REPO_NOT_FOUND],
46
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],
47
52
  }.freeze
48
53
 
49
54
  def self.exit_on_failure?
@@ -63,9 +68,9 @@ module Fontist
63
68
 
64
69
  desc "install FONT", "Install font"
65
70
  option :force, type: :boolean, aliases: :f,
66
- desc: "Install even if it's already installed in system"
71
+ desc: "Install even if already installed in system"
67
72
  option :formula, type: :boolean, aliases: :F,
68
- desc: "Install by formula instead of font"
73
+ desc: "Install whole formula instead of a font"
69
74
  option :accept_all_licenses, type: :boolean,
70
75
  aliases: ["--confirm-license", :a],
71
76
  desc: "Accept all license agreements"
@@ -76,13 +81,15 @@ module Fontist
76
81
  option :version, type: :string, aliases: :V,
77
82
  desc: "Specify particular version of a font"
78
83
  option :smallest, type: :boolean, aliases: :s,
79
- desc: "Install the smallest formula if several"
84
+ desc: "Install the smallest font by file size if several"
80
85
  option :newest, type: :boolean, aliases: :n,
81
86
  desc: "Install the newest version of a font if several"
82
87
  option :size_limit,
83
88
  type: :numeric, aliases: :S,
84
- desc: "Specify size limit for formula " \
89
+ desc: "Specify upper limit for file size of a formula to be installed" \
85
90
  "(default is #{Fontist.formula_size_limit_in_megabytes} MB)"
91
+ option :update_fontconfig, type: :boolean, aliases: :u,
92
+ desc: "Update fontconfig"
86
93
  def install(font)
87
94
  handle_class_options(options)
88
95
  confirmation = options[:accept_all_licenses] ? "yes" : "no"
@@ -196,21 +203,14 @@ module Fontist
196
203
  STATUS_SUCCESS
197
204
  end
198
205
 
199
- desc "import-sil", "Import formulas from SIL"
200
- def import_sil
201
- handle_class_options(options)
202
- require "fontist/import/sil_import"
203
- Fontist::Import::SilImport.new.call
204
- end
205
-
206
206
  desc "repo SUBCOMMAND ...ARGS", "Manage custom repositories"
207
207
  subcommand "repo", Fontist::RepoCLI
208
208
 
209
209
  desc "import SUBCOMMAND ...ARGS", "Manage imports"
210
210
  subcommand "import", Fontist::ImportCLI
211
211
 
212
- desc "google SUBCOMMAND ...ARGS", "Manage Google formulas"
213
- subcommand "google", Fontist::GoogleCLI
212
+ desc "fontconfig SUBCOMMAND ...ARGS", "Manage fontconfig"
213
+ subcommand "fontconfig", Fontist::FontconfigCLI
214
214
 
215
215
  private
216
216
 
@@ -4,6 +4,18 @@ module Fontist
4
4
 
5
5
  class BinaryCallError < GeneralError; end
6
6
 
7
+ class FontconfigNotFoundError < GeneralError
8
+ def initialize
9
+ super("Could not find fontconfig.")
10
+ end
11
+ end
12
+
13
+ class FontconfigFileNotFoundError < GeneralError
14
+ def initialize
15
+ super("Fontist file could not be found in fontconfig configuration.")
16
+ end
17
+ end
18
+
7
19
  class FontIndexCorrupted < GeneralError; end
8
20
 
9
21
  class FontNotFoundError < GeneralError; end
data/lib/fontist/font.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "fontist/font_installer"
2
2
  require "fontist/font_path"
3
3
  require "fontist/formula_picker"
4
+ require "fontist/fontconfig"
4
5
 
5
6
  module Fontist
6
7
  class Font
@@ -15,6 +16,7 @@ module Fontist
15
16
  @newest = options[:newest]
16
17
  @size_limit = options[:size_limit]
17
18
  @by_formula = options[:formula]
19
+ @update_fontconfig = options[:update_fontconfig]
18
20
 
19
21
  check_or_create_fontist_path!
20
22
  end
@@ -166,9 +168,13 @@ module Fontist
166
168
  def download_font
167
169
  return if sufficient_formulas.empty?
168
170
 
169
- sufficient_formulas.flat_map do |formula|
171
+ paths = sufficient_formulas.flat_map do |formula|
170
172
  request_formula_installation(formula)
171
173
  end
174
+
175
+ update_fontconfig
176
+
177
+ paths
172
178
  end
173
179
 
174
180
  def request_formula_installation(formula)
@@ -220,6 +226,12 @@ module Fontist
220
226
  MSG
221
227
  end
222
228
 
229
+ def update_fontconfig
230
+ return unless @update_fontconfig
231
+
232
+ Fontconfig.update
233
+ end
234
+
223
235
  def manual_font
224
236
  return if manual_formulas.empty?
225
237