fontist 3.0.41 → 3.0.43

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.
data/TODO.fontist-v5.md DELETED
@@ -1,196 +0,0 @@
1
- # Fontist v5 Schema Implementation Plan
2
-
3
- ## Overview
4
-
5
- This document outlines the implementation plan for Formula Schema v5 with
6
- multi-format font support. The architecture uses **v5-only classes** -
7
- migration from v4 to v5 is handled by a separate migration script.
8
-
9
- ## Architecture
10
-
11
- ### Core Principle: v5 Only
12
-
13
- All formula classes now use v5 schema with:
14
- - `schema_version: 5` (default)
15
- - Format metadata on resources (`format`, `variable_axes`)
16
- - Format metadata on styles (`formats`, `variable_font`, `variable_axes`)
17
-
18
- ### Class Hierarchy
19
-
20
- ```
21
- Formula (v5 only)
22
- ├── schema_version: 5
23
- ├── resources: ResourceCollection
24
- │ └── Resource
25
- │ ├── format: string (ttf, otf, woff, woff2, ttc, otc, dfont)
26
- │ └── variable_axes: array (e.g., ["wght", "wdth"])
27
- ├── fonts: FontModel[]
28
- │ └── styles: FontStyle[]
29
- │ ├── formats: array
30
- │ ├── variable_font: boolean
31
- │ └── variable_axes: array
32
- └── font_collections: FontCollection[]
33
- ```
34
-
35
- ## Implementation Status
36
-
37
- ### Phase 1: Core Models ✅ DONE
38
-
39
- - [x] FormatSpec model (`lib/fontist/format_spec.rb`)
40
- - [x] FormatMatcher service (`lib/fontist/format_matcher.rb`)
41
- - [x] FontFinder service (`lib/fontist/font_finder.rb`)
42
- - [x] v5-only Formula class (`lib/fontist/formula.rb`)
43
- - [x] v5-only Resource class (`lib/fontist/resource.rb`)
44
- - [x] v5-only FontStyle class (`lib/fontist/font_style.rb`)
45
- - [x] ResourceCollection class (`lib/fontist/resource_collection.rb`)
46
- - [x] All 65 tests passing
47
-
48
- ### Phase 2: Import System Fixes ✅ DONE
49
-
50
- #### Importer Format Metadata Status
51
-
52
- | Importer | format in resources | variable_axes | Status |
53
- |----------|-------------------|---------------|--------|
54
- | Google V5 | ✅ Dynamic | ✅ Yes | DONE |
55
- | Google V4 | ✅ Hardcoded "ttf" | ⚠️ Skipped | N/A |
56
- | macOS | ✅ Via CreateFormula | ✅ Via CreateFormula | DONE |
57
- | SIL | ✅ Via CreateFormula | ✅ Via CreateFormula | DONE |
58
-
59
- #### Tasks
60
-
61
- - [x] Fix `CreateFormula` class to detect and add format metadata
62
- - [x] macOS importer uses CreateFormula (now has format detection)
63
- - [x] SIL importer uses CreateFormula (now has format detection)
64
- - [x] Verify Google V5 importer works correctly
65
-
66
- ### Phase 3: Migration Script ✅ DONE
67
-
68
- Create `lib/fontist/import/v4_to_v5_migrator.rb`: ✅ Created
69
-
70
- Migration features:
71
- - [x] Reads v4 YAML
72
- - [x] Adds schema_version: 5
73
- - [x] Detects format from file extensions
74
- - [x] Detects variable fonts from filename patterns
75
- - [x] Writes v5 YAML
76
- - [x] CLI command: `fontist migrate-formulas INPUT [OUTPUT]`
77
-
78
- ### Phase 4: Run Imports ✅ DONE (via migration)
79
-
80
- All existing formulas migrated to v5 schema. Fresh imports can be run if needed:
81
-
82
- ```bash
83
- # Google Fonts (if fresh import needed)
84
- fontist import google --schema-version=5 --output-path=./Formulas/google --force
85
-
86
- # macOS Fonts (if fresh import needed)
87
- fontist import macos --schema-version=5 --output-path=./Formulas/macos --force
88
-
89
- # SIL Fonts (if fresh import needed)
90
- fontist import sil --schema-version=5 --output-path=./Formulas/sil --force
91
- ```
92
-
93
- ### Phase 5: Migrate Existing Formulas ✅ DONE
94
-
95
- ```bash
96
- # Run migration on all existing v4 formulas
97
- fontist migrate-formulas ../formulas/Formulas ../formulas/Formulas --verbose
98
- ```
99
-
100
- Results:
101
- - Migrated: 3206 formulas
102
- - Skipped (already v5): 474 formulas
103
- - Failed: 1 (malformed YAML backup file)
104
- - Total time: ~5 seconds
105
-
106
- ## Critical Files
107
-
108
- ### Core Classes (v5 only)
109
-
110
- | File | Description | Status |
111
- |------|-------------|--------|
112
- | `lib/fontist/formula.rb` | v5 formula with schema_version | ✅ Done |
113
- | `lib/fontist/resource.rb` | Resource with format/variable_axes | ✅ Done |
114
- | `lib/fontist/resource_collection.rb` | Resource collection | ✅ Done |
115
- | `lib/fontist/font_style.rb` | FontStyle with format metadata | ✅ Done |
116
- | `lib/fontist/font_model.rb` | FontModel using FontStyle | ✅ Done |
117
- | `lib/fontist/font_collection.rb` | FontCollection using FontModel | ✅ Done |
118
-
119
- ### Services
120
-
121
- | File | Description | Status |
122
- |------|-------------|--------|
123
- | `lib/fontist/format_spec.rb` | FormatSpec model | ✅ Done |
124
- | `lib/fontist/format_matcher.rb` | Format matching service | ✅ Done |
125
- | `lib/fontist/font_finder.rb` | Font discovery by capabilities | ✅ Done |
126
-
127
- ### Import System
128
-
129
- | File | Description | Status |
130
- |------|-------------|--------|
131
- | `lib/fontist/import/create_formula.rb` | Generic formula creator | ✅ Fixed |
132
- | `lib/fontist/import/formula_builder.rb` | Base formula builder | ✅ Works |
133
- | `lib/fontist/import/google/formula_builder_v5.rb` | Google V5 builder | ✅ Done |
134
- | `lib/fontist/import/macos_importer.rb` | macOS importer | ✅ Works |
135
- | `lib/fontist/import/sil_importer.rb` | SIL importer | ✅ Works |
136
- | `lib/fontist/import/v4_to_v5_migrator.rb` | Migration script | ✅ Created |
137
-
138
- ## Next Steps
139
-
140
- 1. ~~**Fix CreateFormula class**~~ - ✅ Done
141
- 2. ~~**Fix macOS importer**~~ - ✅ Works via CreateFormula
142
- 3. ~~**Fix SIL importer**~~ - ✅ Works via CreateFormula
143
- 4. ~~**Create V4→V5 migrator**~~ - ✅ Created
144
- 5. ~~**Migrate formulas**~~ - ✅ 3206 migrated, 474 skipped
145
- 6. ~~**Commit formulas**~~ - ✅ Committed to v5 branch (3cbe032)
146
- 7. ~~**Fix V5 builder for variable fonts**~~ - ✅ Done (8e0e568)
147
- 8. **Run fresh Google import** - Import with v5 schema to get WOFF2/variable fonts
148
- 9. **Verify** - Test installation with v5 formulas
149
-
150
- ## v5 Formula Example (Roboto Flex)
151
-
152
- ```yaml
153
- schema_version: 5
154
- resources:
155
- woff2_variable:
156
- format: woff2
157
- variable_axes: [GRAD, XOPQ, XTRA, YOPQ, YTAS, YTDE, YTFI, YTLC, YTUC, opsz, slnt, wdth, wght]
158
- ttf_variable:
159
- format: ttf
160
- variable_axes: [GRAD, XOPQ, XTRA, YOPQ, YTAS, YTDE, YTFI, YTLC, YTUC, opsz, slnt, wdth, wght]
161
- fonts:
162
- - styles:
163
- - variable_font: true
164
- variable_axes: [GRAD, XOPQ, XTRA, YOPQ, YTAS, YTDE, YTFI, YTLC, YTUC, opsz, slnt, wdth, wght]
165
- formats: [ttf, woff2]
166
- ```
167
-
168
- ## Breaking Changes
169
-
170
- - v4 formulas are no longer supported directly
171
- - Migration or re-import required for all formulas
172
- - All formulas must have `schema_version: 5`
173
- - Resources must have `format` field in v5
174
-
175
- ## Format Detection Logic
176
-
177
- ### File Extension → Format
178
-
179
- | Extension | Format |
180
- |-----------|--------|
181
- | .ttf | ttf |
182
- | .otf | otf |
183
- | .woff | woff |
184
- | .woff2 | woff2 |
185
- | .ttc | ttc |
186
- | .otc | otc |
187
- | .dfont | dfont |
188
-
189
- ### Filename Pattern → Variable Axes
190
-
191
- | Pattern | Axes |
192
- |---------|------|
193
- | `Font[wght].ttf` | ["wght"] |
194
- | `Font[wght,wdth].ttf` | ["wght", "wdth"] |
195
- | `Font-Variable.ttf` | Detect from font file |
196
- | `Font-VF.ttf` | Detect from font file |
data/TODO.improve-docs.md DELETED
@@ -1,114 +0,0 @@
1
- # Fontist Documentation Improvement Plan
2
-
3
- **Goal:** Achieve 100% documentation coverage of README.adoc content in docs/
4
-
5
- **Status:** ✅ Complete
6
-
7
- ---
8
-
9
- ## Phase 1: Platform-Specific Guides (Critical)
10
-
11
- ### 1.1 Create macOS Platform Guide
12
- - [x] Create `/docs/guide/platforms/macos.md`
13
- - [x] Document supplementary fonts framework
14
- - [x] Document framework versioning (Font3-Font8)
15
- - [x] Document platform tags (`macos-fontX`)
16
- - [x] Document version compatibility checking
17
- - [x] Include macOS version → framework table
18
- - [x] Add link to Fontist blog post
19
-
20
- ### 1.2 Create Windows Platform Guide
21
- - [x] Create `/docs/guide/platforms/windows.md`
22
- - [x] Document Windows font management differences
23
- - [x] Document Windows font locations
24
- - [x] Document file locking considerations
25
- - [x] Document path handling
26
- - [x] Document registry integration
27
- - [x] Document administrator privileges
28
- - [x] Include platform compatibility table
29
-
30
- ---
31
-
32
- ## Phase 2: Installation Improvements
33
-
34
- ### 2.1 Update Installation Guide
35
- - [x] Add detailed dependency table (json, brotli, seven-zip, libmspack, ffi-libarchive-binary)
36
- - [x] Add Windows RubyInstaller DevKit steps (`ridk install`)
37
- - [x] Add Git as prerequisite for update/repo commands
38
- - [x] Add note about native extension compilation
39
-
40
- ---
41
-
42
- ## Phase 3: Formula Advanced Features
43
-
44
- ### 3.1 Update Formulas Guide
45
- - [x] Add `override:` key documentation (already present)
46
- - [x] Add Frutiger fonts example (already present)
47
- - [x] Add HTTP authentication for private repos (already present)
48
- - [x] Add authorization headers example (already present)
49
- - [x] Add token scope requirements (already present)
50
-
51
- ### 3.2 Update create-formula CLI
52
- - [x] Add `--name-prefix` option with example (already documented)
53
-
54
- ---
55
-
56
- ## Phase 4: How It Works Improvements
57
-
58
- ### 4.1 Update How It Works Guide
59
- - [x] Add managed vs non-managed locations section (already present)
60
- - [x] Add font discovery behavior explanation (already present)
61
- - [x] Add import cache environment variables (already present)
62
-
63
- ---
64
-
65
- ## Phase 5: Maintainer Documentation (Clearly Marked)
66
-
67
- ### 5.1 Create Maintainer Import Guide
68
- - [x] Create `/docs/guide/maintainer/index.md`
69
- - [x] Create `/docs/guide/maintainer/import.md`
70
- - [x] Mark as "Maintainer Only" clearly
71
- - [x] Document `fontist import google` command
72
- - [x] Document Google Fonts API integration
73
- - [x] Document import source architecture
74
- - [x] Document versioned filenames
75
- - [x] Document import cache Ruby API
76
-
77
- ### 5.2 Update CLI Import Reference
78
- - [x] Add `fontist import google` to `/docs/cli/import.md` (already present)
79
- - [x] Add maintainer-only notice
80
-
81
- ---
82
-
83
- ## Phase 6: Navigation Updates
84
-
85
- ### 6.1 Update VitePress Config
86
- - [x] Add Platforms section to Guide sidebar
87
- - [x] Add Maintainer section to Guide sidebar (collapsed)
88
- - [x] Update navigation as needed
89
-
90
- ---
91
-
92
- ## Phase 7: Verification
93
-
94
- ### 7.1 Build and Test
95
- - [x] Run `npm run build` to verify no errors
96
- - [x] Run lychee link checker (manual verification with curl - lychee crashed)
97
- - [x] Verify all new pages are accessible
98
- - [x] Cross-check against README.adoc
99
-
100
- ---
101
-
102
- ## Progress Tracking
103
-
104
- | Phase | Status | Items Done | Items Total |
105
- |-------|--------|------------|-------------|
106
- | 1. Platform Guides | ✅ Complete | 14 | 14 |
107
- | 2. Installation | ✅ Complete | 4 | 4 |
108
- | 3. Formula Features | ✅ Complete | 7 | 7 |
109
- | 4. How It Works | ✅ Complete | 3 | 3 |
110
- | 5. Maintainer Docs | ✅ Complete | 10 | 10 |
111
- | 6. Navigation | ✅ Complete | 3 | 3 |
112
- | 7. Verification | ✅ Complete | 4 | 4 |
113
-
114
- **Total Progress: 45/45 items (100%)**
@@ -1,107 +0,0 @@
1
- # TODO: Fix Excavate Memory Leaks and Upgrade Fontist
2
-
3
- ## Problem
4
- Fontist CI tests pass but fail at the end with:
5
- ```
6
- failed to allocate memory (NoMemoryError)
7
- ```
8
-
9
- This happens after repeated archive extractions during test runs.
10
-
11
- ## Root Cause Analysis
12
- Memory leaks in Excavate gem due to:
13
- 1. Temp directories not cleaned up on errors
14
- 2. Incorrect `ensure`/`rescue` order in `extract_and_replace` method
15
-
16
- ## Remaining Work
17
-
18
- ### 1. Fix Excavate Gem (in /Users/mulgogi/src/fontist/excavate)
19
-
20
- #### archive.rb - Fix `extract_and_replace` method (lines 217-229)
21
- Current broken code has `ensure` BEFORE `rescue` which is invalid Ruby syntax:
22
- ```ruby
23
- def extract_and_replace(archive)
24
- target = Dir.mktmpdir
25
- extract_recursively(archive, target)
26
- replace_archive_with_contents(archive, target)
27
- ensure # <-- WRONG: ensure must come AFTER rescue
28
- FileUtils.rm_rf(target)
29
- rescue StandardError # <-- This causes syntax error
30
- raise unless TYPES.key?(normalized_extension(archive))
31
- end
32
- ```
33
-
34
- Fix - swap order so `rescue` comes before `ensure`:
35
- ```ruby
36
- def extract_and_replace(archive)
37
- target = Dir.mktmpdir
38
- extract_recursively(archive, target)
39
- replace_archive_with_contents(archive, target)
40
- rescue StandardError
41
- raise unless TYPES.key?(normalized_extension(archive))
42
- ensure
43
- FileUtils.rm_rf(target)
44
- end
45
- ```
46
-
47
- ### 2. Run Excavate Tests
48
- ```bash
49
- cd /Users/mulgogi/src/fontist/excavate
50
- bundle exec rspec
51
- ```
52
- All 65 tests should pass.
53
-
54
- ### 3. Bump Excavate Version
55
- Edit `/Users/mulgogi/src/fontist/excavate/lib/excavate/version.rb`:
56
- ```ruby
57
- VERSION = "1.0.3"
58
- ```
59
-
60
- ### 4. Commit and Push Excavate
61
- ```bash
62
- cd /Users/mulgogi/src/fontist/excavate
63
- git add -A
64
- git commit -m "fix: prevent memory leaks by ensuring proper resource cleanup
65
-
66
- - Fix extract_and_replace to use correct rescue/ensure order
67
- - Add ensure block to extract_by_filter for temp dir cleanup"
68
- git push origin main
69
- ```
70
-
71
- ### 5. Release Excavate Gem
72
- ```bash
73
- cd /Users/mulgogi/src/fontist/excavate
74
- # Tag and push to rubygems
75
- git tag v1.0.3
76
- git push --tags
77
- gem build excavate.gemspec
78
- gem push excavate-1.0.3.gem
79
- ```
80
-
81
- ### 6. Update Fontist to Use New Excavate
82
- ```bash
83
- cd /Users/mulgogi/src/fontist/fontist
84
- # Update Gemfile.lock to use excavate >= 1.0.3
85
- bundle update excavate
86
- ```
87
-
88
- ### 7. Run Fontist Tests
89
- ```bash
90
- cd /Users/mulgogi/src/fontist/fontist
91
- bundle exec rspec
92
- ```
93
- Tests should pass WITHOUT the `NoMemoryError` at the end.
94
-
95
- ### 8. Create PR and Merge
96
- - Create PR in fontist repository
97
- - Reference issue #451
98
- - Merge after CI passes
99
-
100
- ## Files Modified
101
-
102
- ### Excavate
103
- - `lib/excavate/archive.rb` - Fix `extract_and_replace` method
104
-
105
- ## Notes
106
- - Do NOT add `ensure` blocks with `reader&.close` to extractors - the Omnizip readers don't have a `close` method
107
- - The fix is simple: correct the `rescue`/`ensure` order in `extract_and_replace`