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.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +56 -196
  3. data/Gemfile +1 -1
  4. data/docs/.gitignore +17 -0
  5. data/docs/.vitepress/config.ts +317 -0
  6. data/docs/.vitepress/theme/components/ApiMethod.vue +127 -0
  7. data/docs/.vitepress/theme/components/Badge.vue +51 -0
  8. data/docs/.vitepress/theme/components/FeatureComparison.vue +87 -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 +22 -0
  12. data/docs/.vitepress/theme/style.css +330 -0
  13. data/docs/api/conversion-options.md +141 -0
  14. data/docs/api/converters/curve-converter.md +34 -0
  15. data/docs/api/converters/hint-converter.md +34 -0
  16. data/docs/api/converters/outline-converter.md +27 -0
  17. data/docs/api/font-loader.md +111 -0
  18. data/docs/api/font-writer.md +103 -0
  19. data/docs/api/index.md +79 -0
  20. data/docs/api/models/glyph-accessor.md +43 -0
  21. data/docs/api/models/glyph.md +40 -0
  22. data/docs/api/models/table-analyzer.md +35 -0
  23. data/docs/api/sfnt-font.md +53 -0
  24. data/docs/api/type1-font.md +43 -0
  25. data/docs/api/validators/font-validator.md +31 -0
  26. data/docs/api/validators/helper.md +36 -0
  27. data/docs/api/validators/profile.md +39 -0
  28. data/docs/cli/convert.md +87 -0
  29. data/docs/cli/dump-table.md +110 -0
  30. data/docs/cli/export.md +176 -0
  31. data/docs/cli/features.md +124 -0
  32. data/docs/cli/glyphs.md +90 -0
  33. data/docs/cli/index.md +208 -0
  34. data/docs/cli/info.md +254 -0
  35. data/docs/cli/instance.md +122 -0
  36. data/docs/cli/ls.md +95 -0
  37. data/docs/cli/optical-size.md +94 -0
  38. data/docs/cli/pack.md +125 -0
  39. data/docs/cli/scripts.md +105 -0
  40. data/docs/cli/subset.md +39 -0
  41. data/docs/cli/tables.md +84 -0
  42. data/docs/cli/unicode.md +101 -0
  43. data/docs/cli/validate.md +48 -0
  44. data/docs/cli/variable.md +126 -0
  45. data/docs/cli/version.md +46 -0
  46. data/docs/guide/cli/convert.md +108 -0
  47. data/docs/guide/cli/export.md +138 -0
  48. data/docs/guide/cli/index.md +99 -0
  49. data/docs/guide/cli/info.md +144 -0
  50. data/docs/guide/cli/pack.md +155 -0
  51. data/docs/guide/cli/subset.md +118 -0
  52. data/docs/guide/cli/validate.md +139 -0
  53. data/docs/guide/color-fonts/bitmaps.md +177 -0
  54. data/docs/guide/color-fonts/colr-cpal.md +175 -0
  55. data/docs/guide/color-fonts/index.md +140 -0
  56. data/docs/guide/color-fonts/svg.md +154 -0
  57. data/docs/guide/color.md +51 -0
  58. data/docs/guide/comparisons/font-validator.md +222 -0
  59. data/docs/guide/comparisons/fonttools.md +200 -0
  60. data/docs/guide/comparisons/index.md +83 -0
  61. data/docs/guide/comparisons/lcdf-typetools.md +205 -0
  62. data/docs/guide/contributing.md +279 -0
  63. data/docs/guide/conversion/collections.md +251 -0
  64. data/docs/guide/conversion/curves.md +246 -0
  65. data/docs/guide/conversion/index.md +157 -0
  66. data/docs/guide/conversion/options.md +251 -0
  67. data/docs/guide/conversion/ttf-otf.md +184 -0
  68. data/docs/guide/conversion/type1.md +208 -0
  69. data/docs/guide/conversion/web.md +240 -0
  70. data/docs/guide/conversion.md +39 -0
  71. data/docs/guide/formats/collections.md +147 -0
  72. data/docs/guide/formats/dfont.md +99 -0
  73. data/docs/guide/formats/index.md +65 -0
  74. data/docs/guide/formats/otf.md +103 -0
  75. data/docs/guide/formats/svg.md +97 -0
  76. data/docs/guide/formats/ttf.md +105 -0
  77. data/docs/guide/formats/type1.md +118 -0
  78. data/docs/guide/formats/woff.md +115 -0
  79. data/docs/guide/hinting/autohint.md +141 -0
  80. data/docs/guide/hinting/conversion.md +161 -0
  81. data/docs/guide/hinting/index.md +86 -0
  82. data/docs/guide/hinting/postscript.md +149 -0
  83. data/docs/guide/hinting/truetype.md +135 -0
  84. data/docs/guide/hinting.md +44 -0
  85. data/docs/guide/index.md +152 -0
  86. data/docs/guide/installation.md +116 -0
  87. data/docs/guide/migrations/extract-ttc.md +549 -0
  88. data/docs/guide/migrations/font-validator.md +260 -0
  89. data/docs/guide/migrations/fonttools.md +208 -0
  90. data/docs/guide/migrations/index.md +64 -0
  91. data/docs/guide/migrations/otfinfo.md +197 -0
  92. data/docs/guide/quick-start.md +204 -0
  93. data/docs/guide/type1.md +58 -0
  94. data/docs/guide/universal-outline.md +151 -0
  95. data/docs/guide/validation/custom.md +195 -0
  96. data/docs/guide/validation/helpers.md +188 -0
  97. data/docs/guide/validation/index.md +132 -0
  98. data/docs/guide/validation/profiles.md +156 -0
  99. data/docs/guide/validation.md +47 -0
  100. data/docs/guide/variable-fonts/advanced.md +231 -0
  101. data/docs/guide/variable-fonts/axes.md +209 -0
  102. data/docs/guide/variable-fonts/conversion.md +197 -0
  103. data/docs/guide/variable-fonts/index.md +84 -0
  104. data/docs/guide/variable-fonts/instances.md +187 -0
  105. data/docs/guide/variable-fonts/named-instances.md +194 -0
  106. data/docs/guide/variable-fonts/static.md +168 -0
  107. data/docs/guide/variable.md +58 -0
  108. data/docs/guide/woff.md +59 -0
  109. data/docs/index.md +136 -0
  110. data/docs/lychee.toml +37 -0
  111. data/docs/package-lock.json +2560 -0
  112. data/docs/package.json +15 -0
  113. data/docs/public/apple-touch-icon.png +0 -0
  114. data/docs/public/favicon-96x96.png +0 -0
  115. data/docs/public/favicon.ico +0 -0
  116. data/docs/public/favicon.svg +1 -0
  117. data/docs/public/logo-full.svg +1 -0
  118. data/docs/public/logo.svg +1 -0
  119. data/docs/public/site.webmanifest +21 -0
  120. data/docs/public/web-app-manifest-192x192.png +0 -0
  121. data/docs/public/web-app-manifest-512x512.png +0 -0
  122. data/fontisan.gemspec +1 -1
  123. data/lib/fontisan/commands/features_command.rb +0 -1
  124. data/lib/fontisan/commands/info_command.rb +5 -5
  125. data/lib/fontisan/commands/scripts_command.rb +0 -1
  126. data/lib/fontisan/converters/format_converter.rb +2 -1
  127. data/lib/fontisan/converters/type1_converter.rb +65 -60
  128. data/lib/fontisan/hints/hint_converter.rb +2 -1
  129. data/lib/fontisan/loading_modes.rb +0 -2
  130. data/lib/fontisan/open_type_font.rb +0 -40
  131. data/lib/fontisan/sfnt_font.rb +41 -22
  132. data/lib/fontisan/tables/glyf/compound_glyph.rb +0 -1
  133. data/lib/fontisan/true_type_collection.rb +8 -8
  134. data/lib/fontisan/true_type_font.rb +1 -59
  135. data/lib/fontisan/type1/afm_parser.rb +2 -1
  136. data/lib/fontisan/type1/cff_to_type1_converter.rb +24 -19
  137. data/lib/fontisan/type1/private_dict.rb +28 -7
  138. data/lib/fontisan/type1/seac_expander.rb +22 -17
  139. data/lib/fontisan/variable/delta_applicator.rb +3 -3
  140. data/lib/fontisan/variation/optimizer.rb +0 -1
  141. data/lib/fontisan/version.rb +1 -1
  142. data/lib/fontisan/woff2_font.rb +2 -2
  143. data/lib/fontisan/woff_font.rb +3 -3
  144. data/lib/fontisan.rb +3 -2
  145. metadata +122 -4
@@ -0,0 +1,188 @@
1
+ ---
2
+ title: Validation Helpers
3
+ ---
4
+
5
+ # Validation Helpers
6
+
7
+ Fontisan includes 56 validation helpers organized into categories.
8
+
9
+ ## Table Validation
10
+
11
+ ### required_tables
12
+
13
+ Checks for required OpenType tables.
14
+
15
+ ```ruby
16
+ # Required: name, head, maxp, hhea, post
17
+ # Optional but common: cmap, hmtx, loca, glyf/cff
18
+ ```
19
+
20
+ ### table_checksums
21
+
22
+ Validates table checksums.
23
+
24
+ ### table_lengths
25
+
26
+ Verifies table lengths match headers.
27
+
28
+ ## Name Table Validation
29
+
30
+ ### name_version
31
+
32
+ Validates version string format.
33
+
34
+ ### family_name
35
+
36
+ Checks family name presence and format.
37
+
38
+ ### postscript_name
39
+
40
+ Validates PostScript name compliance.
41
+
42
+ ### name_completeness
43
+
44
+ Verifies all required name records.
45
+
46
+ ### name_encoding
47
+
48
+ Validates name record encoding.
49
+
50
+ ## Head Table Validation
51
+
52
+ ### head_magic
53
+
54
+ Validates magic number (0x5F0F3CF5).
55
+
56
+ ### head_version
57
+
58
+ Checks head table version.
59
+
60
+ ### head_units_per_em
61
+
62
+ Validates UPM value (typically 1000 or 2048).
63
+
64
+ ### head_timestamps
65
+
66
+ Checks created/modified timestamps.
67
+
68
+ ## Metrics Validation
69
+
70
+ ### hhea_metrics
71
+
72
+ Validates horizontal header metrics.
73
+
74
+ ### vhea_metrics
75
+
76
+ Validates vertical header metrics.
77
+
78
+ ### os2_metrics
79
+
80
+ Validates OS/2 table metrics.
81
+
82
+ ### line_gap
83
+
84
+ Checks line gap values.
85
+
86
+ ## Glyph Validation
87
+
88
+ ### glyph_count
89
+
90
+ Verifies glyph count consistency.
91
+
92
+ ### glyph_bounds
93
+
94
+ Validates glyph bounding boxes.
95
+
96
+ ### composite_glyphs
97
+
98
+ Checks composite glyph structure.
99
+
100
+ ### glyph_names
101
+
102
+ Validates glyph naming.
103
+
104
+ ## CMAP Validation
105
+
106
+ ### cmap_presence
107
+
108
+ Checks cmap table presence.
109
+
110
+ ### cmap_format
111
+
112
+ Validates cmap format.
113
+
114
+ ### cmap_coverage
115
+
116
+ Checks Unicode coverage.
117
+
118
+ ### cmap_duplicates
119
+
120
+ Detects duplicate mappings.
121
+
122
+ ## Layout Table Validation
123
+
124
+ ### gsub_validity
125
+
126
+ Validates GSUB table structure.
127
+
128
+ ### gpos_validity
129
+
130
+ Validates GPOS table structure.
131
+
132
+ ### feature_list
133
+
134
+ Checks feature list validity.
135
+
136
+ ### script_list
137
+
138
+ Validates script list.
139
+
140
+ ## Advanced Validation
141
+
142
+ ### hint_validity
143
+
144
+ Validates TrueType hints.
145
+
146
+ ### cff_validity
147
+
148
+ Validates CFF table structure.
149
+
150
+ ### glyf_loca_consistency
151
+
152
+ Checks glyf/loca consistency.
153
+
154
+ ### maxp_accuracy
155
+
156
+ Verifies maxp values accuracy.
157
+
158
+ ## Using Helpers Programmatically
159
+
160
+ ```ruby
161
+ require 'fontisan'
162
+
163
+ font = Fontisan::FontLoader.load('font.ttf')
164
+ validator = Fontisan::Validators::FontValidator.new(font)
165
+
166
+ # Run specific helper
167
+ result = validator.check_required_tables
168
+ puts result.valid? # => true or false
169
+
170
+ # Get all helper results
171
+ results = validator.run_all_helpers
172
+ results.each do |check_id, result|
173
+ puts "#{check_id}: #{result.status}"
174
+ end
175
+ ```
176
+
177
+ ## Helper Categories
178
+
179
+ | Category | Helpers | Focus |
180
+ |----------|---------|-------|
181
+ | Table | 12 | Table structure |
182
+ | Name | 8 | Name records |
183
+ | Head | 6 | Header validation |
184
+ | Metrics | 10 | Font metrics |
185
+ | Glyph | 8 | Glyph data |
186
+ | CMAP | 6 | Character mapping |
187
+ | Layout | 6 | GSUB/GPOS |
188
+ | Advanced | 10 | Complex checks |
@@ -0,0 +1,132 @@
1
+ ---
2
+ title: Validation Overview
3
+ ---
4
+
5
+ # Validation Overview
6
+
7
+ Fontisan provides a comprehensive validation framework for ensuring font quality, structural integrity, and compliance with OpenType specifications.
8
+
9
+ ## Validation Profiles
10
+
11
+ Fontisan includes predefined validation profiles:
12
+
13
+ | Profile | Checks | Speed | Use Case |
14
+ |---------|--------|-------|----------|
15
+ | `indexability` | 8 | Fast | Font discovery and indexing |
16
+ | `usability` | 26 | Medium | Font installation compatibility |
17
+ | `production` | 37 | Full | Comprehensive quality (default) |
18
+ | `web` | 18 | Medium | Web embedding readiness |
19
+ | `spec_compliance` | Full | Slow | OpenType specification compliance |
20
+
21
+ ### List Profiles
22
+
23
+ ```bash
24
+ fontisan validate --list
25
+
26
+ # Available validation profiles:
27
+ # indexability - Fast validation for font discovery
28
+ # usability - Basic usability for installation
29
+ # production - Comprehensive quality checks
30
+ # web - Web embedding and optimization
31
+ # spec_compliance - Full OpenType spec compliance
32
+ ```
33
+
34
+ ## CLI Usage
35
+
36
+ ### Basic Validation
37
+
38
+ ```bash
39
+ # Validate with default profile (production)
40
+ fontisan validate font.ttf
41
+
42
+ # Font: font.ttf
43
+ # Status: VALID
44
+ #
45
+ # Summary:
46
+ # Checks performed: 37
47
+ # Passed: 37
48
+ # Failed: 0
49
+ ```
50
+
51
+ ### With Specific Profile
52
+
53
+ ```bash
54
+ # Validate for web use
55
+ fontisan validate font.ttf -t web
56
+
57
+ # Validate for indexing
58
+ fontisan validate font.ttf -t indexability
59
+ ```
60
+
61
+ ### Output Formats
62
+
63
+ ```bash
64
+ # Table format
65
+ fontisan validate font.ttf -T
66
+
67
+ # CHECK_ID | STATUS | SEVERITY | TABLE
68
+ # ------------------------------------------------------------
69
+ # required_tables | PASS | error | N/A
70
+ # name_version | PASS | error | name
71
+ # family_name | PASS | error | name
72
+ ```
73
+
74
+ ### With Summary
75
+
76
+ ```bash
77
+ fontisan validate font.ttf -t web -S
78
+
79
+ # Failed checks:
80
+ # web_font_tables - Missing required GSUB table
81
+ ```
82
+
83
+ ## Ruby API
84
+
85
+ ### Basic Validation
86
+
87
+ ```ruby
88
+ require 'fontisan'
89
+
90
+ # Validate with default profile
91
+ report = Fontisan.validate('font.ttf')
92
+ puts report.valid? # => true or false
93
+
94
+ # Validate with specific profile
95
+ report = Fontisan.validate('font.ttf', profile: :web)
96
+
97
+ if report.valid?
98
+ puts "Font is valid!"
99
+ else
100
+ puts "Font has #{report.summary.errors} errors"
101
+ end
102
+ ```
103
+
104
+ ### Query Results
105
+
106
+ ```ruby
107
+ report = Fontisan.validate('font.ttf', profile: :production)
108
+
109
+ # Get issues by severity
110
+ fatal_issues = report.fatal_errors
111
+ error_issues = report.errors_only
112
+ warning_issues = report.warnings_only
113
+ info_issues = report.info_only
114
+
115
+ # Get issues by category
116
+ table_issues = report.issues_by_category('table_validation')
117
+
118
+ # Get statistics
119
+ failed_ids = report.failed_check_ids
120
+ pass_rate = report.pass_rate
121
+
122
+ # Export results
123
+ yaml_output = report.to_yaml
124
+ json_output = report.to_json
125
+ summary = report.to_summary # "2 errors, 3 warnings, 0 info"
126
+ ```
127
+
128
+ ## Next Steps
129
+
130
+ - [Validation Profiles](/guide/validation/profiles) — Detailed profile documentation
131
+ - [Validation Helpers](/guide/validation/helpers) — Individual validation checks
132
+ - [Custom Validators](/guide/validation/custom) — Create custom validation rules
@@ -0,0 +1,156 @@
1
+ ---
2
+ title: Validation Profiles
3
+ ---
4
+
5
+ # Validation Profiles
6
+
7
+ Fontisan includes 5 validation profiles for different use cases.
8
+
9
+ ## indexability
10
+
11
+ Fast font discovery and indexing.
12
+
13
+ | Property | Value |
14
+ |----------|-------|
15
+ | Checks | 8 |
16
+ | Focus | Metadata-only |
17
+ | Speed | ~5x faster than production |
18
+
19
+ **Use Cases:**
20
+ - Font indexing systems
21
+ - Quick format verification
22
+ - Batch font discovery
23
+
24
+ ```bash
25
+ fontisan validate font.ttf -t indexability
26
+ ```
27
+
28
+ **Checks Performed:**
29
+ - Font format validity
30
+ - Basic table presence
31
+ - Name table readability
32
+ - Magic number validation
33
+
34
+ ## usability
35
+
36
+ Font installation compatibility.
37
+
38
+ | Property | Value |
39
+ |----------|-------|
40
+ | Checks | 26 |
41
+ | Focus | macOS Font Book compatibility |
42
+ | Speed | Medium |
43
+
44
+ **Use Cases:**
45
+ - Font installation verification
46
+ - Desktop font deployment
47
+ - User-facing font distribution
48
+
49
+ ```bash
50
+ fontisan validate font.ttf -t usability
51
+ ```
52
+
53
+ **Checks Include:**
54
+ - All indexability checks
55
+ - Installation requirements
56
+ - Name table completeness
57
+ - Metrics validity
58
+
59
+ ## production
60
+
61
+ Comprehensive production quality (default).
62
+
63
+ | Property | Value |
64
+ |----------|-------|
65
+ | Checks | 37 |
66
+ | Focus | OpenType spec compliance |
67
+ | Speed | Full |
68
+
69
+ **Use Cases:**
70
+ - Font production pipeline
71
+ - Quality assurance
72
+ - Font release validation
73
+
74
+ ```bash
75
+ fontisan validate font.ttf -t production
76
+ # or
77
+ fontisan validate font.ttf
78
+ ```
79
+
80
+ **Checks Include:**
81
+ - All usability checks
82
+ - OpenType specification compliance
83
+ - Cross-platform compatibility
84
+ - Advanced table validation
85
+
86
+ ## web
87
+
88
+ Web embedding readiness.
89
+
90
+ | Property | Value |
91
+ |----------|-------|
92
+ | Checks | 18 |
93
+ | Focus | Web deployment |
94
+ | Speed | Medium |
95
+
96
+ **Use Cases:**
97
+ - Web font preparation
98
+ - CDN deployment
99
+ - Web performance optimization
100
+
101
+ ```bash
102
+ fontisan validate font.ttf -t web
103
+ ```
104
+
105
+ **Checks Include:**
106
+ - Required web tables
107
+ - Subset compatibility
108
+ - WOFF/WOFF2 readiness
109
+ - Performance optimization
110
+
111
+ ## spec_compliance
112
+
113
+ Full OpenType specification compliance.
114
+
115
+ | Property | Value |
116
+ |----------|-------|
117
+ | Checks | Full |
118
+ | Focus | Detailed analysis |
119
+ | Speed | Slow |
120
+
121
+ **Use Cases:**
122
+ - Font specification audit
123
+ - Certification processes
124
+ - Technical documentation
125
+
126
+ ```bash
127
+ fontisan validate font.ttf -t spec_compliance
128
+ ```
129
+
130
+ **Checks Include:**
131
+ - All production checks
132
+ - Detailed specification analysis
133
+ - Edge case validation
134
+ - Comprehensive reporting
135
+
136
+ ## Profile Comparison
137
+
138
+ | Feature | indexability | usability | production | web | spec |
139
+ |---------|-------------|-----------|------------|-----|------|
140
+ | Basic validation | ✓ | ✓ | ✓ | ✓ | ✓ |
141
+ | Installation checks | - | ✓ | ✓ | - | ✓ |
142
+ | Spec compliance | - | - | ✓ | - | ✓ |
143
+ | Web optimization | - | - | - | ✓ | - |
144
+ | Detailed analysis | - | - | - | - | ✓ |
145
+ | Speed | Fast | Medium | Full | Medium | Slow |
146
+
147
+ ## Choosing a Profile
148
+
149
+ | Task | Recommended Profile |
150
+ |------|---------------------|
151
+ | Indexing fonts | `indexability` |
152
+ | Installing fonts | `usability` |
153
+ | Releasing fonts | `production` |
154
+ | Web deployment | `web` |
155
+ | Specification audit | `spec_compliance` |
156
+ | General use | `production` (default) |
@@ -0,0 +1,47 @@
1
+ # Font Validation
2
+
3
+ Fontisan provides tools to validate font files for correctness and compliance.
4
+
5
+ ## Basic Validation
6
+
7
+ ```ruby
8
+ require 'fontisan'
9
+
10
+ # Validate a font file
11
+ result = Fontisan.validate('font.ttf')
12
+
13
+ if result.valid?
14
+ puts "Font is valid!"
15
+ else
16
+ puts "Validation errors:"
17
+ result.errors.each do |error|
18
+ puts " - #{error}"
19
+ end
20
+ end
21
+ ```
22
+
23
+ ## Validation Options
24
+
25
+ ```ruby
26
+ # Strict validation (includes optional checks)
27
+ result = Fontisan.validate('font.ttf', strict: true)
28
+
29
+ # Validate specific aspects
30
+ result = Fontisan.validate('font.ttf', checks: [:tables, :glyphs, :names])
31
+ ```
32
+
33
+ ## Collection Validation
34
+
35
+ For TrueType/OpenType Collections:
36
+
37
+ ```ruby
38
+ # Validate a TTC file
39
+ result = Fontisan.validate_collection('fonts.ttc')
40
+
41
+ # Validate a specific font within the collection
42
+ result = Fontisan.validate_collection('fonts.ttc', index: 0)
43
+ ```
44
+
45
+ ## Related
46
+
47
+ - [Font Conversion](/guide/conversion) - Convert between formats