fontist 1.18.2 → 1.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/deploy-pages.yml +48 -0
- data/.github/workflows/tebako-pack.yml +61 -0
- data/LICENSE.txt +1 -2
- data/README.adoc +28 -4
- data/docs/.gitignore +136 -0
- data/docs/.vitepress/config.ts +83 -0
- data/docs/guide/api-ruby.md +190 -0
- data/docs/guide/ci.md +29 -0
- data/docs/guide/fontconfig.md +23 -0
- data/docs/guide/index.md +67 -0
- data/docs/guide/proxy.md +47 -0
- data/docs/guide/why.md +7 -0
- data/docs/index.md +40 -0
- data/docs/package-lock.json +1791 -0
- data/docs/package.json +17 -0
- data/docs/public/hero.png +0 -0
- data/docs/public/logo.png +0 -0
- data/docs/reference/index.md +143 -0
- data/fontist.gemspec +3 -0
- data/lib/fontist/cli/class_options.rb +7 -0
- data/lib/fontist/cli.rb +1 -0
- data/lib/fontist/config.rb +23 -7
- data/lib/fontist/config_cli.rb +26 -8
- data/lib/fontist/errors.rb +2 -0
- data/lib/fontist/font.rb +50 -10
- data/lib/fontist/formula.rb +71 -3
- data/lib/fontist/formula_suggestion.rb +55 -0
- data/lib/fontist/version.rb +1 -1
- data/lib/fontist.rb +9 -1
- metadata +61 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b84dad2469698853e57c647d63890c7f054f888db3d7c53367e7c17ac3ca3951
|
4
|
+
data.tar.gz: ebc3c36071d189946c187af9c7a1e340ed703dc37b1eb40b821ce7557b4f2b3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3cb8a0632dde13a856ac227b3dfd6af2082fa9e4a4c27357e94664cfb3861b26ed16af5dd0891eb1542d3ec2ae4d82dbc8f57c8ae593f39610c071885f6e45d3
|
7
|
+
data.tar.gz: a792eceef4a821e48acce6ccb7d863a9fbc7602ac8197f488a927a1e1563947740ff4863a6162af004dbfcc40789433980ce31aed0b2a674d6b10d74009b3b7d
|
@@ -0,0 +1,48 @@
|
|
1
|
+
name: deploy-pages
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
branches: "main"
|
5
|
+
paths-ignore:
|
6
|
+
- README.md
|
7
|
+
- CONTRIBUTING.md
|
8
|
+
- LICENSE
|
9
|
+
- .gitignore
|
10
|
+
- .github/**
|
11
|
+
- "!.github/workflows/deploy-pages.yml"
|
12
|
+
workflow_dispatch:
|
13
|
+
concurrency:
|
14
|
+
group: ${{ github.workflow }}
|
15
|
+
cancel-in-progress: true
|
16
|
+
jobs:
|
17
|
+
deploy-pages:
|
18
|
+
environment:
|
19
|
+
name: github-pages
|
20
|
+
url: ${{ steps.deploy-pages.outputs.page_url }}
|
21
|
+
permissions:
|
22
|
+
pages: write
|
23
|
+
id-token: write
|
24
|
+
runs-on: ubuntu-latest
|
25
|
+
steps:
|
26
|
+
- uses: actions/checkout@v4
|
27
|
+
- uses: actions/setup-node@v4
|
28
|
+
with:
|
29
|
+
node-version: latest
|
30
|
+
# Lockfile is in subfolder
|
31
|
+
# cache: npm
|
32
|
+
- uses: ruby/setup-ruby@v1
|
33
|
+
with:
|
34
|
+
ruby-version: ruby
|
35
|
+
- run: rdoc -x docs
|
36
|
+
- run: npm install
|
37
|
+
working-directory: docs
|
38
|
+
- id: configure-pages
|
39
|
+
uses: actions/configure-pages@v4
|
40
|
+
- run: npm run build
|
41
|
+
working-directory: docs
|
42
|
+
env:
|
43
|
+
BASE_PATH: ${{ steps.configure-pages.outputs.base_path }}/
|
44
|
+
- run: mv docs/.vitepress/dist _site
|
45
|
+
- run: mv doc _site/reference/api-ruby
|
46
|
+
- uses: actions/upload-pages-artifact@v3
|
47
|
+
- id: deploy-pages
|
48
|
+
uses: actions/deploy-pages@v4
|
@@ -0,0 +1,61 @@
|
|
1
|
+
name: tebako-pack
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
tags: [ 'v*' ]
|
6
|
+
workflow_dispatch:
|
7
|
+
|
8
|
+
concurrency:
|
9
|
+
group: '${{ github.workflow }}-${{ github.job }}-${{ github.head_ref || github.ref_name }}'
|
10
|
+
cancel-in-progress: true
|
11
|
+
|
12
|
+
env:
|
13
|
+
# This is Ruby version that will be as a base for tebako package
|
14
|
+
# I.e.: fontist binary will be executed by this version of Ruby
|
15
|
+
PACKAGE_RUBY_VER: 3.2.3
|
16
|
+
# This is Ruby version that will be used to execute tebako itself
|
17
|
+
# It can be the same as PACKAGE_RUBY_VER but for whatever reason 3.1.4
|
18
|
+
# has better performance
|
19
|
+
TEBAKO_RUBY_VER: 3.1.4
|
20
|
+
|
21
|
+
jobs:
|
22
|
+
pack:
|
23
|
+
name: Pack fontist
|
24
|
+
runs-on: ${{ matrix.os }}
|
25
|
+
strategy:
|
26
|
+
fail-fast: false
|
27
|
+
# macos-11 runner is deadly slow because brew is not supported on this version anymore
|
28
|
+
# so it is practically impossible to use it for tests anymore
|
29
|
+
matrix:
|
30
|
+
os: [ubuntu-20.04, macos-12]
|
31
|
+
steps:
|
32
|
+
- uses: actions/checkout@v4
|
33
|
+
with:
|
34
|
+
fetch-depth: 1
|
35
|
+
|
36
|
+
- name: Setup Tebako
|
37
|
+
uses: tamatebako/tebako/.github/actions/setup-tebako@main
|
38
|
+
with:
|
39
|
+
cache: build
|
40
|
+
ruby_version: ${{ env.TEBAKO_RUBY_VER }}
|
41
|
+
|
42
|
+
- name: Pack Fontist
|
43
|
+
run: |
|
44
|
+
tebako press -R "$PACKAGE_RUBY_VER" --root="." --entry-point="fontist" --output="fontist"
|
45
|
+
if [ ${{ matrix.os }} -ne "macos-12" ]; then
|
46
|
+
strip fontist
|
47
|
+
fi
|
48
|
+
./fontist help || echo "fontist help exits with status 1"
|
49
|
+
cp ./fontist ./fontist-${{ runner.os }}
|
50
|
+
|
51
|
+
- if: github.event_name != 'workflow_dispatch'
|
52
|
+
uses: softprops/action-gh-release@v1
|
53
|
+
with:
|
54
|
+
files: |
|
55
|
+
fontist-${{ runner.os }}
|
56
|
+
|
57
|
+
- if: github.event_name == 'workflow_dispatch'
|
58
|
+
uses: actions/upload-artifact@v4
|
59
|
+
with:
|
60
|
+
name: fontist-${{ matrix.os }}
|
61
|
+
path: fontist-${{ runner.os }}
|
data/LICENSE.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
BSD 2-Clause License
|
2
2
|
|
3
3
|
Copyright (c) 2020, Ribose
|
4
4
|
All rights reserved.
|
@@ -23,4 +23,3 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
23
23
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
24
24
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
25
25
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
26
|
-
|
data/README.adoc
CHANGED
@@ -123,7 +123,29 @@ Here, `courier_prime` is the filename of the formula located at the public
|
|
123
123
|
Fontist Formula repository
|
124
124
|
(https://github.com/fontist/formulas/blob/v3/Formulas/courier_prime.yml[`courier_prime.yml`]).
|
125
125
|
|
126
|
-
|
126
|
+
You can also specify the human-readable name of the formula. This name is
|
127
|
+
derived from the filename, with underscores replaced by spaces. It's not
|
128
|
+
case-sensitive, meaning you can use capital letters if you prefer.
|
129
|
+
|
130
|
+
[source,sh]
|
131
|
+
----
|
132
|
+
$ fontist install --formula "Courier Prime"
|
133
|
+
$ fontist install --formula "Google/Noto Sans"
|
134
|
+
----
|
135
|
+
|
136
|
+
Installation by the formula name supports suggestions in CLI when input is
|
137
|
+
partial:
|
138
|
+
|
139
|
+
[source,sh]
|
140
|
+
----
|
141
|
+
$ fontist install --formula 'noto s'
|
142
|
+
Formula 'noto s' not found. Did you mean?
|
143
|
+
[0] Google/Noto Sans
|
144
|
+
[1] Google/Noto Serif
|
145
|
+
Please type number or press ENTER to skip installation:
|
146
|
+
----
|
147
|
+
|
148
|
+
NOTE: Specifying the font's filename is not supported yet.
|
127
149
|
|
128
150
|
If there are several formulas with a requested font, then `fontist` searches
|
129
151
|
for the newest version of the font among formulas with size below a limit
|
@@ -306,11 +328,13 @@ Roboto Mono:
|
|
306
328
|
|
307
329
|
Fontist supports system-wide settings for the following parameters:
|
308
330
|
|
331
|
+
`fonts_path`:: Sets path where to install fonts (default: `~/.fontist/fonts`)
|
332
|
+
|
309
333
|
`open_timeout`:: Sets timeout for opening a connection during download
|
310
|
-
(default: 10)
|
334
|
+
(default: `10`)
|
311
335
|
|
312
336
|
`read_timeout`:: Sets timeout for reading the opened connection during download
|
313
|
-
(default: 10)
|
337
|
+
(default: `10`)
|
314
338
|
|
315
339
|
Show current attributes in the config:
|
316
340
|
|
@@ -377,7 +401,7 @@ List of all commands could be seen by:
|
|
377
401
|
fontist help
|
378
402
|
----
|
379
403
|
|
380
|
-
=== Configuration
|
404
|
+
=== Configuration with environment variables
|
381
405
|
|
382
406
|
By default Fontist uses the `~/.fontist` directory to store fonts and its
|
383
407
|
files. It could be changed with the `FONTIST_PATH` environment variable.
|
data/docs/.gitignore
ADDED
@@ -0,0 +1,136 @@
|
|
1
|
+
# https://vitepress.dev/
|
2
|
+
**/.vitepress/cache
|
3
|
+
**/.vitepress/dist
|
4
|
+
|
5
|
+
#region https://github.com/github/gitignore/blob/main/Node.gitignore
|
6
|
+
# Logs
|
7
|
+
logs
|
8
|
+
*.log
|
9
|
+
npm-debug.log*
|
10
|
+
yarn-debug.log*
|
11
|
+
yarn-error.log*
|
12
|
+
lerna-debug.log*
|
13
|
+
.pnpm-debug.log*
|
14
|
+
|
15
|
+
# Diagnostic reports (https://nodejs.org/api/report.html)
|
16
|
+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
17
|
+
|
18
|
+
# Runtime data
|
19
|
+
pids
|
20
|
+
*.pid
|
21
|
+
*.seed
|
22
|
+
*.pid.lock
|
23
|
+
|
24
|
+
# Directory for instrumented libs generated by jscoverage/JSCover
|
25
|
+
lib-cov
|
26
|
+
|
27
|
+
# Coverage directory used by tools like istanbul
|
28
|
+
coverage
|
29
|
+
*.lcov
|
30
|
+
|
31
|
+
# nyc test coverage
|
32
|
+
.nyc_output
|
33
|
+
|
34
|
+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
35
|
+
.grunt
|
36
|
+
|
37
|
+
# Bower dependency directory (https://bower.io/)
|
38
|
+
bower_components
|
39
|
+
|
40
|
+
# node-waf configuration
|
41
|
+
.lock-wscript
|
42
|
+
|
43
|
+
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
44
|
+
build/Release
|
45
|
+
|
46
|
+
# Dependency directories
|
47
|
+
node_modules/
|
48
|
+
jspm_packages/
|
49
|
+
|
50
|
+
# Snowpack dependency directory (https://snowpack.dev/)
|
51
|
+
web_modules/
|
52
|
+
|
53
|
+
# TypeScript cache
|
54
|
+
*.tsbuildinfo
|
55
|
+
|
56
|
+
# Optional npm cache directory
|
57
|
+
.npm
|
58
|
+
|
59
|
+
# Optional eslint cache
|
60
|
+
.eslintcache
|
61
|
+
|
62
|
+
# Optional stylelint cache
|
63
|
+
.stylelintcache
|
64
|
+
|
65
|
+
# Microbundle cache
|
66
|
+
.rpt2_cache/
|
67
|
+
.rts2_cache_cjs/
|
68
|
+
.rts2_cache_es/
|
69
|
+
.rts2_cache_umd/
|
70
|
+
|
71
|
+
# Optional REPL history
|
72
|
+
.node_repl_history
|
73
|
+
|
74
|
+
# Output of 'npm pack'
|
75
|
+
*.tgz
|
76
|
+
|
77
|
+
# Yarn Integrity file
|
78
|
+
.yarn-integrity
|
79
|
+
|
80
|
+
# dotenv environment variable files
|
81
|
+
.env
|
82
|
+
.env.development.local
|
83
|
+
.env.test.local
|
84
|
+
.env.production.local
|
85
|
+
.env.local
|
86
|
+
|
87
|
+
# parcel-bundler cache (https://parceljs.org/)
|
88
|
+
.cache
|
89
|
+
.parcel-cache
|
90
|
+
|
91
|
+
# Next.js build output
|
92
|
+
.next
|
93
|
+
out
|
94
|
+
|
95
|
+
# Nuxt.js build / generate output
|
96
|
+
.nuxt
|
97
|
+
dist
|
98
|
+
|
99
|
+
# Gatsby files
|
100
|
+
.cache/
|
101
|
+
# Comment in the public line in if your project uses Gatsby and not Next.js
|
102
|
+
# https://nextjs.org/blog/next-9-1#public-directory-support
|
103
|
+
# public
|
104
|
+
|
105
|
+
# vuepress build output
|
106
|
+
.vuepress/dist
|
107
|
+
|
108
|
+
# vuepress v2.x temp and cache directory
|
109
|
+
.temp
|
110
|
+
.cache
|
111
|
+
|
112
|
+
# Docusaurus cache and generated files
|
113
|
+
.docusaurus
|
114
|
+
|
115
|
+
# Serverless directories
|
116
|
+
.serverless/
|
117
|
+
|
118
|
+
# FuseBox cache
|
119
|
+
.fusebox/
|
120
|
+
|
121
|
+
# DynamoDB Local files
|
122
|
+
.dynamodb/
|
123
|
+
|
124
|
+
# TernJS port file
|
125
|
+
.tern-port
|
126
|
+
|
127
|
+
# Stores VSCode versions used for testing VSCode extensions
|
128
|
+
.vscode-test
|
129
|
+
|
130
|
+
# yarn v2
|
131
|
+
.yarn/cache
|
132
|
+
.yarn/unplugged
|
133
|
+
.yarn/build-state.yml
|
134
|
+
.yarn/install-state.gz
|
135
|
+
.pnp.*
|
136
|
+
#endregion
|
@@ -0,0 +1,83 @@
|
|
1
|
+
import { defineConfig } from "vitepress";
|
2
|
+
|
3
|
+
// https://vitepress.dev/reference/site-config
|
4
|
+
export default defineConfig({
|
5
|
+
// https://vitepress.dev/guide/routing#generating-clean-url
|
6
|
+
cleanUrls: true,
|
7
|
+
|
8
|
+
title: "Fontist",
|
9
|
+
description:
|
10
|
+
"Fontist brings cross-platform font management to the command line for Windows, Linux, and macOS. Free and open source.",
|
11
|
+
|
12
|
+
// https://github.com/vuejs/vitepress/issues/3508
|
13
|
+
base: process.env.BASE_PATH,
|
14
|
+
|
15
|
+
// https://vitepress.dev/reference/default-theme-config
|
16
|
+
themeConfig: {
|
17
|
+
logo: "/logo.png",
|
18
|
+
|
19
|
+
nav: [
|
20
|
+
{ text: "Home", link: "/" },
|
21
|
+
{ text: "Guide", link: "/guide/" },
|
22
|
+
{ text: "Reference", link: "/reference/" },
|
23
|
+
{
|
24
|
+
text: "Formulas",
|
25
|
+
link: "https://fontist.org/formulas/",
|
26
|
+
target: "_self",
|
27
|
+
},
|
28
|
+
],
|
29
|
+
|
30
|
+
sidebar: {
|
31
|
+
"/guide/": [
|
32
|
+
{
|
33
|
+
text: "Guide",
|
34
|
+
items: [
|
35
|
+
{ text: "Why Fontist?", link: "/guide/why" },
|
36
|
+
{ text: "Getting started", link: "/guide/" },
|
37
|
+
{ text: "Using Fontist in CI", link: "/guide/ci" },
|
38
|
+
{ text: "Fontist with Fontconfig", link: "/guide/fontconfig" },
|
39
|
+
{ text: "Using Fontist with a proxy", link: "/guide/proxy" },
|
40
|
+
{
|
41
|
+
text: "Create a new Fontist Formula",
|
42
|
+
link: "https://fontist.org/formulas/guide/create-formula",
|
43
|
+
target: "_self",
|
44
|
+
},
|
45
|
+
],
|
46
|
+
},
|
47
|
+
{
|
48
|
+
text: "API",
|
49
|
+
items: [
|
50
|
+
{ text: "Fontist Ruby library", link: "/guide/api-ruby" },
|
51
|
+
{
|
52
|
+
text: "Ruby API reference",
|
53
|
+
link: "https://fontist.org/fontist/reference/api-ruby/",
|
54
|
+
target: "_self",
|
55
|
+
},
|
56
|
+
],
|
57
|
+
},
|
58
|
+
],
|
59
|
+
"/reference/": [
|
60
|
+
{
|
61
|
+
text: "Reference",
|
62
|
+
items: [
|
63
|
+
{ text: "Fontist CLI reference", link: "/reference/" },
|
64
|
+
{
|
65
|
+
text: "Ruby API reference",
|
66
|
+
link: "https://fontist.org/fontist/reference/api-ruby/",
|
67
|
+
target: "_self",
|
68
|
+
},
|
69
|
+
],
|
70
|
+
},
|
71
|
+
],
|
72
|
+
},
|
73
|
+
|
74
|
+
socialLinks: [
|
75
|
+
{ icon: "github", link: "https://github.com/fontist/fontist" },
|
76
|
+
],
|
77
|
+
|
78
|
+
footer: {
|
79
|
+
message: `Fontist is <a href="https://open.ribose.com/">riboseopen</a>`,
|
80
|
+
copyright: `Copyright © 2023 Ribose Group Inc. All rights reserved.`,
|
81
|
+
},
|
82
|
+
},
|
83
|
+
});
|
@@ -0,0 +1,190 @@
|
|
1
|
+
# Fontist Ruby library
|
2
|
+
|
3
|
+
In addition to the command-line interface, Fontist can be used as a Ruby library.
|
4
|
+
|
5
|
+
## Fontist::Font
|
6
|
+
|
7
|
+
The `Fontist::Font` is your go-to place to deal with any font using Fontist.
|
8
|
+
|
9
|
+
This interface allows you to find a font or install a font.
|
10
|
+
|
11
|
+
### Finding a font
|
12
|
+
|
13
|
+
The `Fontist::Font.find` interface can be used to find a font in your system.
|
14
|
+
|
15
|
+
It will look into the operating system specific font directories, and also the fontist specific `~/.fontist` directory.
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
Fontist::Font.find(name)
|
19
|
+
```
|
20
|
+
|
21
|
+
- If Fontist finds a font, then it will return the paths.
|
22
|
+
- Otherwise, it will either raise an unsupported font error, or trigger display of installation instructions for that specific font.
|
23
|
+
|
24
|
+
### Install a font
|
25
|
+
|
26
|
+
The `Fontist::Font.install` interface can be used to install any supported font.
|
27
|
+
|
28
|
+
This interface first checks if you already have that font installed or not and if you do, then it will return the paths.
|
29
|
+
|
30
|
+
If you don't have a font but that font is supported by Fontist, then it will download the font and copy it to `~/.fontist` directory and also return the paths.
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
Fontist::Font.install(name, confirmation: "no")
|
34
|
+
```
|
35
|
+
|
36
|
+
If there are issues detected with the provided font, such as the font is not supported, those errors would be raised.
|
37
|
+
|
38
|
+
### List all fonts
|
39
|
+
|
40
|
+
The `Fontist::Font` interface exposes an interface to list all supported fonts.
|
41
|
+
|
42
|
+
This might be useful if you want to know the name of the font or the available styles. You can do that by using:
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
Fontist::Font.all
|
46
|
+
```
|
47
|
+
|
48
|
+
The return values are `OpenStruct` objects, so you can easily do any other operation you would do in any Ruby object.
|
49
|
+
|
50
|
+
## Fontist::Formula
|
51
|
+
|
52
|
+
The `fontist` gem internally uses the `Fontist::Formula` interface to find a registered formula or fonts supported by any formula. Unless you need to do anything with that, you shouldn't need to work with this interface directly. But if you do, then these are the public interfaces it offers.
|
53
|
+
|
54
|
+
### Find a formula
|
55
|
+
|
56
|
+
The `Fontist::Formula.find` interface allows you to find any of the registered formulas. This interface takes a font name as an argument and it looks through each of the registered formulas that offer this font installation. Usages:
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
Fontist::Formula.find("Calibri")
|
60
|
+
```
|
61
|
+
|
62
|
+
This method will search and return a Fontist formula for the provided keyword which allows for further processing, such as license checks or proceeding with the installation of the font in your system.
|
63
|
+
|
64
|
+
### List font styles supported by a formula
|
65
|
+
|
66
|
+
Normally, each font name can be associated with multiple styles or collections, for example, the `Calibri` font might contain `regular`, `bold`, or `italic` styles fonts and if you want an interface that can return the complete list then this is your friend.
|
67
|
+
|
68
|
+
You can use it as following:
|
69
|
+
|
70
|
+
```ruby
|
71
|
+
Fontist::Formula.find_fonts("Calibri")
|
72
|
+
```
|
73
|
+
|
74
|
+
### List all formulas
|
75
|
+
|
76
|
+
The `Fontist::Formula` interface exposes an interface to list all registered font formulas. This might be useful if you want to know the name of the formula or what type of fonts can be installed using that formula. Usages:
|
77
|
+
|
78
|
+
```ruby
|
79
|
+
Fontist::Formula.all
|
80
|
+
```
|
81
|
+
|
82
|
+
The return values are `OpenStruct` objects, so you can easily do any other operation you would do in any Ruby object.
|
83
|
+
|
84
|
+
## Fontist::Manifest
|
85
|
+
|
86
|
+
### Global options
|
87
|
+
|
88
|
+
Fontist can be switched to use the preferred family names. This format was used prior to v1.10.
|
89
|
+
|
90
|
+
```ruby
|
91
|
+
Fontist.preferred_family = true
|
92
|
+
```
|
93
|
+
|
94
|
+
### Fontist::Manifest::Locations
|
95
|
+
|
96
|
+
Fontist lets you find font locations from a defined manifest Hash in the following format:
|
97
|
+
|
98
|
+
```ruby
|
99
|
+
{
|
100
|
+
"Segoe UI"=>["Regular", "Bold"],
|
101
|
+
"Roboto Mono"=>["Regular"]
|
102
|
+
}
|
103
|
+
```
|
104
|
+
|
105
|
+
Calling the following code returns a nested Hash with font paths and names. Font name is useful to choose a specific font in a font collection file (TTC).
|
106
|
+
|
107
|
+
```ruby
|
108
|
+
Fontist::Manifest::Locations.from_hash(manifest)
|
109
|
+
```
|
110
|
+
|
111
|
+
```ruby
|
112
|
+
{
|
113
|
+
"Segoe UI"=> {
|
114
|
+
"Regular"=>{
|
115
|
+
"full_name"=>"Segoe UI",
|
116
|
+
"paths"=>["/Users/user/.fontist/fonts/SEGOEUI.TTF"]
|
117
|
+
},
|
118
|
+
"Bold"=>{
|
119
|
+
"full_name"=>"Segoe UI Bold",
|
120
|
+
"paths"=>["/Users/user/.fontist/fonts/SEGOEUIB.TTF"]
|
121
|
+
}
|
122
|
+
},
|
123
|
+
"Roboto Mono"=> {
|
124
|
+
"Regular"=>{
|
125
|
+
"full_name"=>nil,
|
126
|
+
"paths"=>[]
|
127
|
+
}
|
128
|
+
}
|
129
|
+
}
|
130
|
+
```
|
131
|
+
|
132
|
+
### Fontist::Manifest::Install
|
133
|
+
|
134
|
+
Fontist lets you not only obtain font locations but also install fonts from the manifest:
|
135
|
+
|
136
|
+
```ruby
|
137
|
+
Fontist::Manifest::Install.from_hash(manifest, confirmation: "yes")
|
138
|
+
```
|
139
|
+
|
140
|
+
It will install fonts and return their locations:
|
141
|
+
|
142
|
+
```ruby
|
143
|
+
{
|
144
|
+
"Segoe UI"=> {
|
145
|
+
"Regular"=>{
|
146
|
+
"full_name"=>"Segoe UI",
|
147
|
+
"paths"=>["/Users/user/.fontist/fonts/SEGOEUI.TTF"]},
|
148
|
+
"Bold"=>{
|
149
|
+
"full_name"=>"Segoe UI Bold",
|
150
|
+
"paths"=>["/Users/user/.fontist/fonts/SEGOEUIB.TTF"]
|
151
|
+
}
|
152
|
+
},
|
153
|
+
"Roboto Mono"=> {
|
154
|
+
"Regular"=>{
|
155
|
+
"full_name"=>"Roboto Mono Regular",
|
156
|
+
"paths"=>["/Users/user/.fontist/fonts/RobotoMono-VariableFont_wght.ttf"]
|
157
|
+
}
|
158
|
+
}
|
159
|
+
}
|
160
|
+
```
|
161
|
+
|
162
|
+
### Support of YAML format
|
163
|
+
|
164
|
+
Both commands support a YAML file as an input with a `from_file` method. For example, if there is a `manifest.yml` file containing:
|
165
|
+
|
166
|
+
```yaml
|
167
|
+
---
|
168
|
+
Segoe UI:
|
169
|
+
- Regular
|
170
|
+
- Bold
|
171
|
+
Roboto Mono:
|
172
|
+
- Regular
|
173
|
+
```
|
174
|
+
|
175
|
+
Then the following calls would return font names and paths, as from the `from_hash` method (see Fontist::Manifest::Install and Fontist::Manifest::Locations).
|
176
|
+
|
177
|
+
```ruby
|
178
|
+
Fontist::Manifest::Locations.from_file("manifest.yml")
|
179
|
+
Fontist::Manifest::Install.from_file("manifest.yml", confirmation: "yes")
|
180
|
+
```
|
181
|
+
|
182
|
+
## Fontist::Fontconfig
|
183
|
+
|
184
|
+
Fontist supports work with Fontconfig via the Ruby interface:
|
185
|
+
|
186
|
+
```ruby
|
187
|
+
Fontist::Fontconfig.update # let detect fontist fonts
|
188
|
+
Fontist::Fontconfig.remove # disable detection
|
189
|
+
Fontist::Fontconfig.remove(force: true) # do not fail if no config exists
|
190
|
+
```
|
data/docs/guide/ci.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Using Fontist in CI
|
2
|
+
|
3
|
+
Fontist works well in CI environments too! You can just `gem install fontist` like normal to get up and running. Hoever, if you don't like waiting for it to compile the native Ruby extensions each time you `gem install fontist` then you might be interested in our premade custom CI helpers.
|
4
|
+
|
5
|
+
```sh
|
6
|
+
# This works on your PC and in CI! 🚀
|
7
|
+
gem install fontist
|
8
|
+
```
|
9
|
+
|
10
|
+
ℹ Make sure your CI runner has an appropriate version of Ruby installed.
|
11
|
+
|
12
|
+
## GitHub Actions
|
13
|
+
|
14
|
+
If you want to use Fontist in GitHub Actions you can use the [fontist/setup](https://github.com/fontist/setup) action to automagically ✨ configure Fontist in the GitHub Actions environment. This lets you install fonts and use them in your CI process. Here's an example:
|
15
|
+
|
16
|
+
```yml
|
17
|
+
on: push
|
18
|
+
jobs:
|
19
|
+
job:
|
20
|
+
runs-on: ubuntu-latest
|
21
|
+
steps:
|
22
|
+
- uses: actions/checkout@v4
|
23
|
+
- uses: fontist/setup@v1
|
24
|
+
- run: fontist install "Fira Code"
|
25
|
+
- run: fontist install "Open Sans"
|
26
|
+
# Now you can use the installed fonts!
|
27
|
+
```
|
28
|
+
|
29
|
+
[📚 Read more on the fontist/setup GitHub page](https://github.com/fontist/setup)
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Fontist with Fontconfig
|
2
|
+
|
3
|
+
Fontconfig is software designed to provide fonts to other programs. It is typically used on Linux, but also available on macOS and Windows. Fontconfig is used by LibreOffice, GIMP, and many other programs.
|
4
|
+
|
5
|
+
In order to find Fontist fonts, Fontconfig should be updated to include Fontist paths. This can be done with the `--update-fontconfig` option of `install`:
|
6
|
+
|
7
|
+
```sh
|
8
|
+
fontist install --update-fontconfig 'courier prime'
|
9
|
+
```
|
10
|
+
|
11
|
+
Or by calling a special command:
|
12
|
+
|
13
|
+
```sh
|
14
|
+
fontist fontconfig update
|
15
|
+
```
|
16
|
+
|
17
|
+
This will create a configuration file in `~/.config/fontconfig/conf.d/10-fontist.conf`.
|
18
|
+
|
19
|
+
To remove it, please use:
|
20
|
+
|
21
|
+
```sh
|
22
|
+
fontist fontconfig remove
|
23
|
+
```
|