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,154 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: SVG Color Fonts
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# SVG Color Fonts
|
|
6
|
+
|
|
7
|
+
SVG color fonts embed complete SVG documents for each glyph.
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
SVG color fonts contain:
|
|
12
|
+
- Full SVG documents with shapes, gradients, effects
|
|
13
|
+
- Can be extremely detailed and complex
|
|
14
|
+
- Self-contained (no external resources)
|
|
15
|
+
|
|
16
|
+
## Structure
|
|
17
|
+
|
|
18
|
+
```ruby
|
|
19
|
+
svg = font.tables['SVG']
|
|
20
|
+
|
|
21
|
+
# SVG documents by glyph ID
|
|
22
|
+
svg.documents.each do |glyph_id, doc|
|
|
23
|
+
puts "Glyph #{glyph_id}:"
|
|
24
|
+
puts doc # Complete SVG XML
|
|
25
|
+
end
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Reading SVG Fonts
|
|
29
|
+
|
|
30
|
+
### List SVG Glyphs
|
|
31
|
+
|
|
32
|
+
```ruby
|
|
33
|
+
font = Fontisan::FontLoader.load('svg-font.ttf')
|
|
34
|
+
svg = font.tables['SVG']
|
|
35
|
+
|
|
36
|
+
if svg
|
|
37
|
+
svg.documents.each do |glyph_id, doc|
|
|
38
|
+
glyph_name = font.glyph_name(glyph_id)
|
|
39
|
+
puts "#{glyph_name}: #{doc.length} bytes"
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Parse SVG Content
|
|
45
|
+
|
|
46
|
+
```ruby
|
|
47
|
+
require 'nokogiri'
|
|
48
|
+
|
|
49
|
+
svg = font.tables['SVG']
|
|
50
|
+
doc = svg.documents[42] # SVG for glyph 42
|
|
51
|
+
|
|
52
|
+
parsed = Nokogiri::XML(doc)
|
|
53
|
+
|
|
54
|
+
# Find elements
|
|
55
|
+
paths = parsed.css('path')
|
|
56
|
+
puts "Paths: #{paths.length}"
|
|
57
|
+
|
|
58
|
+
rects = parsed.css('rect')
|
|
59
|
+
puts "Rectangles: #{rects.length}"
|
|
60
|
+
|
|
61
|
+
# Find gradients
|
|
62
|
+
gradients = parsed.css('linearGradient', 'radialGradient')
|
|
63
|
+
puts "Gradients: #{gradients.length}"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## SVG Features
|
|
67
|
+
|
|
68
|
+
SVG fonts can include:
|
|
69
|
+
|
|
70
|
+
| Feature | Support |
|
|
71
|
+
|---------|---------|
|
|
72
|
+
| Paths | ✓ |
|
|
73
|
+
| Basic shapes | ✓ |
|
|
74
|
+
| Gradients | ✓ |
|
|
75
|
+
| Patterns | ✓ |
|
|
76
|
+
| Clip paths | ✓ |
|
|
77
|
+
| Masks | ✓ |
|
|
78
|
+
| Filters | Limited |
|
|
79
|
+
| Animations | No |
|
|
80
|
+
| Scripts | No |
|
|
81
|
+
|
|
82
|
+
## Exporting
|
|
83
|
+
|
|
84
|
+
### Export SVG Files
|
|
85
|
+
|
|
86
|
+
```ruby
|
|
87
|
+
font = Fontisan::FontLoader.load('svg-font.ttf')
|
|
88
|
+
svg = font.tables['SVG']
|
|
89
|
+
|
|
90
|
+
Dir.mkdir('svg-glyphs') unless Dir.exist?('svg-glyphs')
|
|
91
|
+
|
|
92
|
+
svg.documents.each do |glyph_id, doc|
|
|
93
|
+
glyph_name = font.glyph_name(glyph_id) || "glyph-#{glyph_id}"
|
|
94
|
+
filename = "svg-glyphs/#{glyph_name}.svg"
|
|
95
|
+
File.write(filename, doc)
|
|
96
|
+
end
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Conversion
|
|
100
|
+
|
|
101
|
+
### SVG to Other Formats
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# SVG is preserved during conversion
|
|
105
|
+
fontisan convert svg-font.ttf --to otf --output svg-font.otf
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Remove SVG
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# Create version without SVG
|
|
112
|
+
fontisan convert svg-font.ttf --to ttf --no-svg --output no-svg.ttf
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Limitations
|
|
116
|
+
|
|
117
|
+
### File Size
|
|
118
|
+
|
|
119
|
+
SVG fonts can be very large:
|
|
120
|
+
- XML text overhead
|
|
121
|
+
- Duplicate content across glyphs
|
|
122
|
+
- Embedded gradients and filters
|
|
123
|
+
|
|
124
|
+
### Browser Support
|
|
125
|
+
|
|
126
|
+
| Browser | Support |
|
|
127
|
+
|---------|---------|
|
|
128
|
+
| Firefox | Full |
|
|
129
|
+
| Safari | Full |
|
|
130
|
+
| Chrome | Full (since v98) |
|
|
131
|
+
| Edge | Full |
|
|
132
|
+
|
|
133
|
+
### Performance
|
|
134
|
+
|
|
135
|
+
- **Parsing** — SVG requires XML parsing
|
|
136
|
+
- **Rendering** — Complex effects are slow
|
|
137
|
+
- **Memory** — Large documents use more memory
|
|
138
|
+
|
|
139
|
+
## Comparison with COLR/CPAL
|
|
140
|
+
|
|
141
|
+
| Feature | SVG | COLR/CPAL |
|
|
142
|
+
|---------|-----|-----------|
|
|
143
|
+
| File size | Large | Small |
|
|
144
|
+
| Effects | Full | Limited |
|
|
145
|
+
| Gradients | Full | Limited |
|
|
146
|
+
| Browser support | Good | Good |
|
|
147
|
+
| Variable fonts | No | Yes |
|
|
148
|
+
|
|
149
|
+
## Best Practices
|
|
150
|
+
|
|
151
|
+
1. **Optimize SVGs** — Minimize file size
|
|
152
|
+
2. **Use COLR/CPAL if possible** — Better performance
|
|
153
|
+
3. **Test rendering** — Complex effects may not work everywhere
|
|
154
|
+
4. **Provide fallbacks** — Not all platforms support SVG fonts
|
data/docs/guide/color.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Color Fonts
|
|
2
|
+
|
|
3
|
+
Fontisan supports working with color fonts in various formats.
|
|
4
|
+
|
|
5
|
+
## Supported Formats
|
|
6
|
+
|
|
7
|
+
- **COLR/CPAL** - OpenType color font tables
|
|
8
|
+
- **SVG** - SVG-based color fonts
|
|
9
|
+
- **CBDT/CBLC** - Color bitmap fonts
|
|
10
|
+
|
|
11
|
+
## Reading Color Fonts
|
|
12
|
+
|
|
13
|
+
```ruby
|
|
14
|
+
require 'fontisan'
|
|
15
|
+
|
|
16
|
+
# Load a color font
|
|
17
|
+
font = Fontisan.load('color-font.ttf')
|
|
18
|
+
|
|
19
|
+
# Check if font has color
|
|
20
|
+
if font.color?
|
|
21
|
+
puts "This is a color font"
|
|
22
|
+
puts "Format: #{font.color_format}"
|
|
23
|
+
end
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Color Palettes
|
|
27
|
+
|
|
28
|
+
For COLR/CPAL fonts:
|
|
29
|
+
|
|
30
|
+
```ruby
|
|
31
|
+
# Get color palettes
|
|
32
|
+
palettes = font.color_palettes
|
|
33
|
+
|
|
34
|
+
palettes.each do |palette|
|
|
35
|
+
puts "Palette:"
|
|
36
|
+
palette.colors.each do |color|
|
|
37
|
+
puts " ##{color.hex}"
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Converting Color Fonts
|
|
43
|
+
|
|
44
|
+
```ruby
|
|
45
|
+
# Convert color font to WOFF2
|
|
46
|
+
Fontisan.convert('color-font.ttf', output_format: :woff2)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Related
|
|
50
|
+
|
|
51
|
+
- [Variable Fonts](/guide/variable) - Variable font support
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: vs Font-Validator
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Fontisan vs Font-Validator
|
|
6
|
+
|
|
7
|
+
Compare Fontisan with Microsoft's Font-Validator.
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
Font-Validator is Microsoft's C# tool for comprehensive font validation.
|
|
12
|
+
|
|
13
|
+
| | Font-Validator | Fontisan |
|
|
14
|
+
|---|----------------|----------|
|
|
15
|
+
| Language | C# | Ruby |
|
|
16
|
+
| Runtime | .NET required | None |
|
|
17
|
+
| Platform | Windows focus | Cross-platform |
|
|
18
|
+
| Features | Validation only | Full suite |
|
|
19
|
+
|
|
20
|
+
## Profile Equivalents
|
|
21
|
+
|
|
22
|
+
| Font-Validator | Fontisan |
|
|
23
|
+
|----------------|----------|
|
|
24
|
+
| Auto | `fontisan validate -t indexability` |
|
|
25
|
+
| Full | `fontisan validate -t production` |
|
|
26
|
+
| Web | `fontisan validate -t web` |
|
|
27
|
+
| Custom | `fontisan validate -t spec_compliance` |
|
|
28
|
+
|
|
29
|
+
## Feature Comparison
|
|
30
|
+
|
|
31
|
+
### Validation
|
|
32
|
+
|
|
33
|
+
| Feature | Font-Validator | Fontisan |
|
|
34
|
+
|---------|----------------|----------|
|
|
35
|
+
| Profiles | 3+ | 5 |
|
|
36
|
+
| Helpers | ~50 | 56 |
|
|
37
|
+
| Coverage reports | ✅ | ✅ |
|
|
38
|
+
| Custom rules | ❌ | ✅ |
|
|
39
|
+
| Severity levels | ✅ | ✅ |
|
|
40
|
+
| Output formats | XML | YAML, JSON, Text |
|
|
41
|
+
|
|
42
|
+
### Font Operations
|
|
43
|
+
|
|
44
|
+
| Feature | Font-Validator | Fontisan |
|
|
45
|
+
|---------|----------------|----------|
|
|
46
|
+
| Validation | ✅ | ✅ |
|
|
47
|
+
| Conversion | ❌ | ✅ |
|
|
48
|
+
| Subsetting | ❌ | ✅ |
|
|
49
|
+
| Information | Limited | ✅ |
|
|
50
|
+
| Collections | Limited | ✅ |
|
|
51
|
+
|
|
52
|
+
### Format Support
|
|
53
|
+
|
|
54
|
+
| Format | Font-Validator | Fontisan |
|
|
55
|
+
|--------|----------------|----------|
|
|
56
|
+
| TrueType | ✅ | ✅ |
|
|
57
|
+
| OpenType | ✅ | ✅ |
|
|
58
|
+
| WOFF | ✅ | ✅ |
|
|
59
|
+
| WOFF2 | ✅ | ✅ |
|
|
60
|
+
| Type 1 | ❌ | ✅ |
|
|
61
|
+
| TTC/OTC | Limited | ✅ |
|
|
62
|
+
|
|
63
|
+
### Variable Fonts
|
|
64
|
+
|
|
65
|
+
| Feature | Font-Validator | Fontisan |
|
|
66
|
+
|---------|----------------|----------|
|
|
67
|
+
| fvar validation | ✅ | ✅ |
|
|
68
|
+
| gvar validation | ✅ | ✅ |
|
|
69
|
+
| Instance generation | ❌ | ✅ |
|
|
70
|
+
| Format conversion | ❌ | ✅ |
|
|
71
|
+
|
|
72
|
+
## Validation Profiles
|
|
73
|
+
|
|
74
|
+
### Fontisan Profiles
|
|
75
|
+
|
|
76
|
+
| Profile | Checks | Focus |
|
|
77
|
+
|---------|--------|-------|
|
|
78
|
+
| indexability | 8 | Fast discovery |
|
|
79
|
+
| usability | 26 | Installation |
|
|
80
|
+
| production | 37 | Full quality |
|
|
81
|
+
| web | 18 | Web fonts |
|
|
82
|
+
| spec_compliance | Full | Spec audit |
|
|
83
|
+
|
|
84
|
+
### Font-Validator Profiles
|
|
85
|
+
|
|
86
|
+
| Profile | Focus |
|
|
87
|
+
|---------|-------|
|
|
88
|
+
| Auto | Quick check |
|
|
89
|
+
| Full | Comprehensive |
|
|
90
|
+
| Web | Web fonts |
|
|
91
|
+
|
|
92
|
+
## Unique Features
|
|
93
|
+
|
|
94
|
+
### Fontisan Unique
|
|
95
|
+
|
|
96
|
+
- **Pure Ruby** — No .NET runtime
|
|
97
|
+
- **Font conversion** — TTF ↔ OTF ↔ WOFF
|
|
98
|
+
- **Subsetting** — Create font subsets
|
|
99
|
+
- **Collections** — Full TTC/OTC support
|
|
100
|
+
- **Custom validators** — DSL for rules
|
|
101
|
+
- **Variable fonts** — Instance generation
|
|
102
|
+
- **Type 1 support** — Legacy format
|
|
103
|
+
|
|
104
|
+
### Font-Validator Unique
|
|
105
|
+
|
|
106
|
+
- **Microsoft official** — From the source
|
|
107
|
+
- **Deep Windows integration** — Windows-specific checks
|
|
108
|
+
- **Mature** — Long development history
|
|
109
|
+
|
|
110
|
+
## Installation Comparison
|
|
111
|
+
|
|
112
|
+
### Font-Validator
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# Requires .NET runtime
|
|
116
|
+
# Windows: Download MSI
|
|
117
|
+
# Linux: Requires Mono or .NET Core
|
|
118
|
+
# macOS: Requires .NET Core
|
|
119
|
+
|
|
120
|
+
dotnet tool install --global FontValidator
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Fontisan
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
# All platforms, no runtime
|
|
127
|
+
gem install fontisan
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Use Case Recommendations
|
|
131
|
+
|
|
132
|
+
### Use Fontisan When:
|
|
133
|
+
|
|
134
|
+
- You're not on Windows
|
|
135
|
+
- You need conversion features
|
|
136
|
+
- You need subsetting
|
|
137
|
+
- You want custom validators
|
|
138
|
+
- You need Type 1 support
|
|
139
|
+
|
|
140
|
+
### Use Font-Validator When:
|
|
141
|
+
|
|
142
|
+
- You need Microsoft official validation
|
|
143
|
+
- You need Windows-specific checks
|
|
144
|
+
- You're in a .NET environment
|
|
145
|
+
|
|
146
|
+
## Code Comparison
|
|
147
|
+
|
|
148
|
+
### Basic Validation
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
# Font-Validator
|
|
152
|
+
FontValidator.exe font.ttf
|
|
153
|
+
|
|
154
|
+
# Fontisan
|
|
155
|
+
fontisan validate font.ttf
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### With Profile
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
# Font-Validator
|
|
162
|
+
FontValidator.exe -Profile Full font.ttf
|
|
163
|
+
|
|
164
|
+
# Fontisan
|
|
165
|
+
fontisan validate font.ttf -t production
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Output Format
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
# Font-Validator
|
|
172
|
+
FontValidator.exe -Output report.xml font.ttf
|
|
173
|
+
|
|
174
|
+
# Fontisan
|
|
175
|
+
fontisan validate font.ttf --format json
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Custom Validators
|
|
179
|
+
|
|
180
|
+
Fontisan allows custom validation rules (not available in Font-Validator):
|
|
181
|
+
|
|
182
|
+
```ruby
|
|
183
|
+
class MyValidator < Fontisan::Validators::Validator
|
|
184
|
+
def define_checks
|
|
185
|
+
check_table :name_check, 'name', severity: :error do |table|
|
|
186
|
+
table.family_name_present? &&
|
|
187
|
+
table.postscript_name_valid?
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
end
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## CI/CD Integration
|
|
194
|
+
|
|
195
|
+
### Font-Validator
|
|
196
|
+
|
|
197
|
+
```yaml
|
|
198
|
+
# Requires .NET runtime
|
|
199
|
+
- uses: actions/setup-dotnet@v3
|
|
200
|
+
- run: FontValidator.exe fonts/*.ttf
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Fontisan
|
|
204
|
+
|
|
205
|
+
```yaml
|
|
206
|
+
# Uses Ruby (already available on most runners)
|
|
207
|
+
- uses: ruby/setup-ruby@v1
|
|
208
|
+
- run: gem install fontisan
|
|
209
|
+
- run: fontisan validate fonts/*.ttf
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## Conclusion
|
|
213
|
+
|
|
214
|
+
| Need | Recommendation |
|
|
215
|
+
|------|----------------|
|
|
216
|
+
| Ruby environment | Fontisan |
|
|
217
|
+
| Cross-platform | Fontisan |
|
|
218
|
+
| Conversion features | Fontisan |
|
|
219
|
+
| Custom validation | Fontisan |
|
|
220
|
+
| Microsoft official | Font-Validator |
|
|
221
|
+
| Windows-specific | Font-Validator |
|
|
222
|
+
| .NET environment | Font-Validator |
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: vs fonttools
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Fontisan vs fonttools
|
|
6
|
+
|
|
7
|
+
Compare Fontisan with Python's fonttools library.
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
| | fonttools | Fontisan |
|
|
12
|
+
|---|-----------|----------|
|
|
13
|
+
| Language | Python | Ruby |
|
|
14
|
+
| Dependencies | Python + extensions | Pure Ruby |
|
|
15
|
+
| Native code | Required | None |
|
|
16
|
+
| Validation | External tools | Built-in |
|
|
17
|
+
|
|
18
|
+
## Feature Comparison
|
|
19
|
+
|
|
20
|
+
### Font Formats
|
|
21
|
+
|
|
22
|
+
| Format | fonttools | Fontisan |
|
|
23
|
+
|--------|-----------|----------|
|
|
24
|
+
| TrueType (TTF) | ✅ | ✅ |
|
|
25
|
+
| OpenType (OTF) | ✅ | ✅ |
|
|
26
|
+
| WOFF | ✅ | ✅ |
|
|
27
|
+
| WOFF2 | ✅ | ✅ |
|
|
28
|
+
| Type 1 (PFB/PFA) | Partial | ✅ |
|
|
29
|
+
| TTC/OTC | ✅ | ✅ |
|
|
30
|
+
| dfont | ✅ | ✅ |
|
|
31
|
+
| SVG | ✅ | ✅ |
|
|
32
|
+
| UFO | ✅ | Planned |
|
|
33
|
+
|
|
34
|
+
### Font Operations
|
|
35
|
+
|
|
36
|
+
| Operation | fonttools | Fontisan |
|
|
37
|
+
|-----------|-----------|----------|
|
|
38
|
+
| Font loading | ✅ | ✅ |
|
|
39
|
+
| Font saving | ✅ | ✅ |
|
|
40
|
+
| Table access | ✅ | ✅ |
|
|
41
|
+
| TTX export | ✅ | ✅ |
|
|
42
|
+
| Subsetting | ✅ | ✅ |
|
|
43
|
+
| Merging | ✅ | ✅ |
|
|
44
|
+
|
|
45
|
+
### Variable Fonts
|
|
46
|
+
|
|
47
|
+
| Feature | fonttools | Fontisan |
|
|
48
|
+
|---------|-----------|----------|
|
|
49
|
+
| fvar reading | ✅ | ✅ |
|
|
50
|
+
| gvar reading | ✅ | ✅ |
|
|
51
|
+
| CFF2 reading | ✅ | ✅ |
|
|
52
|
+
| Instance generation | ✅ | ✅ |
|
|
53
|
+
| Format conversion | ✅ | ✅ |
|
|
54
|
+
|
|
55
|
+
### Font Conversion
|
|
56
|
+
|
|
57
|
+
| Conversion | fonttools | Fontisan |
|
|
58
|
+
|------------|-----------|----------|
|
|
59
|
+
| TTF ↔ OTF | ✅ | ✅ |
|
|
60
|
+
| TTF ↔ WOFF | ✅ | ✅ |
|
|
61
|
+
| TTF ↔ WOFF2 | ✅ | ✅ |
|
|
62
|
+
| Type 1 → OTF | ✅ | ✅ |
|
|
63
|
+
| OTF → Type 1 | ❌ | ✅ |
|
|
64
|
+
| Curve conversion | ✅ | ✅ |
|
|
65
|
+
|
|
66
|
+
### Hinting
|
|
67
|
+
|
|
68
|
+
| Feature | fonttools | Fontisan |
|
|
69
|
+
|---------|-----------|----------|
|
|
70
|
+
| TrueType instructions | Read | Read |
|
|
71
|
+
| PostScript hints | Read | Read |
|
|
72
|
+
| Hint conversion | ❌ | ✅ |
|
|
73
|
+
| Bidirectional | ❌ | ✅ |
|
|
74
|
+
| Autohint | External | ✅ |
|
|
75
|
+
|
|
76
|
+
### Validation
|
|
77
|
+
|
|
78
|
+
| Feature | fonttools | Fontisan |
|
|
79
|
+
|---------|-----------|----------|
|
|
80
|
+
| Built-in validation | ❌ | ✅ |
|
|
81
|
+
| Validation profiles | ❌ | ✅ (5) |
|
|
82
|
+
| Validation helpers | ❌ | ✅ (56) |
|
|
83
|
+
| Custom validators | ❌ | ✅ |
|
|
84
|
+
| Coverage reports | ❌ | ✅ |
|
|
85
|
+
|
|
86
|
+
### Collections
|
|
87
|
+
|
|
88
|
+
| Feature | fonttools | Fontisan |
|
|
89
|
+
|---------|-----------|----------|
|
|
90
|
+
| TTC/OTC reading | ✅ | ✅ |
|
|
91
|
+
| TTC/OTC writing | ✅ | ✅ |
|
|
92
|
+
| Table deduplication | ✅ | ✅ |
|
|
93
|
+
| dfont support | ✅ | ✅ |
|
|
94
|
+
|
|
95
|
+
## Unique Features
|
|
96
|
+
|
|
97
|
+
### Fontisan Unique
|
|
98
|
+
|
|
99
|
+
- **Pure Ruby** — No Python, no native extensions
|
|
100
|
+
- **Built-in validation** — 5 profiles, 56 helpers
|
|
101
|
+
- **Bidirectional hint conversion** — TrueType ↔ PostScript
|
|
102
|
+
- **Custom validators** — DSL for validation rules
|
|
103
|
+
- **Type 1 roundtrip** — Full conversion support
|
|
104
|
+
|
|
105
|
+
### fonttools Unique
|
|
106
|
+
|
|
107
|
+
- **UFO format** — Full UFO 3 support
|
|
108
|
+
- **FEA parsing** — Adobe Feature Expressions
|
|
109
|
+
- **Designspace** — MutatorMath integration
|
|
110
|
+
- **Extensive ecosystem** — Many third-party tools
|
|
111
|
+
|
|
112
|
+
## Performance
|
|
113
|
+
|
|
114
|
+
### Installation
|
|
115
|
+
|
|
116
|
+
| Metric | fonttools | Fontisan |
|
|
117
|
+
|--------|-----------|----------|
|
|
118
|
+
| Python required | Yes | No |
|
|
119
|
+
| C extensions | Often required | No |
|
|
120
|
+
| Install time | 30-60s | 5-10s |
|
|
121
|
+
| Dependencies | Many | None |
|
|
122
|
+
|
|
123
|
+
### Runtime
|
|
124
|
+
|
|
125
|
+
Both libraries are fast enough for most use cases. Fontisan's pure Ruby approach has minimal overhead for typical operations.
|
|
126
|
+
|
|
127
|
+
## Use Case Recommendations
|
|
128
|
+
|
|
129
|
+
### Use Fontisan When:
|
|
130
|
+
|
|
131
|
+
- You're in a Ruby environment
|
|
132
|
+
- You need validation built-in
|
|
133
|
+
- You need hint conversion
|
|
134
|
+
- You want minimal dependencies
|
|
135
|
+
- You're deploying to constrained environments
|
|
136
|
+
|
|
137
|
+
### Use fonttools When:
|
|
138
|
+
|
|
139
|
+
- You're in a Python environment
|
|
140
|
+
- You need UFO/FEA support
|
|
141
|
+
- You need Designspace support
|
|
142
|
+
- You rely on the Python font ecosystem
|
|
143
|
+
|
|
144
|
+
## Code Comparison
|
|
145
|
+
|
|
146
|
+
### Load and Save
|
|
147
|
+
|
|
148
|
+
```python
|
|
149
|
+
# fonttools
|
|
150
|
+
from fontTools.ttLib import TTFont
|
|
151
|
+
font = TTFont('input.ttf')
|
|
152
|
+
font.save('output.ttf')
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
```ruby
|
|
156
|
+
# Fontisan
|
|
157
|
+
font = Fontisan::FontLoader.load('input.ttf')
|
|
158
|
+
Fontisan::FontWriter.write(font, 'output.ttf')
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Access Table
|
|
162
|
+
|
|
163
|
+
```python
|
|
164
|
+
# fonttools
|
|
165
|
+
name = font['name'].getBestFamilyName()
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
```ruby
|
|
169
|
+
# Fontisan
|
|
170
|
+
name = font.tables['name'].family_name
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Variable Font Instance
|
|
174
|
+
|
|
175
|
+
```python
|
|
176
|
+
# fonttools
|
|
177
|
+
from fontTools.varLib.instancer import instantiateVariableFont
|
|
178
|
+
instance = instantiateVariableFont(font, {'wght': 700})
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
```ruby
|
|
182
|
+
# Fontisan
|
|
183
|
+
writer = Fontisan::Variation::InstanceWriter.new(font)
|
|
184
|
+
instance = writer.generate_instance(wght: 700)
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Migration
|
|
188
|
+
|
|
189
|
+
See [Migrate from fonttools](/guide/migrations/fonttools) for a detailed migration guide.
|
|
190
|
+
|
|
191
|
+
## Conclusion
|
|
192
|
+
|
|
193
|
+
| Need | Recommendation |
|
|
194
|
+
|------|----------------|
|
|
195
|
+
| Ruby environment | Fontisan |
|
|
196
|
+
| Python environment | fonttools |
|
|
197
|
+
| Validation | Fontisan |
|
|
198
|
+
| UFO/FEA | fonttools |
|
|
199
|
+
| Hint conversion | Fontisan |
|
|
200
|
+
| Minimal dependencies | Fontisan |
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Feature Comparisons
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Feature Comparisons
|
|
6
|
+
|
|
7
|
+
Compare Fontisan's capabilities with other popular font processing tools.
|
|
8
|
+
|
|
9
|
+
## Comparison Pages
|
|
10
|
+
|
|
11
|
+
### vs fonttools
|
|
12
|
+
|
|
13
|
+
[→ Compare with fonttools](/guide/comparisons/fonttools)
|
|
14
|
+
|
|
15
|
+
Comprehensive comparison with Python's fonttools library:
|
|
16
|
+
- Font formats (TTF, OTF, TTC, WOFF, WOFF2, Type 1, SVG, UFO)
|
|
17
|
+
- Variable fonts (instancing, conversion, axes)
|
|
18
|
+
- Font conversion (TTF↔OTF, curves, hints)
|
|
19
|
+
- Font validation
|
|
20
|
+
- Color fonts
|
|
21
|
+
- Hinting
|
|
22
|
+
- Collections
|
|
23
|
+
|
|
24
|
+
### vs lcdf-typetools
|
|
25
|
+
|
|
26
|
+
[→ Compare with lcdf-typetools](/guide/comparisons/lcdf-typetools)
|
|
27
|
+
|
|
28
|
+
Comparison with the lcdf-typetools suite (otfinfo, cfftot1, etc.):
|
|
29
|
+
- Font information extraction
|
|
30
|
+
- CFF/Type 1 conversion
|
|
31
|
+
- Font validation
|
|
32
|
+
- Hint handling
|
|
33
|
+
|
|
34
|
+
### vs Font-Validator
|
|
35
|
+
|
|
36
|
+
[→ Compare with Font-Validator](/guide/comparisons/font-validator)
|
|
37
|
+
|
|
38
|
+
Comparison with Microsoft's Font-Validator:
|
|
39
|
+
- Validation profiles
|
|
40
|
+
- Helper coverage
|
|
41
|
+
- Reporting capabilities
|
|
42
|
+
|
|
43
|
+
## Key Advantages
|
|
44
|
+
|
|
45
|
+
### 💎 Pure Ruby
|
|
46
|
+
|
|
47
|
+
Fontisan is 100% pure Ruby with no external dependencies:
|
|
48
|
+
|
|
49
|
+
- **No Python** required (unlike fonttools)
|
|
50
|
+
- **No C++ compilation** needed (unlike lcdf-typetools)
|
|
51
|
+
- **No .NET runtime** required (unlike Font-Validator)
|
|
52
|
+
- Works anywhere Ruby runs — Linux, macOS, Windows, BSD
|
|
53
|
+
|
|
54
|
+
### 🔄 Bidirectional Hint Conversion
|
|
55
|
+
|
|
56
|
+
Fontisan is the **only** library that supports bidirectional hint conversion:
|
|
57
|
+
|
|
58
|
+
- TrueType instructions → PostScript hints
|
|
59
|
+
- PostScript hints → TrueType instructions
|
|
60
|
+
- Automatic hint generation (autohint)
|
|
61
|
+
|
|
62
|
+
### ✅ Built-in Validation
|
|
63
|
+
|
|
64
|
+
Unlike fonttools, Fontisan includes comprehensive validation:
|
|
65
|
+
|
|
66
|
+
- 5 validation profiles
|
|
67
|
+
- 56 validation helpers
|
|
68
|
+
- Custom validation DSL
|
|
69
|
+
- Detailed error reporting
|
|
70
|
+
|
|
71
|
+
### 📦 All-in-One
|
|
72
|
+
|
|
73
|
+
Fontisan combines capabilities from multiple tools:
|
|
74
|
+
|
|
75
|
+
| Capability | fonttools | lcdf-typetools | Font-Validator | Fontisan |
|
|
76
|
+
|-----------|-----------|----------------|----------------|----------|
|
|
77
|
+
| Font conversion | ✅ | ✅ | ❌ | ✅ |
|
|
78
|
+
| Font validation | ❌ | ❌ | ✅ | ✅ |
|
|
79
|
+
| Variable fonts | ✅ | ❌ | ❌ | ✅ |
|
|
80
|
+
| Type 1 support | Partial | ✅ | ❌ | ✅ |
|
|
81
|
+
| Color fonts | ✅ | ❌ | ❌ | ✅ |
|
|
82
|
+
| Hint conversion | ❌ | Partial | ❌ | ✅ |
|
|
83
|
+
| **Pure Ruby** | ❌ | ❌ | ❌ | ✅ |
|