fontisan 0.2.13 → 0.2.16
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/.rubocop_todo.yml +56 -196
- data/Gemfile +1 -1
- data/docs/.gitignore +17 -0
- data/docs/.vitepress/config.ts +317 -0
- data/docs/.vitepress/theme/components/ApiMethod.vue +127 -0
- data/docs/.vitepress/theme/components/Badge.vue +51 -0
- data/docs/.vitepress/theme/components/FeatureComparison.vue +87 -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 +22 -0
- data/docs/.vitepress/theme/style.css +330 -0
- data/docs/api/conversion-options.md +141 -0
- data/docs/api/converters/curve-converter.md +34 -0
- data/docs/api/converters/hint-converter.md +34 -0
- data/docs/api/converters/outline-converter.md +27 -0
- data/docs/api/font-loader.md +111 -0
- data/docs/api/font-writer.md +103 -0
- data/docs/api/index.md +79 -0
- data/docs/api/models/glyph-accessor.md +43 -0
- data/docs/api/models/glyph.md +40 -0
- data/docs/api/models/table-analyzer.md +35 -0
- data/docs/api/sfnt-font.md +53 -0
- data/docs/api/type1-font.md +43 -0
- data/docs/api/validators/font-validator.md +31 -0
- data/docs/api/validators/helper.md +36 -0
- data/docs/api/validators/profile.md +39 -0
- data/docs/cli/convert.md +87 -0
- data/docs/cli/dump-table.md +110 -0
- data/docs/cli/export.md +176 -0
- data/docs/cli/features.md +124 -0
- data/docs/cli/glyphs.md +90 -0
- data/docs/cli/index.md +208 -0
- data/docs/cli/info.md +254 -0
- data/docs/cli/instance.md +122 -0
- data/docs/cli/ls.md +95 -0
- data/docs/cli/optical-size.md +94 -0
- data/docs/cli/pack.md +125 -0
- data/docs/cli/scripts.md +105 -0
- data/docs/cli/subset.md +39 -0
- data/docs/cli/tables.md +84 -0
- data/docs/cli/unicode.md +101 -0
- data/docs/cli/validate.md +48 -0
- data/docs/cli/variable.md +126 -0
- data/docs/cli/version.md +46 -0
- data/docs/guide/cli/convert.md +108 -0
- data/docs/guide/cli/export.md +138 -0
- data/docs/guide/cli/index.md +99 -0
- data/docs/guide/cli/info.md +144 -0
- data/docs/guide/cli/pack.md +155 -0
- data/docs/guide/cli/subset.md +118 -0
- data/docs/guide/cli/validate.md +139 -0
- data/docs/guide/color-fonts/bitmaps.md +177 -0
- data/docs/guide/color-fonts/colr-cpal.md +175 -0
- data/docs/guide/color-fonts/index.md +140 -0
- data/docs/guide/color-fonts/svg.md +154 -0
- data/docs/guide/color.md +51 -0
- data/docs/guide/comparisons/font-validator.md +222 -0
- data/docs/guide/comparisons/fonttools.md +200 -0
- data/docs/guide/comparisons/index.md +83 -0
- data/docs/guide/comparisons/lcdf-typetools.md +205 -0
- data/docs/guide/contributing.md +279 -0
- data/docs/guide/conversion/collections.md +251 -0
- data/docs/guide/conversion/curves.md +246 -0
- data/docs/guide/conversion/index.md +157 -0
- data/docs/guide/conversion/options.md +251 -0
- data/docs/guide/conversion/ttf-otf.md +184 -0
- data/docs/guide/conversion/type1.md +208 -0
- data/docs/guide/conversion/web.md +240 -0
- data/docs/guide/conversion.md +39 -0
- data/docs/guide/formats/collections.md +147 -0
- data/docs/guide/formats/dfont.md +99 -0
- data/docs/guide/formats/index.md +65 -0
- data/docs/guide/formats/otf.md +103 -0
- data/docs/guide/formats/svg.md +97 -0
- data/docs/guide/formats/ttf.md +105 -0
- data/docs/guide/formats/type1.md +118 -0
- data/docs/guide/formats/woff.md +115 -0
- data/docs/guide/hinting/autohint.md +141 -0
- data/docs/guide/hinting/conversion.md +161 -0
- data/docs/guide/hinting/index.md +86 -0
- data/docs/guide/hinting/postscript.md +149 -0
- data/docs/guide/hinting/truetype.md +135 -0
- data/docs/guide/hinting.md +44 -0
- data/docs/guide/index.md +152 -0
- data/docs/guide/installation.md +116 -0
- data/docs/guide/migrations/extract-ttc.md +549 -0
- data/docs/guide/migrations/font-validator.md +260 -0
- data/docs/guide/migrations/fonttools.md +208 -0
- data/docs/guide/migrations/index.md +64 -0
- data/docs/guide/migrations/otfinfo.md +197 -0
- data/docs/guide/quick-start.md +204 -0
- data/docs/guide/type1.md +58 -0
- data/docs/guide/universal-outline.md +151 -0
- data/docs/guide/validation/custom.md +195 -0
- data/docs/guide/validation/helpers.md +188 -0
- data/docs/guide/validation/index.md +132 -0
- data/docs/guide/validation/profiles.md +156 -0
- data/docs/guide/validation.md +47 -0
- data/docs/guide/variable-fonts/advanced.md +231 -0
- data/docs/guide/variable-fonts/axes.md +209 -0
- data/docs/guide/variable-fonts/conversion.md +197 -0
- data/docs/guide/variable-fonts/index.md +84 -0
- data/docs/guide/variable-fonts/instances.md +187 -0
- data/docs/guide/variable-fonts/named-instances.md +194 -0
- data/docs/guide/variable-fonts/static.md +168 -0
- data/docs/guide/variable.md +58 -0
- data/docs/guide/woff.md +59 -0
- data/docs/index.md +136 -0
- data/docs/lychee.toml +37 -0
- data/docs/package-lock.json +2560 -0
- data/docs/package.json +15 -0
- 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/fontisan.gemspec +1 -1
- data/lib/fontisan/commands/features_command.rb +0 -1
- data/lib/fontisan/commands/info_command.rb +5 -5
- data/lib/fontisan/commands/scripts_command.rb +0 -1
- data/lib/fontisan/converters/format_converter.rb +2 -1
- data/lib/fontisan/converters/type1_converter.rb +65 -60
- data/lib/fontisan/hints/hint_converter.rb +2 -1
- data/lib/fontisan/loading_modes.rb +0 -2
- data/lib/fontisan/open_type_font.rb +0 -40
- data/lib/fontisan/sfnt_font.rb +41 -22
- data/lib/fontisan/tables/glyf/compound_glyph.rb +0 -1
- data/lib/fontisan/true_type_collection.rb +8 -8
- data/lib/fontisan/true_type_font.rb +1 -59
- data/lib/fontisan/type1/afm_parser.rb +2 -1
- data/lib/fontisan/type1/cff_to_type1_converter.rb +24 -19
- data/lib/fontisan/type1/private_dict.rb +28 -7
- data/lib/fontisan/type1/seac_expander.rb +22 -17
- data/lib/fontisan/variable/delta_applicator.rb +3 -3
- data/lib/fontisan/variation/optimizer.rb +0 -1
- data/lib/fontisan/version.rb +1 -1
- data/lib/fontisan/woff2_font.rb +2 -2
- data/lib/fontisan/woff_font.rb +3 -3
- data/lib/fontisan.rb +3 -2
- metadata +122 -4
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Migrate from Font-Validator
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Migrate from Font-Validator
|
|
6
|
+
|
|
7
|
+
This guide helps you migrate from Microsoft's Font-Validator (C#) to Fontisan.
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
Font-Validator is Microsoft's C# tool for font validation. Fontisan provides equivalent validation with additional features, all in pure Ruby.
|
|
12
|
+
|
|
13
|
+
## Profile Equivalents
|
|
14
|
+
|
|
15
|
+
| Font-Validator | Fontisan |
|
|
16
|
+
|----------------|----------|
|
|
17
|
+
| Auto mode | `fontisan validate -t indexability` |
|
|
18
|
+
| Full mode | `fontisan validate -t production` |
|
|
19
|
+
| Web mode | `fontisan validate -t web` |
|
|
20
|
+
| Custom | `fontisan validate -t spec_compliance` |
|
|
21
|
+
|
|
22
|
+
## Validation Profiles
|
|
23
|
+
|
|
24
|
+
### indexability (Fast)
|
|
25
|
+
|
|
26
|
+
Equivalent to Font-Validator Auto mode:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
fontisan validate font.ttf -t indexability
|
|
30
|
+
|
|
31
|
+
# Fast validation for font discovery
|
|
32
|
+
# 8 checks, metadata-only
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### production (Full)
|
|
36
|
+
|
|
37
|
+
Equivalent to Font-Validator Full mode:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
fontisan validate font.ttf -t production
|
|
41
|
+
|
|
42
|
+
# Comprehensive quality checks
|
|
43
|
+
# 37 checks, OpenType spec compliance
|
|
44
|
+
# This is the default profile
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### web
|
|
48
|
+
|
|
49
|
+
Equivalent to Font-Validator Web mode:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
fontisan validate font.ttf -t web
|
|
53
|
+
|
|
54
|
+
# Web embedding readiness
|
|
55
|
+
# 18 checks for web deployment
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Command Equivalents
|
|
59
|
+
|
|
60
|
+
### Basic Validation
|
|
61
|
+
|
|
62
|
+
**Font-Validator:**
|
|
63
|
+
```bash
|
|
64
|
+
FontValidator.exe font.ttf
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**Fontisan:**
|
|
68
|
+
```bash
|
|
69
|
+
fontisan validate font.ttf
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### With Profile
|
|
73
|
+
|
|
74
|
+
**Font-Validator:**
|
|
75
|
+
```bash
|
|
76
|
+
FontValidator.exe -Profile Auto font.ttf
|
|
77
|
+
FontValidator.exe -Profile Full font.ttf
|
|
78
|
+
FontValidator.exe -Profile Web font.ttf
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Fontisan:**
|
|
82
|
+
```bash
|
|
83
|
+
fontisan validate font.ttf -t indexability
|
|
84
|
+
fontisan validate font.ttf -t production
|
|
85
|
+
fontisan validate font.ttf -t web
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Output Format
|
|
89
|
+
|
|
90
|
+
**Font-Validator:**
|
|
91
|
+
```bash
|
|
92
|
+
FontValidator.exe -Output report.xml font.ttf
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**Fontisan:**
|
|
96
|
+
```bash
|
|
97
|
+
fontisan validate font.ttf --format yaml
|
|
98
|
+
fontisan validate font.ttf --format json
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Output Comparison
|
|
102
|
+
|
|
103
|
+
### Font-Validator Output
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
=== Font Validation Report ===
|
|
107
|
+
File: font.ttf
|
|
108
|
+
Overall: PASS
|
|
109
|
+
|
|
110
|
+
Checks: 50
|
|
111
|
+
Passed: 50
|
|
112
|
+
Failed: 0
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Fontisan Output
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
Font: font.ttf
|
|
119
|
+
Status: VALID
|
|
120
|
+
|
|
121
|
+
Summary:
|
|
122
|
+
Checks performed: 37
|
|
123
|
+
Passed: 37
|
|
124
|
+
Failed: 0
|
|
125
|
+
|
|
126
|
+
Errors: 0
|
|
127
|
+
Warnings: 0
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Validation Helpers
|
|
131
|
+
|
|
132
|
+
Fontisan includes 56 validation helpers:
|
|
133
|
+
|
|
134
|
+
| Category | Helpers |
|
|
135
|
+
|----------|---------|
|
|
136
|
+
| Table | 12 |
|
|
137
|
+
| Name | 8 |
|
|
138
|
+
| Head | 6 |
|
|
139
|
+
| Metrics | 10 |
|
|
140
|
+
| Glyph | 8 |
|
|
141
|
+
| CMAP | 6 |
|
|
142
|
+
| Layout | 6 |
|
|
143
|
+
|
|
144
|
+
See [Validation Helpers](/guide/validation/helpers) for details.
|
|
145
|
+
|
|
146
|
+
## Additional Features
|
|
147
|
+
|
|
148
|
+
Fontisan provides features not available in Font-Validator:
|
|
149
|
+
|
|
150
|
+
### Font Conversion
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# Not available in Font-Validator
|
|
154
|
+
fontisan convert font.ttf --to otf --output font.otf
|
|
155
|
+
fontisan convert font.ttf --to woff2 --output font.woff2
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Font Subsetting
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
# Not available in Font-Validator
|
|
162
|
+
fontisan subset font.ttf --chars "ABC" --output subset.ttf
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Collection Support
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
# Limited in Font-Validator
|
|
169
|
+
fontisan ls family.ttc
|
|
170
|
+
fontisan unpack family.ttc --output-dir ./extracted
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Variable Font Support
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
# Limited in Font-Validator
|
|
177
|
+
fontisan info variable.ttf
|
|
178
|
+
fontisan instance variable.ttf --wght 700 --output bold.ttf
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Feature Comparison
|
|
182
|
+
|
|
183
|
+
| Feature | Font-Validator | Fontisan |
|
|
184
|
+
|---------|----------------|----------|
|
|
185
|
+
| Pure Ruby | ❌ (C#) | ✅ |
|
|
186
|
+
| .NET required | ✅ | ❌ |
|
|
187
|
+
| Validation | ✅ | ✅ |
|
|
188
|
+
| Conversion | ❌ | ✅ |
|
|
189
|
+
| Subsetting | ❌ | ✅ |
|
|
190
|
+
| Collections | Limited | ✅ |
|
|
191
|
+
| Variable fonts | Limited | ✅ |
|
|
192
|
+
| Type 1 support | ❌ | ✅ |
|
|
193
|
+
| Custom validators | ❌ | ✅ |
|
|
194
|
+
|
|
195
|
+
## Migration Example
|
|
196
|
+
|
|
197
|
+
### CI/CD Pipeline
|
|
198
|
+
|
|
199
|
+
**Before (Font-Validator):**
|
|
200
|
+
```yaml
|
|
201
|
+
# Requires .NET runtime
|
|
202
|
+
- run: FontValidator.exe -Profile Full fonts/*.ttf
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
**After (Fontisan):**
|
|
206
|
+
```yaml
|
|
207
|
+
# Pure Ruby, no runtime dependencies
|
|
208
|
+
- run: fontisan validate fonts/*.ttf -t production
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Script
|
|
212
|
+
|
|
213
|
+
**Before:**
|
|
214
|
+
```bash
|
|
215
|
+
# Windows only
|
|
216
|
+
FontValidator.exe -Profile Full font.ttf
|
|
217
|
+
if %ERRORLEVEL% neq 0 (
|
|
218
|
+
echo Validation failed
|
|
219
|
+
)
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
**After:**
|
|
223
|
+
```bash
|
|
224
|
+
# Cross-platform
|
|
225
|
+
fontisan validate font.ttf
|
|
226
|
+
if [ $? -ne 0 ]; then
|
|
227
|
+
echo "Validation failed"
|
|
228
|
+
fi
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
## Custom Validators
|
|
232
|
+
|
|
233
|
+
Fontisan allows custom validation rules:
|
|
234
|
+
|
|
235
|
+
```ruby
|
|
236
|
+
class MyValidator < Fontisan::Validators::Validator
|
|
237
|
+
def define_checks
|
|
238
|
+
check_table :custom_check, 'name', severity: :error do |table|
|
|
239
|
+
table.family_name_present?
|
|
240
|
+
end
|
|
241
|
+
end
|
|
242
|
+
end
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
See [Custom Validators](/guide/validation/custom) for details.
|
|
246
|
+
|
|
247
|
+
## Advantages of Fontisan
|
|
248
|
+
|
|
249
|
+
1. **Pure Ruby** — No .NET runtime required
|
|
250
|
+
2. **Cross-platform** — Works on Linux, macOS, Windows
|
|
251
|
+
3. **More features** — Conversion, subsetting, collections
|
|
252
|
+
4. **Custom validators** — Extensible validation
|
|
253
|
+
5. **Variable fonts** — Full support
|
|
254
|
+
6. **Type 1** — Legacy format support
|
|
255
|
+
|
|
256
|
+
## Getting Help
|
|
257
|
+
|
|
258
|
+
- [Validation Guide](/guide/validation/)
|
|
259
|
+
- [CLI Reference](/guide/cli/validate)
|
|
260
|
+
- [GitHub Issues](https://github.com/fontist/fontisan/issues)
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Migrate from fonttools
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Migrate from fonttools (Python)
|
|
6
|
+
|
|
7
|
+
This guide helps you migrate from Python's fonttools library to Fontisan.
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
| fonttools (Python) | Fontisan (Ruby) |
|
|
12
|
+
|--------------------|-----------------|
|
|
13
|
+
| Python required | Pure Ruby |
|
|
14
|
+
| Native extensions | Pure Ruby |
|
|
15
|
+
| No validation | Built-in validation |
|
|
16
|
+
| Partial Type 1 | Full Type 1 support |
|
|
17
|
+
|
|
18
|
+
## Quick Reference
|
|
19
|
+
|
|
20
|
+
### Loading Fonts
|
|
21
|
+
|
|
22
|
+
```python
|
|
23
|
+
# fonttools
|
|
24
|
+
from fontTools.ttLib import TTFont
|
|
25
|
+
font = TTFont('font.ttf')
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```ruby
|
|
29
|
+
# Fontisan
|
|
30
|
+
font = Fontisan::FontLoader.load('font.ttf')
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Saving Fonts
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
# fonttools
|
|
37
|
+
font.save('output.ttf')
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
```ruby
|
|
41
|
+
# Fontisan
|
|
42
|
+
Fontisan::FontWriter.write(font, 'output.ttf')
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### TTX Export
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# fonttools
|
|
49
|
+
ttx font.ttf
|
|
50
|
+
|
|
51
|
+
# Fontisan
|
|
52
|
+
fontisan export font.ttf --format ttx --output font.ttx
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Command Equivalents
|
|
56
|
+
|
|
57
|
+
### ttx
|
|
58
|
+
|
|
59
|
+
| fonttools | Fontisan |
|
|
60
|
+
|-----------|----------|
|
|
61
|
+
| `ttx font.ttf` | `fontisan export font.ttf --format ttx` |
|
|
62
|
+
| `ttx -t name font.ttf` | `fontisan export font.ttf --format ttx --tables name` |
|
|
63
|
+
| `ttx -o output.ttx font.ttf` | `fontisan export font.ttf --format ttx --output output.ttx` |
|
|
64
|
+
|
|
65
|
+
### fonttools subset
|
|
66
|
+
|
|
67
|
+
| fonttools | Fontisan |
|
|
68
|
+
|-----------|----------|
|
|
69
|
+
| `fonttools subset font.ttf --text="ABC"` | `fontisan subset font.ttf --chars "ABC"` |
|
|
70
|
+
| `fonttools subset font.ttf --unicodes="U+0041"` | `fontisan subset font.ttf --unicodes "U+0041"` |
|
|
71
|
+
| `fonttools subset font.ttf --output-file=out.ttf` | `fontisan subset font.ttf --output out.ttf` |
|
|
72
|
+
|
|
73
|
+
## API Migration
|
|
74
|
+
|
|
75
|
+
### Access Tables
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
# fonttools
|
|
79
|
+
name_table = font['name']
|
|
80
|
+
family = name_table.getBestFamilyName()
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
```ruby
|
|
84
|
+
# Fontisan
|
|
85
|
+
name_table = font.tables['name']
|
|
86
|
+
family = name_table.family_name
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Get Glyph Count
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
# fonttools
|
|
93
|
+
num_glyphs = font['maxp'].numGlyphs
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
```ruby
|
|
97
|
+
# Fontisan
|
|
98
|
+
num_glyphs = font.tables['maxp'].num_glyphs
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Iterate Glyphs
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
# fonttools
|
|
105
|
+
for glyph_name in font.getGlyphOrder():
|
|
106
|
+
print(glyph_name)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
```ruby
|
|
110
|
+
# Fontisan
|
|
111
|
+
font.glyphs.each_with_index do |glyph, id|
|
|
112
|
+
puts font.glyph_name(id)
|
|
113
|
+
end
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Variable Fonts
|
|
117
|
+
|
|
118
|
+
```python
|
|
119
|
+
# fonttools
|
|
120
|
+
axes = font['fvar'].axes
|
|
121
|
+
for axis in axes:
|
|
122
|
+
print(axis.axisTag, axis.minValue, axis.maxValue)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
```ruby
|
|
126
|
+
# Fontisan
|
|
127
|
+
fvar = font.tables['fvar']
|
|
128
|
+
fvar.axes.each do |axis|
|
|
129
|
+
puts "#{axis.tag}: #{axis.min_value} - #{axis.max_value}"
|
|
130
|
+
end
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Generate Instance
|
|
134
|
+
|
|
135
|
+
```python
|
|
136
|
+
# fonttools
|
|
137
|
+
from fontTools.varLib.instancer import instantiateVariableFont
|
|
138
|
+
instance = instantiateVariableFont(font, {'wght': 700})
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
```ruby
|
|
142
|
+
# Fontisan
|
|
143
|
+
writer = Fontisan::Variation::InstanceWriter.new(font)
|
|
144
|
+
instance = writer.generate_instance(wght: 700)
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Feature Comparison
|
|
148
|
+
|
|
149
|
+
| Feature | fonttools | Fontisan |
|
|
150
|
+
|---------|-----------|----------|
|
|
151
|
+
| Pure Ruby | ❌ | ✅ |
|
|
152
|
+
| Python-free | ❌ | ✅ |
|
|
153
|
+
| TTF/OTF support | ✅ | ✅ |
|
|
154
|
+
| WOFF/WOFF2 | ✅ | ✅ |
|
|
155
|
+
| Type 1 support | Partial | ✅ |
|
|
156
|
+
| Variable fonts | ✅ | ✅ |
|
|
157
|
+
| Font validation | ❌ | ✅ |
|
|
158
|
+
| Hint conversion | ❌ | ✅ |
|
|
159
|
+
| Collections | ✅ | ✅ |
|
|
160
|
+
| UFO format | ✅ | Planned |
|
|
161
|
+
| FEA parsing | ✅ | ❌ |
|
|
162
|
+
| Designspace | ✅ | ❌ |
|
|
163
|
+
|
|
164
|
+
## Advantages of Fontisan
|
|
165
|
+
|
|
166
|
+
### Pure Ruby
|
|
167
|
+
|
|
168
|
+
- No Python installation required
|
|
169
|
+
- No native extension compilation
|
|
170
|
+
- Works in Ruby-only environments
|
|
171
|
+
- Easy deployment
|
|
172
|
+
|
|
173
|
+
### Built-in Validation
|
|
174
|
+
|
|
175
|
+
```ruby
|
|
176
|
+
# Fontisan has validation built-in
|
|
177
|
+
result = Fontisan.validate('font.ttf', profile: :production)
|
|
178
|
+
puts result.valid?
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Bidirectional Hint Conversion
|
|
182
|
+
|
|
183
|
+
```ruby
|
|
184
|
+
# Convert hints between TrueType and PostScript
|
|
185
|
+
fontisan convert font.ttf --to otf --hinting-mode preserve
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Type 1 Support
|
|
189
|
+
|
|
190
|
+
```ruby
|
|
191
|
+
# Full Type 1 support including conversion
|
|
192
|
+
fontisan convert font.pfb --to otf --output font.otf
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Migration Checklist
|
|
196
|
+
|
|
197
|
+
1. [ ] Install Fontisan: `gem install fontisan`
|
|
198
|
+
2. [ ] Replace `from fontTools.ttLib import TTFont` with `require 'fontisan'`
|
|
199
|
+
3. [ ] Replace `TTFont(path)` with `Fontisan::FontLoader.load(path)`
|
|
200
|
+
4. [ ] Replace `font.save(path)` with `Fontisan::FontWriter.write(font, path)`
|
|
201
|
+
5. [ ] Update table access from `font['name']` to `font.tables['name']`
|
|
202
|
+
6. [ ] Test your workflow
|
|
203
|
+
|
|
204
|
+
## Getting Help
|
|
205
|
+
|
|
206
|
+
- [Fontisan Guide](/guide/)
|
|
207
|
+
- [API Reference](/api/)
|
|
208
|
+
- [GitHub Issues](https://github.com/fontist/fontisan/issues)
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Migration Guides
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Migration Guides
|
|
6
|
+
|
|
7
|
+
Migrating from another font tool? These guides will help you transition to Fontisan.
|
|
8
|
+
|
|
9
|
+
## Available Guides
|
|
10
|
+
|
|
11
|
+
### From fonttools (Python)
|
|
12
|
+
|
|
13
|
+
[→ Migrate from fonttools](/guide/migrations/fonttools)
|
|
14
|
+
|
|
15
|
+
The most comprehensive migration guide covering:
|
|
16
|
+
- API equivalents for `TTFont`, `fontTools.varLib`, etc.
|
|
17
|
+
- CLI command mapping
|
|
18
|
+
- Feature comparison table
|
|
19
|
+
- Common workflows
|
|
20
|
+
|
|
21
|
+
### From extract_ttc
|
|
22
|
+
|
|
23
|
+
[→ Migrate from extract_ttc](/guide/migrations/extract-ttc)
|
|
24
|
+
|
|
25
|
+
Fontisan fully supersedes extract_ttc:
|
|
26
|
+
- Identical `ls` and `info` commands
|
|
27
|
+
- More powerful `unpack` with format conversion
|
|
28
|
+
- Works on TTF/OTF files too
|
|
29
|
+
- Table sharing statistics
|
|
30
|
+
|
|
31
|
+
### From otfinfo (lcdf-typetools)
|
|
32
|
+
|
|
33
|
+
[→ Migrate from otfinfo](/guide/migrations/otfinfo)
|
|
34
|
+
|
|
35
|
+
Command equivalents for lcdf-typetools users:
|
|
36
|
+
- `otfinfo -i` → `fontisan info`
|
|
37
|
+
- `otfinfo -s` → `fontisan scripts`
|
|
38
|
+
- `otfinfo -f` → `fontisan features`
|
|
39
|
+
- `otfinfo -g` → `fontisan glyphs`
|
|
40
|
+
|
|
41
|
+
### From Font-Validator
|
|
42
|
+
|
|
43
|
+
[→ Migrate from Font-Validator](/guide/migrations/font-validator)
|
|
44
|
+
|
|
45
|
+
Validation profile mapping:
|
|
46
|
+
- Auto mode → `fontisan validate -t indexability`
|
|
47
|
+
- Full mode → `fontisan validate -t production`
|
|
48
|
+
- Web mode → `fontisan validate -t web`
|
|
49
|
+
|
|
50
|
+
## Why Migrate?
|
|
51
|
+
|
|
52
|
+
| Feature | fonttools | lcdf-typetools | Font-Validator | Fontisan |
|
|
53
|
+
|---------|-----------|----------------|----------------|----------|
|
|
54
|
+
| Pure Ruby | ❌ | ❌ | ❌ | ✅ |
|
|
55
|
+
| Font conversion | ✅ | ✅ | ❌ | ✅ |
|
|
56
|
+
| Validation | ❌ | ❌ | ✅ | ✅ |
|
|
57
|
+
| Variable fonts | ✅ | ❌ | ❌ | ✅ |
|
|
58
|
+
| Type 1 support | Partial | ✅ | ❌ | ✅ |
|
|
59
|
+
| Bidirectional hints | ❌ | Partial | ❌ | ✅ |
|
|
60
|
+
|
|
61
|
+
## Need Help?
|
|
62
|
+
|
|
63
|
+
- [GitHub Issues](https://github.com/fontist/fontisan/issues) — Report bugs or request features
|
|
64
|
+
- [Guide](/guide/) — Read the documentation
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Migrate from otfinfo
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Migrate from otfinfo
|
|
6
|
+
|
|
7
|
+
This guide helps you migrate from otfinfo (lcdf-typetools) to Fontisan.
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
otfinfo is part of the lcdf-typetools suite. Fontisan provides equivalent functionality with additional features.
|
|
12
|
+
|
|
13
|
+
## Command Equivalents
|
|
14
|
+
|
|
15
|
+
### Font Information
|
|
16
|
+
|
|
17
|
+
| otfinfo | Fontisan |
|
|
18
|
+
|---------|----------|
|
|
19
|
+
| `otfinfo -i font.ttf` | `fontisan info font.ttf` |
|
|
20
|
+
| `otfinfo --info font.ttf` | `fontisan info font.ttf` |
|
|
21
|
+
|
|
22
|
+
### Script Information
|
|
23
|
+
|
|
24
|
+
| otfinfo | Fontisan |
|
|
25
|
+
|---------|----------|
|
|
26
|
+
| `otfinfo -s font.ttf` | `fontisan info font.ttf --features` |
|
|
27
|
+
| `otfinfo --scripts font.ttf` | `fontisan info font.ttf --features` |
|
|
28
|
+
|
|
29
|
+
### Feature Information
|
|
30
|
+
|
|
31
|
+
| otfinfo | Fontisan |
|
|
32
|
+
|---------|----------|
|
|
33
|
+
| `otfinfo -f font.ttf` | `fontisan info font.ttf --features` |
|
|
34
|
+
| `otfinfo --features font.ttf` | `fontisan info font.ttf --features` |
|
|
35
|
+
|
|
36
|
+
### Glyph Information
|
|
37
|
+
|
|
38
|
+
| otfinfo | Fontisan |
|
|
39
|
+
|---------|----------|
|
|
40
|
+
| `otfinfo -g font.ttf` | `fontisan info font.ttf --glyphs` |
|
|
41
|
+
| `otfinfo --glyphs font.ttf` | `fontisan info font.ttf --glyphs` |
|
|
42
|
+
|
|
43
|
+
### Unicode Coverage
|
|
44
|
+
|
|
45
|
+
| otfinfo | Fontisan |
|
|
46
|
+
|---------|----------|
|
|
47
|
+
| `otfinfo -u font.ttf` | `fontisan info font.ttf --unicode` |
|
|
48
|
+
| `otfinfo --unicode font.ttf` | `fontisan info font.ttf --unicode` |
|
|
49
|
+
|
|
50
|
+
### Table Information
|
|
51
|
+
|
|
52
|
+
| otfinfo | Fontisan |
|
|
53
|
+
|---------|----------|
|
|
54
|
+
| `otfinfo -t font.ttf` | `fontisan info font.ttf --tables` |
|
|
55
|
+
| `otfinfo --tables font.ttf` | `fontisan info font.ttf --tables` |
|
|
56
|
+
|
|
57
|
+
## Output Comparison
|
|
58
|
+
|
|
59
|
+
### Font Information
|
|
60
|
+
|
|
61
|
+
**otfinfo:**
|
|
62
|
+
```
|
|
63
|
+
Family: Example
|
|
64
|
+
Subfamily: Regular
|
|
65
|
+
Full name: Example Regular
|
|
66
|
+
PostScript name: Example-Regular
|
|
67
|
+
Version: 1.000
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Fontisan:**
|
|
71
|
+
```
|
|
72
|
+
Font: font.ttf
|
|
73
|
+
Format: TrueType
|
|
74
|
+
Family: Example
|
|
75
|
+
Style: Regular
|
|
76
|
+
PostScript: Example-Regular
|
|
77
|
+
Version: 1.000
|
|
78
|
+
Glyphs: 268
|
|
79
|
+
Tables: 14
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Unicode Coverage
|
|
83
|
+
|
|
84
|
+
**otfinfo:**
|
|
85
|
+
```
|
|
86
|
+
U+0020..U+007E Basic Latin
|
|
87
|
+
U+00A0..U+00FF Latin-1 Supplement
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Fontisan:**
|
|
91
|
+
```
|
|
92
|
+
Unicode Coverage:
|
|
93
|
+
Basic Latin (U+0020-U+007E)
|
|
94
|
+
Latin-1 Supplement (U+00A0-U+00FF)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Additional Features
|
|
98
|
+
|
|
99
|
+
Fontisan provides features not available in otfinfo:
|
|
100
|
+
|
|
101
|
+
### Validation
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Not available in otfinfo
|
|
105
|
+
fontisan validate font.ttf --profile production
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Conversion
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# Not available in otfinfo
|
|
112
|
+
fontisan convert font.ttf --to otf --output font.otf
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Subsetting
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
# Not available in otfinfo
|
|
119
|
+
fontisan subset font.ttf --chars "ABC" --output subset.ttf
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Collection Support
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
# Limited in otfinfo
|
|
126
|
+
fontisan ls family.ttc
|
|
127
|
+
fontisan unpack family.ttc --output-dir ./extracted
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Multiple Output Formats
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
# otfinfo: text only
|
|
134
|
+
# Fontisan: text, YAML, JSON
|
|
135
|
+
|
|
136
|
+
fontisan info font.ttf --format yaml
|
|
137
|
+
fontisan info font.ttf --format json
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Feature Comparison
|
|
141
|
+
|
|
142
|
+
| Feature | otfinfo | Fontisan |
|
|
143
|
+
|---------|---------|----------|
|
|
144
|
+
| Font info | ✅ | ✅ |
|
|
145
|
+
| Script info | ✅ | ✅ |
|
|
146
|
+
| Feature info | ✅ | ✅ |
|
|
147
|
+
| Glyph info | ✅ | ✅ |
|
|
148
|
+
| Unicode info | ✅ | ✅ |
|
|
149
|
+
| Table info | ✅ | ✅ |
|
|
150
|
+
| Validation | ❌ | ✅ |
|
|
151
|
+
| Conversion | ❌ | ✅ |
|
|
152
|
+
| Subsetting | ❌ | ✅ |
|
|
153
|
+
| Collections | Limited | ✅ |
|
|
154
|
+
| YAML/JSON | ❌ | ✅ |
|
|
155
|
+
| Pure Ruby | ❌ (C++) | ✅ |
|
|
156
|
+
|
|
157
|
+
## Migration Example
|
|
158
|
+
|
|
159
|
+
### Before (otfinfo)
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
# Get family name
|
|
163
|
+
family=$(otfinfo -i font.ttf | grep Family | cut -d: -f2 | xargs)
|
|
164
|
+
echo "Family: $family"
|
|
165
|
+
|
|
166
|
+
# Check for specific feature
|
|
167
|
+
if otfinfo -f font.ttf | grep -q "liga"; then
|
|
168
|
+
echo "Has ligatures"
|
|
169
|
+
fi
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### After (Fontisan)
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
# Get family name (JSON output)
|
|
176
|
+
family=$(fontisan info font.ttf --format json | jq -r '.family')
|
|
177
|
+
echo "Family: $family"
|
|
178
|
+
|
|
179
|
+
# Check for specific feature
|
|
180
|
+
if fontisan info font.ttf --features | grep -q "liga"; then
|
|
181
|
+
echo "Has ligatures"
|
|
182
|
+
fi
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Advantages of Fontisan
|
|
186
|
+
|
|
187
|
+
1. **Pure Ruby** — No C++ compilation required
|
|
188
|
+
2. **More features** — Validation, conversion, subsetting
|
|
189
|
+
3. **Better output** — YAML and JSON formats
|
|
190
|
+
4. **Collection support** — Full TTC/OTC handling
|
|
191
|
+
5. **Validation** — Comprehensive font checking
|
|
192
|
+
|
|
193
|
+
## Getting Help
|
|
194
|
+
|
|
195
|
+
- [Fontisan Guide](/guide/)
|
|
196
|
+
- [CLI Reference](/guide/cli/)
|
|
197
|
+
- [GitHub Issues](https://github.com/fontist/fontisan/issues)
|