fontist 2.1.2 → 2.1.4
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 +4 -4
- data/.github/workflows/docs.yml +70 -0
- data/.github/workflows/links.yml +100 -0
- data/.github/workflows/rake-metanorma.yaml +21 -3
- data/.github/workflows/release.yml +2 -0
- data/.gitignore +9 -7
- data/README.adoc +100 -0
- data/docs/.vitepress/config.ts +153 -32
- data/docs/.vitepress/data/cli-commands.json +461 -0
- data/docs/.vitepress/data/exit-codes.json +21 -0
- data/docs/.vitepress/data/features.json +44 -0
- data/docs/.vitepress/theme/components/HeroCodeBlock.vue +98 -0
- data/docs/.vitepress/theme/components/WithinHero.vue +30 -0
- data/docs/.vitepress/theme/index.ts +12 -0
- data/docs/.vitepress/theme/style.css +152 -0
- data/docs/api/errors.md +211 -0
- data/docs/api/font.md +101 -0
- data/docs/api/fontconfig.md +82 -0
- data/docs/api/formula.md +103 -0
- data/docs/api/index.md +49 -0
- data/docs/api/manifest.md +209 -0
- data/docs/cli/cache.md +100 -0
- data/docs/cli/config.md +123 -0
- data/docs/cli/create-formula.md +65 -0
- data/docs/cli/exit-codes.md +73 -0
- data/docs/cli/fontconfig.md +85 -0
- data/docs/cli/import.md +136 -0
- data/docs/cli/index-cmd.md +37 -0
- data/docs/cli/index.md +80 -0
- data/docs/cli/install.md +52 -0
- data/docs/cli/list.md +39 -0
- data/docs/cli/manifest.md +110 -0
- data/docs/cli/repo.md +142 -0
- data/docs/cli/status.md +39 -0
- data/docs/cli/uninstall.md +34 -0
- data/docs/cli/update.md +31 -0
- data/docs/cli/version.md +38 -0
- data/docs/components/CliCommand.vue +77 -0
- data/docs/components/CliExamples.vue +17 -0
- data/docs/components/CliOptions.vue +26 -0
- data/docs/components/ExitCodes.vue +18 -0
- data/docs/guide/ci.md +4 -0
- data/docs/guide/concepts/fonts.md +158 -0
- data/docs/guide/concepts/formats.md +234 -0
- data/docs/guide/concepts/index.md +109 -0
- data/docs/guide/concepts/licenses.md +236 -0
- data/docs/guide/concepts/requirements.md +388 -0
- data/docs/guide/concepts/variable-fonts.md +212 -0
- data/docs/guide/formulas.md +192 -0
- data/docs/guide/how-it-works.md +428 -0
- data/docs/guide/index.md +26 -47
- data/docs/guide/installation.md +105 -0
- data/docs/guide/manifests.md +132 -0
- data/docs/guide/quick-start.md +76 -0
- data/docs/guide/why.md +4 -0
- data/docs/index.md +55 -23
- data/docs/lychee.toml +33 -0
- data/docs/package-lock.json +1539 -770
- data/docs/package.json +4 -6
- data/docs/public/apple-touch-icon.png +0 -0
- data/docs/public/favicon-96x96.png +0 -0
- data/docs/public/favicon.ico +0 -0
- data/docs/public/favicon.svg +1 -0
- data/docs/public/logo-full.svg +1 -0
- data/docs/public/logo.svg +1 -0
- data/docs/public/site.webmanifest +21 -0
- data/docs/public/web-app-manifest-192x192.png +0 -0
- data/docs/public/web-app-manifest-512x512.png +0 -0
- data/lib/fontist/cli.rb +0 -1
- data/lib/fontist/font_file.rb +65 -14
- data/lib/fontist/indexes/index_mixin.rb +109 -20
- data/lib/fontist/system_index.rb +30 -1
- data/lib/fontist/version.rb +1 -1
- metadata +59 -8
- data/.github/workflows/deploy-pages.yml +0 -54
- data/docs/guide/api-ruby.md +0 -189
- data/docs/public/hero.png +0 -0
- data/docs/public/logo.png +0 -0
- data/docs/reference/index.md +0 -143
- /data/{docs/google-fonts-multi-format-usage.md → google-fonts-multi-format-usage.md} +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import DefaultTheme from "vitepress/theme";
|
|
2
|
+
import "./style.css";
|
|
3
|
+
import WithinHero from "./components/WithinHero.vue";
|
|
4
|
+
import HeroCodeBlock from "./components/HeroCodeBlock.vue";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
extends: DefaultTheme,
|
|
8
|
+
enhanceApp({ app }) {
|
|
9
|
+
app.component("WithinHero", WithinHero);
|
|
10
|
+
app.component("HeroCodeBlock", HeroCodeBlock);
|
|
11
|
+
},
|
|
12
|
+
};
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
/* Brand Colors from Logo */
|
|
3
|
+
--fontist-rose: #bf4e6a;
|
|
4
|
+
--fontist-rose-light: #d4718a;
|
|
5
|
+
--fontist-dark: #4d4b54;
|
|
6
|
+
--fontist-gray: #676565;
|
|
7
|
+
--fontist-cream: #e1dfd2;
|
|
8
|
+
--fontist-beige: #bebbac;
|
|
9
|
+
--fontist-pale: #dddac8;
|
|
10
|
+
|
|
11
|
+
/* VitePress Theme Overrides - Light Mode */
|
|
12
|
+
--vp-c-brand-1: var(--fontist-rose);
|
|
13
|
+
--vp-c-brand-2: #a3435a;
|
|
14
|
+
--vp-c-brand-3: var(--fontist-dark);
|
|
15
|
+
--vp-c-brand-soft: rgba(191, 78, 106, 0.14);
|
|
16
|
+
|
|
17
|
+
/* Text Colors */
|
|
18
|
+
--vp-c-text-1: var(--fontist-dark);
|
|
19
|
+
--vp-c-text-2: var(--fontist-gray);
|
|
20
|
+
--vp-c-text-3: #8a8888;
|
|
21
|
+
|
|
22
|
+
/* Background Colors */
|
|
23
|
+
--vp-c-bg-soft: #f8f7f4;
|
|
24
|
+
--vp-c-bg-alt: #f2f1ed;
|
|
25
|
+
--vp-c-bg: #ffffff;
|
|
26
|
+
|
|
27
|
+
/* Hero */
|
|
28
|
+
--vp-home-hero-name-color: var(--fontist-rose);
|
|
29
|
+
--vp-home-hero-name-background: linear-gradient(
|
|
30
|
+
120deg,
|
|
31
|
+
var(--fontist-rose) 30%,
|
|
32
|
+
#d4718a
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
/* Buttons */
|
|
36
|
+
--vp-button-brand-border: var(--fontist-rose);
|
|
37
|
+
--vp-button-brand-text: #ffffff;
|
|
38
|
+
--vp-button-brand-bg: var(--fontist-rose);
|
|
39
|
+
--vp-button-brand-hover-border: #a3435a;
|
|
40
|
+
--vp-button-brand-hover-text: #ffffff;
|
|
41
|
+
--vp-button-brand-hover-bg: #a3435a;
|
|
42
|
+
--vp-button-brand-active-border: #8a3849;
|
|
43
|
+
--vp-button-brand-active-text: #ffffff;
|
|
44
|
+
--vp-button-brand-active-bg: #8a3849;
|
|
45
|
+
|
|
46
|
+
/* Sidebar */
|
|
47
|
+
--vp-sidebar-bg-color: var(--vp-c-bg-soft);
|
|
48
|
+
|
|
49
|
+
/* Nav */
|
|
50
|
+
--vp-nav-bg-color: var(--vp-c-bg);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* Dark Mode */
|
|
54
|
+
html.dark {
|
|
55
|
+
--vp-c-brand-1: var(--fontist-rose-light);
|
|
56
|
+
--vp-c-brand-2: var(--fontist-rose);
|
|
57
|
+
--vp-c-brand-3: #e1dfd2;
|
|
58
|
+
--vp-c-brand-soft: rgba(212, 113, 138, 0.14);
|
|
59
|
+
|
|
60
|
+
/* Text Colors - Dark Mode */
|
|
61
|
+
--vp-c-text-1: #e1dfd2;
|
|
62
|
+
--vp-c-text-2: #bebbac;
|
|
63
|
+
--vp-c-text-3: #8a8888;
|
|
64
|
+
|
|
65
|
+
/* Background Colors - Dark Mode */
|
|
66
|
+
--vp-c-bg: #1a1918;
|
|
67
|
+
--vp-c-bg-soft: #222120;
|
|
68
|
+
--vp-c-bg-alt: #2a2826;
|
|
69
|
+
--vp-c-bg-elv: #2a2826;
|
|
70
|
+
|
|
71
|
+
/* Hero - Dark Mode */
|
|
72
|
+
--vp-home-hero-name-background: linear-gradient(
|
|
73
|
+
120deg,
|
|
74
|
+
var(--fontist-rose-light) 30%,
|
|
75
|
+
#e08a9e
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
/* Buttons - Dark Mode */
|
|
79
|
+
--vp-button-brand-border: var(--fontist-rose-light);
|
|
80
|
+
--vp-button-brand-text: #1a1918;
|
|
81
|
+
--vp-button-brand-bg: var(--fontist-rose-light);
|
|
82
|
+
--vp-button-brand-hover-border: var(--fontist-rose);
|
|
83
|
+
--vp-button-brand-hover-text: #1a1918;
|
|
84
|
+
--vp-button-brand-hover-bg: var(--fontist-rose);
|
|
85
|
+
--vp-button-brand-active-border: #a3435a;
|
|
86
|
+
--vp-button-brand-active-text: #1a1918;
|
|
87
|
+
--vp-button-brand-active-bg: #a3435a;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* Feature cards on home page - Light */
|
|
91
|
+
.VPFeature .title {
|
|
92
|
+
color: var(--fontist-dark);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.VPFeature .details {
|
|
96
|
+
color: var(--fontist-gray);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.VPFeature:hover {
|
|
100
|
+
border-color: var(--fontist-rose);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* Feature cards - Dark */
|
|
104
|
+
html.dark .VPFeature .title {
|
|
105
|
+
color: var(--fontist-cream);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
html.dark .VPFeature .details {
|
|
109
|
+
color: var(--fontist-beige);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* Links */
|
|
113
|
+
.vp-doc a {
|
|
114
|
+
color: var(--fontist-rose);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.vp-doc a:hover {
|
|
118
|
+
color: #a3435a;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
html.dark .vp-doc a {
|
|
122
|
+
color: var(--fontist-rose-light);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
html.dark .vp-doc a:hover {
|
|
126
|
+
color: var(--fontist-rose);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/* Footer */
|
|
130
|
+
.VPFooter {
|
|
131
|
+
background-color: var(--vp-c-bg-soft);
|
|
132
|
+
border-top: 1px solid var(--fontist-pale);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
html.dark .VPFooter {
|
|
136
|
+
border-top-color: #3a3836;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/* Code blocks - Light */
|
|
140
|
+
.vp-doc [class*="language-"] {
|
|
141
|
+
background-color: var(--fontist-dark);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/* Code blocks - Dark */
|
|
145
|
+
html.dark .vp-doc [class*="language-"] {
|
|
146
|
+
background-color: #0d0c0c;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/* Logo sizing */
|
|
150
|
+
.VPNav .VPImage {
|
|
151
|
+
height: 39px;
|
|
152
|
+
}
|
data/docs/api/errors.md
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Fontist::Errors
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Fontist::Errors
|
|
6
|
+
|
|
7
|
+
Fontist raises specific errors for various failure conditions. Understanding these errors helps you handle exceptions gracefully in your applications.
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
All Fontist errors inherit from `Fontist::Errors::FontistError`, which is the base error class.
|
|
12
|
+
|
|
13
|
+
## Error Classes
|
|
14
|
+
|
|
15
|
+
### `Fontist::Errors::FontistError`
|
|
16
|
+
|
|
17
|
+
The base error class for all Fontist errors.
|
|
18
|
+
|
|
19
|
+
**Inherits from:** `StandardError`
|
|
20
|
+
|
|
21
|
+
**Usage:**
|
|
22
|
+
|
|
23
|
+
```ruby
|
|
24
|
+
begin
|
|
25
|
+
Fontist::Font.find("NonExistent")
|
|
26
|
+
rescue Fontist::Errors::FontistError => e
|
|
27
|
+
puts "Fontist error: #{e.message}"
|
|
28
|
+
end
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
### `Fontist::Errors::UnsupportedFontError`
|
|
34
|
+
|
|
35
|
+
Raised when a requested font is not supported by Fontist.
|
|
36
|
+
|
|
37
|
+
**When raised:**
|
|
38
|
+
- Font name is not found in any formula
|
|
39
|
+
- Font is not available for installation
|
|
40
|
+
|
|
41
|
+
**Example:**
|
|
42
|
+
|
|
43
|
+
```ruby
|
|
44
|
+
begin
|
|
45
|
+
Fontist::Font.install("Unknown Font")
|
|
46
|
+
rescue Fontist::Errors::UnsupportedFontError => e
|
|
47
|
+
puts "Font not supported: #{e.message}"
|
|
48
|
+
end
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
### `Fontist::Errors::MissingFontError`
|
|
54
|
+
|
|
55
|
+
Raised when a required font is not installed on the system.
|
|
56
|
+
|
|
57
|
+
**When raised:**
|
|
58
|
+
- Font is supported but not installed
|
|
59
|
+
- Font files are missing or corrupted
|
|
60
|
+
|
|
61
|
+
**Example:**
|
|
62
|
+
|
|
63
|
+
```ruby
|
|
64
|
+
begin
|
|
65
|
+
Fontist::Font.find("Supported But Not Installed")
|
|
66
|
+
rescue Fontist::Errors::MissingFontError => e
|
|
67
|
+
puts "Font needs to be installed: #{e.message}"
|
|
68
|
+
end
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
### `Fontist::Errors::LicensingError`
|
|
74
|
+
|
|
75
|
+
Raised when there is an issue with font licensing.
|
|
76
|
+
|
|
77
|
+
**When raised:**
|
|
78
|
+
- Font requires license confirmation but none provided
|
|
79
|
+
- License terms are not accepted
|
|
80
|
+
|
|
81
|
+
**Example:**
|
|
82
|
+
|
|
83
|
+
```ruby
|
|
84
|
+
begin
|
|
85
|
+
Fontist::Font.install("Licensed Font", confirmation: "no")
|
|
86
|
+
rescue Fontist::Errors::LicensingError => e
|
|
87
|
+
puts "License issue: #{e.message}"
|
|
88
|
+
# Prompt user for license acceptance
|
|
89
|
+
Fontist::Font.install("Licensed Font", confirmation: "yes")
|
|
90
|
+
end
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
### `Fontist::Errors::DownloadError`
|
|
96
|
+
|
|
97
|
+
Raised when font download fails.
|
|
98
|
+
|
|
99
|
+
**When raised:**
|
|
100
|
+
- Network connection issues
|
|
101
|
+
- Source URL is unavailable
|
|
102
|
+
- Downloaded file is corrupted
|
|
103
|
+
|
|
104
|
+
**Example:**
|
|
105
|
+
|
|
106
|
+
```ruby
|
|
107
|
+
begin
|
|
108
|
+
Fontist::Font.install("Some Font")
|
|
109
|
+
rescue Fontist::Errors::DownloadError => e
|
|
110
|
+
puts "Download failed: #{e.message}"
|
|
111
|
+
# Retry or use alternative source
|
|
112
|
+
end
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
### `Fontist::Errors::InstallationError`
|
|
118
|
+
|
|
119
|
+
Raised when font installation fails.
|
|
120
|
+
|
|
121
|
+
**When raised:**
|
|
122
|
+
- Insufficient disk space
|
|
123
|
+
- Permission denied
|
|
124
|
+
- Archive extraction fails
|
|
125
|
+
|
|
126
|
+
**Example:**
|
|
127
|
+
|
|
128
|
+
```ruby
|
|
129
|
+
begin
|
|
130
|
+
Fontist::Font.install("Some Font")
|
|
131
|
+
rescue Fontist::Errors::InstallationError => e
|
|
132
|
+
puts "Installation failed: #{e.message}"
|
|
133
|
+
end
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
### `Fontist::Errors::FormulaNotFoundError`
|
|
139
|
+
|
|
140
|
+
Raised when a formula cannot be found.
|
|
141
|
+
|
|
142
|
+
**When raised:**
|
|
143
|
+
- Formula file is missing
|
|
144
|
+
- Formula registry is corrupted
|
|
145
|
+
|
|
146
|
+
**Example:**
|
|
147
|
+
|
|
148
|
+
```ruby
|
|
149
|
+
begin
|
|
150
|
+
Fontist::Formula.find("Unknown")
|
|
151
|
+
rescue Fontist::Errors::FormulaNotFoundError => e
|
|
152
|
+
puts "Formula not found: #{e.message}"
|
|
153
|
+
end
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Error Handling Best Practices
|
|
157
|
+
|
|
158
|
+
### Catching Specific Errors
|
|
159
|
+
|
|
160
|
+
```ruby
|
|
161
|
+
begin
|
|
162
|
+
Fontist::Font.install("Calibri", confirmation: "yes")
|
|
163
|
+
rescue Fontist::Errors::UnsupportedFontError
|
|
164
|
+
puts "This font is not supported"
|
|
165
|
+
rescue Fontist::Errors::LicensingError
|
|
166
|
+
puts "License acceptance required"
|
|
167
|
+
rescue Fontist::Errors::DownloadError
|
|
168
|
+
puts "Failed to download font"
|
|
169
|
+
rescue Fontist::Errors::InstallationError
|
|
170
|
+
puts "Failed to install font"
|
|
171
|
+
end
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Catching All Fontist Errors
|
|
175
|
+
|
|
176
|
+
```ruby
|
|
177
|
+
begin
|
|
178
|
+
Fontist::Font.install("Calibri", confirmation: "yes")
|
|
179
|
+
rescue Fontist::Errors::FontistError => e
|
|
180
|
+
puts "Fontist operation failed: #{e.message}"
|
|
181
|
+
end
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Checking Font Availability
|
|
185
|
+
|
|
186
|
+
```ruby
|
|
187
|
+
# Check if font is supported before installing
|
|
188
|
+
begin
|
|
189
|
+
Fontist::Font.find("Open Sans")
|
|
190
|
+
rescue Fontist::Errors::UnsupportedFontError
|
|
191
|
+
puts "Font not supported by Fontist"
|
|
192
|
+
end
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Error Class Hierarchy
|
|
196
|
+
|
|
197
|
+
```
|
|
198
|
+
StandardError
|
|
199
|
+
└── Fontist::Errors::FontistError
|
|
200
|
+
├── UnsupportedFontError
|
|
201
|
+
├── MissingFontError
|
|
202
|
+
├── LicensingError
|
|
203
|
+
├── DownloadError
|
|
204
|
+
├── InstallationError
|
|
205
|
+
└── FormulaNotFoundError
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## See Also
|
|
209
|
+
|
|
210
|
+
- [Fontist::Font](/api/font) — Font installation and lookup
|
|
211
|
+
- [Exit Codes](/cli/exit-codes) — CLI exit codes for errors
|
data/docs/api/font.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Fontist::Font
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Fontist::Font
|
|
6
|
+
|
|
7
|
+
The `Fontist::Font` is your go-to place to deal with any font using Fontist. This interface allows you to find a font or install a font.
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
The Font class provides methods to:
|
|
12
|
+
- Find fonts installed on your system
|
|
13
|
+
- Install new fonts from supported sources
|
|
14
|
+
- List all supported fonts
|
|
15
|
+
|
|
16
|
+
It searches in operating system specific font directories and the fontist specific `~/.fontist` directory.
|
|
17
|
+
|
|
18
|
+
## Class Methods
|
|
19
|
+
|
|
20
|
+
### `.find(name)`
|
|
21
|
+
|
|
22
|
+
Find a font in your system.
|
|
23
|
+
|
|
24
|
+
**Parameters:**
|
|
25
|
+
|
|
26
|
+
| Param | Type | Description |
|
|
27
|
+
|-------|------|-------------|
|
|
28
|
+
| `name` | String | The name of the font to find |
|
|
29
|
+
|
|
30
|
+
**Returns:** `Array<String>` — Paths to the font files
|
|
31
|
+
|
|
32
|
+
**Raises:**
|
|
33
|
+
- `Fontist::Errors::UnsupportedFontError` — If the font is not supported
|
|
34
|
+
- May trigger display of installation instructions for the specific font
|
|
35
|
+
|
|
36
|
+
**Example:**
|
|
37
|
+
|
|
38
|
+
```ruby
|
|
39
|
+
paths = Fontist::Font.find("Calibri")
|
|
40
|
+
# => ["/Users/user/.fontist/fonts/calibri.ttf"]
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
### `.install(name, confirmation: "no")`
|
|
46
|
+
|
|
47
|
+
Install any supported font.
|
|
48
|
+
|
|
49
|
+
This interface first checks if you already have that font installed. If you do, it returns the paths. If you don't have the font but it is supported by Fontist, it will download the font, copy it to `~/.fontist` directory, and return the paths.
|
|
50
|
+
|
|
51
|
+
**Parameters:**
|
|
52
|
+
|
|
53
|
+
| Param | Type | Description |
|
|
54
|
+
|-------|------|-------------|
|
|
55
|
+
| `name` | String | The name of the font to install |
|
|
56
|
+
| `confirmation` | String | License confirmation, use `"yes"` to accept license |
|
|
57
|
+
|
|
58
|
+
**Returns:** `Array<String>` — Paths to the installed font files
|
|
59
|
+
|
|
60
|
+
**Raises:**
|
|
61
|
+
- `Fontist::Errors::UnsupportedFontError` — If the font is not supported
|
|
62
|
+
- `Fontist::Errors::LicensingError` — If license requires confirmation
|
|
63
|
+
|
|
64
|
+
**Example:**
|
|
65
|
+
|
|
66
|
+
```ruby
|
|
67
|
+
# Install with license acceptance
|
|
68
|
+
paths = Fontist::Font.install("Open Sans", confirmation: "yes")
|
|
69
|
+
# => ["/Users/user/.fontist/fonts/OpenSans-Regular.ttf"]
|
|
70
|
+
|
|
71
|
+
# Install without license acceptance (may fail for licensed fonts)
|
|
72
|
+
paths = Fontist::Font.install("Open Sans", confirmation: "no")
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
### `.all`
|
|
78
|
+
|
|
79
|
+
List all supported fonts.
|
|
80
|
+
|
|
81
|
+
This might be useful if you want to know the name of the font or the available styles.
|
|
82
|
+
|
|
83
|
+
**Parameters:** None
|
|
84
|
+
|
|
85
|
+
**Returns:** `Array<Fontist::FontModel>` — Model objects representing supported fonts
|
|
86
|
+
|
|
87
|
+
**Example:**
|
|
88
|
+
|
|
89
|
+
```ruby
|
|
90
|
+
fonts = Fontist::Font.all
|
|
91
|
+
fonts.each do |font|
|
|
92
|
+
puts font.name
|
|
93
|
+
puts font.styles
|
|
94
|
+
end
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## See Also
|
|
98
|
+
|
|
99
|
+
- [Fontist::Formula](/api/formula) — Access formula information for fonts
|
|
100
|
+
- [Fontist::Manifest](/api/manifest) — Work with multiple fonts via manifest
|
|
101
|
+
- [Fontist::Errors](/api/errors) — Error handling
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Fontist::Fontconfig
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Fontist::Fontconfig
|
|
6
|
+
|
|
7
|
+
Fontist supports integration with Fontconfig via the Ruby interface.
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
Fontconfig is a system for customizing and configuring font access. Fontist can update Fontconfig to detect fontist-managed fonts, allowing applications that use Fontconfig to find fonts installed by Fontist.
|
|
12
|
+
|
|
13
|
+
## Class Methods
|
|
14
|
+
|
|
15
|
+
### `.update`
|
|
16
|
+
|
|
17
|
+
Update Fontconfig to let it detect fontist fonts.
|
|
18
|
+
|
|
19
|
+
**Parameters:** None
|
|
20
|
+
|
|
21
|
+
**Returns:** `Boolean` — Success status
|
|
22
|
+
|
|
23
|
+
**Example:**
|
|
24
|
+
|
|
25
|
+
```ruby
|
|
26
|
+
Fontist::Fontconfig.update
|
|
27
|
+
# => true
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
This makes fonts installed by Fontist visible to applications that use Fontconfig for font discovery.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
### `.remove(force: false)`
|
|
35
|
+
|
|
36
|
+
Disable detection of fontist fonts in Fontconfig.
|
|
37
|
+
|
|
38
|
+
**Parameters:**
|
|
39
|
+
|
|
40
|
+
| Param | Type | Description |
|
|
41
|
+
|-------|------|-------------|
|
|
42
|
+
| `force` | Boolean | If true, do not fail if no config exists |
|
|
43
|
+
|
|
44
|
+
**Returns:** `Boolean` — Success status
|
|
45
|
+
|
|
46
|
+
**Raises:** Error if config doesn't exist and `force` is `false`
|
|
47
|
+
|
|
48
|
+
**Example:**
|
|
49
|
+
|
|
50
|
+
```ruby
|
|
51
|
+
# Remove fontconfig integration
|
|
52
|
+
Fontist::Fontconfig.remove
|
|
53
|
+
|
|
54
|
+
# Remove without failing if config doesn't exist
|
|
55
|
+
Fontist::Fontconfig.remove(force: true)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Typical Usage
|
|
59
|
+
|
|
60
|
+
A common workflow when working with Fontconfig integration:
|
|
61
|
+
|
|
62
|
+
```ruby
|
|
63
|
+
# Install a font
|
|
64
|
+
Fontist::Font.install("Open Sans", confirmation: "yes")
|
|
65
|
+
|
|
66
|
+
# Update Fontconfig to detect the new font
|
|
67
|
+
Fontist::Fontconfig.update
|
|
68
|
+
|
|
69
|
+
# Now applications using Fontconfig can find the font
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
When you no longer need Fontist fonts to be visible:
|
|
73
|
+
|
|
74
|
+
```ruby
|
|
75
|
+
# Remove Fontconfig integration
|
|
76
|
+
Fontist::Fontconfig.remove
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## See Also
|
|
80
|
+
|
|
81
|
+
- [Fontist::Font](/api/font) — Font installation
|
|
82
|
+
- [Fontconfig CLI Reference](/cli/fontconfig) — Command-line interface
|
data/docs/api/formula.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Fontist::Formula
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Fontist::Formula
|
|
6
|
+
|
|
7
|
+
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 formulas directly, you shouldn't need to work with this interface.
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
Formulas contain the metadata and installation instructions for fonts. Each formula describes:
|
|
12
|
+
- Font names and styles available
|
|
13
|
+
- Download sources
|
|
14
|
+
- License information
|
|
15
|
+
- Extraction and installation steps
|
|
16
|
+
|
|
17
|
+
## Class Methods
|
|
18
|
+
|
|
19
|
+
### `.find(font_name)`
|
|
20
|
+
|
|
21
|
+
Find a registered formula by font name. This interface takes a font name as an argument and looks through each of the registered formulas that offer this font installation.
|
|
22
|
+
|
|
23
|
+
**Parameters:**
|
|
24
|
+
|
|
25
|
+
| Param | Type | Description |
|
|
26
|
+
|-------|------|-------------|
|
|
27
|
+
| `font_name` | String | The name of the font to find a formula for |
|
|
28
|
+
|
|
29
|
+
**Returns:** `Fontist::Formula` — The formula object for the font
|
|
30
|
+
|
|
31
|
+
**Example:**
|
|
32
|
+
|
|
33
|
+
```ruby
|
|
34
|
+
formula = Fontist::Formula.find("Calibri")
|
|
35
|
+
# => #<Fontist::Formula @name="calibri", ...>
|
|
36
|
+
|
|
37
|
+
# Access formula properties
|
|
38
|
+
puts formula.fonts
|
|
39
|
+
puts formula.license
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
### `.find_fonts(font_name)`
|
|
45
|
+
|
|
46
|
+
List font styles supported by a formula. Normally, each font name can be associated with multiple styles or collections (e.g., `regular`, `bold`, `italic`).
|
|
47
|
+
|
|
48
|
+
**Parameters:**
|
|
49
|
+
|
|
50
|
+
| Param | Type | Description |
|
|
51
|
+
|-------|------|-------------|
|
|
52
|
+
| `font_name` | String | The name of the font to find styles for |
|
|
53
|
+
|
|
54
|
+
**Returns:** `Array<Fontist::Font>` — List of font objects with their styles
|
|
55
|
+
|
|
56
|
+
**Example:**
|
|
57
|
+
|
|
58
|
+
```ruby
|
|
59
|
+
fonts = Fontist::Formula.find_fonts("Calibri")
|
|
60
|
+
fonts.each do |font|
|
|
61
|
+
puts "#{font.name} - #{font.style}"
|
|
62
|
+
end
|
|
63
|
+
# Calibri - Regular
|
|
64
|
+
# Calibri - Bold
|
|
65
|
+
# Calibri - Italic
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
### `.all`
|
|
71
|
+
|
|
72
|
+
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.
|
|
73
|
+
|
|
74
|
+
**Parameters:** None
|
|
75
|
+
|
|
76
|
+
**Returns:** `Array<Fontist::Formula>` — Model objects representing all registered formulas
|
|
77
|
+
|
|
78
|
+
**Example:**
|
|
79
|
+
|
|
80
|
+
```ruby
|
|
81
|
+
formulas = Fontist::Formula.all
|
|
82
|
+
formulas.each do |formula|
|
|
83
|
+
puts formula.name
|
|
84
|
+
puts formula.fonts.map(&:name)
|
|
85
|
+
end
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Formula Properties
|
|
89
|
+
|
|
90
|
+
When you retrieve a formula object, you can access various properties:
|
|
91
|
+
|
|
92
|
+
| Property | Type | Description |
|
|
93
|
+
|----------|------|-------------|
|
|
94
|
+
| `name` | String | The formula identifier |
|
|
95
|
+
| `fonts` | Array | List of fonts provided by this formula |
|
|
96
|
+
| `license` | String | License information |
|
|
97
|
+
| `homepage` | String | URL to font homepage |
|
|
98
|
+
| `description` | String | Description of the font |
|
|
99
|
+
|
|
100
|
+
## See Also
|
|
101
|
+
|
|
102
|
+
- [Fontist::Font](/api/font) — Font installation and lookup
|
|
103
|
+
- [Fontist::Manifest](/api/manifest) — Work with multiple fonts
|
data/docs/api/index.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: API Reference
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Fontist Ruby API
|
|
6
|
+
|
|
7
|
+
Fontist can be used as a Ruby library for programmatic font management.
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
The Fontist Ruby API provides interfaces for:
|
|
12
|
+
- **Fontist::Font** — Find and install fonts
|
|
13
|
+
- **Fontist::Formula** — Access formula information
|
|
14
|
+
- **Fontist::Manifest** — Work with font manifests
|
|
15
|
+
- **Fontist::Fontconfig** — Integrate with fontconfig
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
Add to your Gemfile:
|
|
20
|
+
|
|
21
|
+
```ruby
|
|
22
|
+
gem 'fontist'
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Or install directly:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
gem install fontist
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Quick Example
|
|
32
|
+
|
|
33
|
+
```ruby
|
|
34
|
+
require 'fontist'
|
|
35
|
+
|
|
36
|
+
# Find a font
|
|
37
|
+
paths = Fontist::Font.find("Open Sans")
|
|
38
|
+
|
|
39
|
+
# Install a font
|
|
40
|
+
paths = Fontist::Font.install("Open Sans", confirmation: "yes")
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Next Steps
|
|
44
|
+
|
|
45
|
+
- [Fontist::Font](/api/font) — Font installation and lookup
|
|
46
|
+
- [Fontist::Formula](/api/formula) — Formula information
|
|
47
|
+
- [Fontist::Manifest](/api/manifest) — Manifest handling
|
|
48
|
+
- [Fontist::Fontconfig](/api/fontconfig) — Fontconfig integration
|
|
49
|
+
- [Fontist::Errors](/api/errors) — Error handling
|