fontist 2.1.3 → 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.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/docs.yml +70 -0
  3. data/.github/workflows/links.yml +100 -0
  4. data/.gitignore +2 -1
  5. data/docs/.vitepress/config.ts +153 -32
  6. data/docs/.vitepress/data/cli-commands.json +461 -0
  7. data/docs/.vitepress/data/exit-codes.json +21 -0
  8. data/docs/.vitepress/data/features.json +44 -0
  9. data/docs/.vitepress/theme/components/HeroCodeBlock.vue +98 -0
  10. data/docs/.vitepress/theme/components/WithinHero.vue +30 -0
  11. data/docs/.vitepress/theme/index.ts +12 -0
  12. data/docs/.vitepress/theme/style.css +152 -0
  13. data/docs/api/errors.md +211 -0
  14. data/docs/api/font.md +101 -0
  15. data/docs/api/fontconfig.md +82 -0
  16. data/docs/api/formula.md +103 -0
  17. data/docs/api/index.md +49 -0
  18. data/docs/api/manifest.md +209 -0
  19. data/docs/cli/cache.md +100 -0
  20. data/docs/cli/config.md +123 -0
  21. data/docs/cli/create-formula.md +65 -0
  22. data/docs/cli/exit-codes.md +73 -0
  23. data/docs/cli/fontconfig.md +85 -0
  24. data/docs/cli/import.md +136 -0
  25. data/docs/cli/index-cmd.md +37 -0
  26. data/docs/cli/index.md +80 -0
  27. data/docs/cli/install.md +52 -0
  28. data/docs/cli/list.md +39 -0
  29. data/docs/cli/manifest.md +110 -0
  30. data/docs/cli/repo.md +142 -0
  31. data/docs/cli/status.md +39 -0
  32. data/docs/cli/uninstall.md +34 -0
  33. data/docs/cli/update.md +31 -0
  34. data/docs/cli/version.md +38 -0
  35. data/docs/components/CliCommand.vue +77 -0
  36. data/docs/components/CliExamples.vue +17 -0
  37. data/docs/components/CliOptions.vue +26 -0
  38. data/docs/components/ExitCodes.vue +18 -0
  39. data/docs/guide/ci.md +4 -0
  40. data/docs/guide/concepts/fonts.md +158 -0
  41. data/docs/guide/concepts/formats.md +234 -0
  42. data/docs/guide/concepts/index.md +109 -0
  43. data/docs/guide/concepts/licenses.md +236 -0
  44. data/docs/guide/concepts/requirements.md +388 -0
  45. data/docs/guide/concepts/variable-fonts.md +212 -0
  46. data/docs/guide/formulas.md +192 -0
  47. data/docs/guide/how-it-works.md +428 -0
  48. data/docs/guide/index.md +26 -47
  49. data/docs/guide/installation.md +105 -0
  50. data/docs/guide/manifests.md +132 -0
  51. data/docs/guide/quick-start.md +76 -0
  52. data/docs/guide/why.md +4 -0
  53. data/docs/index.md +55 -23
  54. data/docs/lychee.toml +33 -0
  55. data/docs/package-lock.json +9 -114
  56. data/docs/package.json +3 -5
  57. data/docs/public/apple-touch-icon.png +0 -0
  58. data/docs/public/favicon-96x96.png +0 -0
  59. data/docs/public/favicon.ico +0 -0
  60. data/docs/public/favicon.svg +1 -0
  61. data/docs/public/logo-full.svg +1 -0
  62. data/docs/public/logo.svg +1 -0
  63. data/docs/public/site.webmanifest +21 -0
  64. data/docs/public/web-app-manifest-192x192.png +0 -0
  65. data/docs/public/web-app-manifest-512x512.png +0 -0
  66. data/lib/fontist/cli.rb +0 -1
  67. data/lib/fontist/version.rb +1 -1
  68. metadata +58 -8
  69. data/.github/workflows/deploy-pages.yml +0 -54
  70. data/.github/workflows/release.yml.orig +0 -36
  71. data/docs/guide/api-ruby.md +0 -189
  72. data/docs/public/hero.png +0 -0
  73. data/docs/public/logo.png +0 -0
  74. data/docs/reference/index.md +0 -143
@@ -0,0 +1,236 @@
1
+ ---
2
+ title: Font Licenses
3
+ ---
4
+
5
+ # Font Licenses
6
+
7
+ **Font Licenses** define how fonts can be used, modified, and distributed. Fontist tracks license requirements and prompts for acceptance when needed.
8
+
9
+ ## License Types
10
+
11
+ ### Open Source Licenses
12
+
13
+ | License | Install | Embed | Modify | Commercial | Notes |
14
+ |---------|---------|-------|--------|------------|-------|
15
+ | SIL OFL 1.1 | ✅ | ✅ | ✅ | ✅ | Most common for fonts |
16
+ | Apache 2.0 | ✅ | ✅ | ✅ | ✅ | Google Fonts default |
17
+ | MIT | ✅ | ✅ | ✅ | ✅ | Permissive |
18
+ | GPLv2 | ✅ | ⚠️ | ✅ | ❌ | Copyleft |
19
+ | LGPL | ✅ | ✅ | ⚠️ | ✅ | Linking exception |
20
+
21
+ ### Proprietary Licenses
22
+
23
+ | License Type | Install | Embed | Modify | Commercial |
24
+ |--------------|---------|-------|--------|------------|
25
+ | Freeware | ✅ | Varies | ❌ | Varies |
26
+ | Shareware | ⚠️ | ❌ | ❌ | ❌ |
27
+ | Commercial | ⚠️ | ⚠️ | ❌ | ⚠️ |
28
+ | Bundle-only | ✅ | ✅ | ❌ | ✅ |
29
+
30
+ ---
31
+
32
+ ## SIL Open Font License (OFL)
33
+
34
+ The most common open-source font license, created specifically for fonts.
35
+
36
+ ### Key Points
37
+
38
+ - **Free to use** - No cost for any use
39
+ - **Free to share** - Redistribute freely
40
+ - **Free to modify** - Create derivative works
41
+ - **Reserved Font Name** - Some fonts restrict use of original name
42
+ - **Bundle allowed** - Include in software packages
43
+
44
+ ### OFL in Practice
45
+
46
+ ```yaml
47
+ # Example OFL font in formula
48
+ name: open-sans
49
+ license:
50
+ type: OFL-1.1
51
+ url: https://scripts.sil.org/OFL
52
+ requires_confirmation: false
53
+ ```
54
+
55
+ ---
56
+
57
+ ## Proprietary Fonts
58
+
59
+ Some fonts require license acceptance before installation.
60
+
61
+ ### Fontist License Handling
62
+
63
+ ```bash
64
+ # Fontist shows license requirements
65
+ fontist install "Calibri"
66
+
67
+ # Output:
68
+ # This font requires license acceptance.
69
+ # License: Microsoft Software License
70
+ # View license? [y/N]
71
+ ```
72
+
73
+ ### Accepting Licenses
74
+
75
+ ```bash
76
+ # For CI/CD, accept all licenses
77
+ fontist install --accept-all-licenses "Calibri"
78
+ ```
79
+
80
+ ### In Manifests
81
+
82
+ ```yaml
83
+ # Manifest with license handling
84
+ Calibri:
85
+ - Regular
86
+ - Bold
87
+
88
+ # Install with license acceptance
89
+ # fontist manifest-install --accept-all-licenses manifest.yml
90
+ ```
91
+
92
+ ---
93
+
94
+ ## License Metadata in Formulas
95
+
96
+ Formulas include license information:
97
+
98
+ ```yaml
99
+ name: example-font
100
+ description: Example font with license info
101
+ homepage: https://example.com/font
102
+
103
+ copyright:
104
+ - Copyright (c) 2026 Example Foundry
105
+
106
+ license:
107
+ type: OFL-1.1
108
+ url: https://scripts.sil.org/OFL
109
+ requires_confirmation: false
110
+
111
+ # OR for proprietary:
112
+ license:
113
+ type: Proprietary
114
+ url: https://example.com/license
115
+ requires_confirmation: true
116
+ text: |
117
+ END USER LICENSE AGREEMENT
118
+ ...
119
+ ```
120
+
121
+ ---
122
+
123
+ ## Fontist License Error Handling
124
+
125
+ ### Exit Code 4: Licensing Error
126
+
127
+ When a font requires license acceptance but it wasn't provided:
128
+
129
+ ```bash
130
+ fontist install "Some Commercial Font"
131
+ # Exit code: 4
132
+ # Error: License confirmation required
133
+ ```
134
+
135
+ ### Handling in Scripts
136
+
137
+ ```bash
138
+ #!/bin/bash
139
+ fontist install "Font Name"
140
+ case $? in
141
+ 0) echo "Success" ;;
142
+ 4) echo "License required, accepting..."
143
+ fontist install --accept-all-licenses "Font Name"
144
+ ;;
145
+ *) echo "Error: $?" ;;
146
+ esac
147
+ ```
148
+
149
+ ### In Ruby
150
+
151
+ ```ruby
152
+ begin
153
+ Fontist::Font.install("Font Name")
154
+ rescue Fontist::Errors::LicensingError
155
+ # Handle license requirement
156
+ Fontist::Font.install("Font Name", confirmation: "yes")
157
+ end
158
+ ```
159
+
160
+ ---
161
+
162
+ ## Embedding Rights
163
+
164
+ ### What is Font Embedding?
165
+
166
+ Embedding includes the font inside a document (PDF, EPUB, etc.) rather than requiring the recipient to have it installed.
167
+
168
+ ### Embedding Types
169
+
170
+ | Type | Description |
171
+ |------|-------------|
172
+ | Installable | Font can be installed and used |
173
+ | Editable | Font can be embedded for editing |
174
+ | Preview & Print | Font can be embedded for viewing only |
175
+ | Restricted | No embedding allowed |
176
+
177
+ ### Checking Embedding Rights
178
+
179
+ ```bash
180
+ # Fontisan can report embedding rights
181
+ fontisan analyze font.ttf --embedding
182
+ ```
183
+
184
+ ---
185
+
186
+ ## Common Font Sources & Licenses
187
+
188
+ | Source | License | Notes |
189
+ |--------|---------|-------|
190
+ | Google Fonts | OFL-1.1, Apache-2.0 | Free, open source |
191
+ | Adobe Fonts | Proprietary | Subscription required |
192
+ | Monotype | Proprietary | Commercial licenses |
193
+ | System fonts | Varies | OS license applies |
194
+ | Microsoft ClearType | Proprietary | Windows bundle |
195
+
196
+ ---
197
+
198
+ ## Best Practices
199
+
200
+ ### For Projects
201
+
202
+ 1. **Document font licenses** in your project
203
+ 2. **Use OFL fonts** when possible
204
+ 3. **Verify embedding rights** before PDF generation
205
+ 4. **Keep license files** alongside fonts
206
+
207
+ ### For CI/CD
208
+
209
+ 1. **Use `--accept-all-licenses`** carefully
210
+ 2. **Document which fonts** you use
211
+ 3. **Audit license compliance** periodically
212
+ 4. **Consider commercial alternatives** for proprietary fonts
213
+
214
+ ### Example: Documenting Font Usage
215
+
216
+ ```yaml
217
+ # fonts.yml with license documentation
218
+ # Project: My Documentation
219
+ # Generated: 2026-03-10
220
+
221
+ Roboto: # OFL-1.1 - https://fonts.google.com/specimen/Roboto
222
+ - Regular
223
+ - Bold
224
+
225
+ Source Code Pro: # OFL-1.1 - https://fonts.google.com/specimen/Source+Code+Pro
226
+ - Regular
227
+ ```
228
+
229
+ ---
230
+
231
+ ## See Also
232
+
233
+ - [Requirements](/guide/concepts/requirements) - Specifying font needs
234
+ - [Formulas Guide](/guide/formulas) - How formulas work
235
+ - [Exit Codes](/cli/exit-codes) - License error (code 4)
236
+ - [SIL OFL](https://scripts.sil.org/OFL) - Open Font License
@@ -0,0 +1,388 @@
1
+ ---
2
+ title: Font Requirements
3
+ ---
4
+
5
+ # Font Requirements
6
+
7
+ A **Font Requirement** specifies what fonts your project needs. This is the core abstraction that powers Fontist manifests.
8
+
9
+ ## What is a Font Requirement?
10
+
11
+ A font requirement tells Fontist:
12
+
13
+ > "I need these specific fonts in these specific styles. Do they exist? If not, install them. Return the paths."
14
+
15
+ ### Requirement Components
16
+
17
+ A complete font requirement includes:
18
+
19
+ | Component | Example | Required |
20
+ |-----------|---------|----------|
21
+ | Font name | `"Open Sans"` | Yes |
22
+ | Styles | `Regular`, `Bold` | Optional |
23
+ | Format | `ttf`, `otf` | Optional |
24
+ | Source | Specific formula | Optional |
25
+
26
+ ---
27
+
28
+ ## Manifests: Requirements in YAML
29
+
30
+ A **manifest** is a YAML file listing font requirements:
31
+
32
+ ```yaml
33
+ # manifest.yml
34
+ Open Sans:
35
+ - Regular
36
+ - Bold
37
+
38
+ Roboto Mono:
39
+ - Regular
40
+
41
+ Fira Code: [] # All styles
42
+ ```
43
+
44
+ ### How Fontist Processes a Manifest
45
+
46
+ ```
47
+ manifest.yml
48
+
49
+
50
+ ┌─────────────────┐
51
+ │ Read YAML │
52
+ │ Requirements │
53
+ └────────┬────────┘
54
+
55
+
56
+ ┌─────────────────┐
57
+ │ For each font: │
58
+ │ │
59
+ │ Check system │──▶ Found? ──▶ Return paths
60
+ │ fonts index │
61
+ └────────┬────────┘
62
+ │ Not found
63
+
64
+ ┌─────────────────┐
65
+ │ Check Fontist │──▶ Found? ──▶ Return paths
66
+ │ fonts directory │
67
+ └────────┬────────┘
68
+ │ Not found
69
+
70
+ ┌─────────────────┐
71
+ │ Search formulas │──▶ Found? ──▶ Download & Install
72
+ └────────┬────────┘
73
+
74
+
75
+ Return paths (or error)
76
+ ```
77
+
78
+ ---
79
+
80
+ ## CLI Commands
81
+
82
+ ### Install from Manifest
83
+
84
+ ```bash
85
+ # Install all fonts in manifest
86
+ fontist manifest-install manifest.yml
87
+
88
+ # With license acceptance (for CI)
89
+ fontist manifest-install --accept-all-licenses manifest.yml
90
+ ```
91
+
92
+ ### Check Without Installing
93
+
94
+ ```bash
95
+ # Check if fonts are available
96
+ fontist manifest-check manifest.yml
97
+
98
+ # Returns exit code:
99
+ # 0 = all fonts available
100
+ # 3 = some fonts missing
101
+ ```
102
+
103
+ ### Get Locations
104
+
105
+ ```bash
106
+ # Get paths to fonts (install if needed)
107
+ fontist manifest-locations manifest.yml
108
+ ```
109
+
110
+ ---
111
+
112
+ ## Manifest Format
113
+
114
+ ### Basic Format
115
+
116
+ ```yaml
117
+ Font Family Name:
118
+ - Style 1
119
+ - Style 2
120
+ ```
121
+
122
+ ### Examples
123
+
124
+ ```yaml
125
+ # Single font, single style
126
+ Helvetica:
127
+ - Regular
128
+
129
+ # Single font, multiple styles
130
+ Open Sans:
131
+ - Regular
132
+ - Bold
133
+ - Italic
134
+ - Bold Italic
135
+
136
+ # All available styles
137
+ Fira Code: []
138
+
139
+ # Multiple fonts
140
+ Roboto:
141
+ - Regular
142
+ - Bold
143
+
144
+ Roboto Mono:
145
+ - Regular
146
+ ```
147
+
148
+ ### Finding Font Names
149
+
150
+ ```bash
151
+ # Search available fonts
152
+ fontist list "Segoe"
153
+
154
+ # Check specific font
155
+ fontist status "Open Sans"
156
+ ```
157
+
158
+ ---
159
+
160
+ ## Ruby API
161
+
162
+ ### From Hash
163
+
164
+ ```ruby
165
+ manifest_hash = {
166
+ "Open Sans" => ["Regular", "Bold"],
167
+ "Roboto Mono" => ["Regular"]
168
+ }
169
+
170
+ manifest = Fontist::Manifest.from_hash(manifest_hash)
171
+ ```
172
+
173
+ ### From YAML File
174
+
175
+ ```ruby
176
+ manifest = Fontist::Manifest.from_file("fonts.yml")
177
+ ```
178
+
179
+ ### Install and Get Paths
180
+
181
+ ```ruby
182
+ # Install fonts and get locations
183
+ locations = manifest.install(confirmation: "yes")
184
+
185
+ # Result structure:
186
+ {
187
+ "Open Sans" => {
188
+ "Regular" => {
189
+ "full_name" => "Open Sans",
190
+ "paths" => ["/path/to/OpenSans-Regular.ttf"]
191
+ },
192
+ "Bold" => {
193
+ "full_name" => "Open Sans Bold",
194
+ "paths" => ["/path/to/OpenSans-Bold.ttf"]
195
+ }
196
+ }
197
+ }
198
+ ```
199
+
200
+ ### Get Locations Only
201
+
202
+ ```ruby
203
+ # Get paths without installing
204
+ locations = Fontist::Manifest.from_file("fonts.yml").locations
205
+ ```
206
+
207
+ ---
208
+
209
+ ## Use Cases
210
+
211
+ ### CI/CD Pipelines
212
+
213
+ Ensure fonts are available for document generation:
214
+
215
+ ```yaml
216
+ # .github/workflows/docs.yml
217
+ - name: Install fonts
218
+ run: |
219
+ gem install fontist
220
+ fontist manifest-install --accept-all-licenses fonts.yml
221
+
222
+ - name: Build PDFs
223
+ run: bundle exec rake build:pdfs
224
+ ```
225
+
226
+ ### Team Development
227
+
228
+ Share font requirements across team:
229
+
230
+ ```yaml
231
+ # Commit fonts.yml to repository
232
+ Source Sans Pro:
233
+ - Regular
234
+ - Bold
235
+ - Italic
236
+
237
+ # New team member runs:
238
+ fontist manifest-install fonts.yml
239
+ ```
240
+
241
+ ### Document Publishing
242
+
243
+ Ensure Metanorma/Asciidoctor fonts:
244
+
245
+ ```yaml
246
+ # fonts.yml for document publishing
247
+ Noto Serif:
248
+ - Regular
249
+ - Bold
250
+ - Italic
251
+
252
+ Source Code Pro:
253
+ - Regular
254
+ ```
255
+
256
+ ---
257
+
258
+ ## Error Handling
259
+
260
+ ### Missing Fonts
261
+
262
+ ```bash
263
+ fontist manifest-check manifest.yml
264
+ # Exit code 3: Font not found
265
+ ```
266
+
267
+ ### License Required
268
+
269
+ ```bash
270
+ fontist manifest-install manifest.yml
271
+ # Exit code 4: License needs acceptance
272
+
273
+ # Solution:
274
+ fontist manifest-install --accept-all-licenses manifest.yml
275
+ ```
276
+
277
+ ### Manifest Not Found
278
+
279
+ ```bash
280
+ fontist manifest-install missing.yml
281
+ # Exit code 5: Manifest file not found
282
+ ```
283
+
284
+ ### Invalid YAML
285
+
286
+ ```bash
287
+ fontist manifest-install invalid.yml
288
+ # Exit code 6: Manifest could not be read
289
+ ```
290
+
291
+ ---
292
+
293
+ ## Integration with Other Tools
294
+
295
+ ### Metanorma
296
+
297
+ Metanorma uses Fontist for font management:
298
+
299
+ ```ruby
300
+ # In Metanorma configuration
301
+ fontist:
302
+ manifest: fonts.yml
303
+ ```
304
+
305
+ ### Asciidoctor PDF
306
+
307
+ ```yaml
308
+ # asciidoctor-pdf-theme.yml
309
+ font:
310
+ catalog:
311
+ Open Sans:
312
+ normal: OpenSans-Regular.ttf
313
+ bold: OpenSans-Bold.ttf
314
+ ```
315
+
316
+ ### Prawn (Ruby PDF)
317
+
318
+ ```ruby
319
+ require 'fontist'
320
+
321
+ # Install font
322
+ paths = Fontist::Font.install("Open Sans", confirmation: "yes")
323
+
324
+ # Use in Prawn
325
+ Prawn::Document.generate("output.pdf") do
326
+ font paths.first
327
+ text "Hello, World!"
328
+ end
329
+ ```
330
+
331
+ ---
332
+
333
+ ## Best Practices
334
+
335
+ ### 1. Version Control Your Manifest
336
+
337
+ ```bash
338
+ git add fonts.yml
339
+ git commit -m "Add font manifest"
340
+ ```
341
+
342
+ ### 2. Document Font Sources
343
+
344
+ ```yaml
345
+ # fonts.yml
346
+ # Fonts for PDF generation
347
+ # License: All fonts are SIL OFL
348
+
349
+ Roboto: # Google Fonts, OFL-1.1
350
+ - Regular
351
+ - Bold
352
+ ```
353
+
354
+ ### 3. Use Specific Styles
355
+
356
+ ```yaml
357
+ # Good: Specific styles
358
+ Open Sans:
359
+ - Regular
360
+ - Bold
361
+
362
+ # Avoid: All styles when not needed
363
+ Open Sans: [] # Downloads everything
364
+ ```
365
+
366
+ ### 4. Handle Errors in Scripts
367
+
368
+ ```bash
369
+ #!/bin/bash
370
+ set -e
371
+
372
+ # Install fonts, handle missing fonts
373
+ if ! fontist manifest-check fonts.yml; then
374
+ echo "Some fonts not available"
375
+ exit 1
376
+ fi
377
+
378
+ fontist manifest-install --accept-all-licenses fonts.yml
379
+ ```
380
+
381
+ ---
382
+
383
+ ## See Also
384
+
385
+ - [Manifests Guide](/guide/manifests) - Detailed manifest documentation
386
+ - [CLI Reference: manifest](/cli/manifest) - Manifest commands
387
+ - [API: Fontist::Manifest](/api/manifest) - Ruby API
388
+ - [CI/CD Integration](/guide/ci) - Using Fontist in CI