fontisan 0.2.7 → 0.2.9

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 (83) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +103 -0
  3. data/.rubocop_todo.yml +65 -361
  4. data/CHANGELOG.md +116 -0
  5. data/Gemfile +1 -1
  6. data/README.adoc +106 -27
  7. data/Rakefile +12 -7
  8. data/benchmark/variation_quick_bench.rb +1 -1
  9. data/docs/APPLE_LEGACY_FONTS.adoc +173 -0
  10. data/docs/COLLECTION_VALIDATION.adoc +143 -0
  11. data/docs/COLOR_FONTS.adoc +127 -0
  12. data/docs/DOCUMENTATION_SUMMARY.md +141 -0
  13. data/docs/FONT_HINTING.adoc +9 -1
  14. data/docs/VALIDATION.adoc +254 -0
  15. data/docs/WOFF_WOFF2_FORMATS.adoc +94 -0
  16. data/lib/fontisan/cli.rb +45 -13
  17. data/lib/fontisan/collection/dfont_builder.rb +2 -1
  18. data/lib/fontisan/commands/convert_command.rb +2 -4
  19. data/lib/fontisan/commands/info_command.rb +3 -3
  20. data/lib/fontisan/commands/pack_command.rb +2 -1
  21. data/lib/fontisan/commands/validate_command.rb +157 -6
  22. data/lib/fontisan/converters/collection_converter.rb +22 -13
  23. data/lib/fontisan/converters/svg_generator.rb +2 -1
  24. data/lib/fontisan/converters/woff2_encoder.rb +6 -6
  25. data/lib/fontisan/converters/woff_writer.rb +3 -1
  26. data/lib/fontisan/font_loader.rb +7 -6
  27. data/lib/fontisan/formatters/text_formatter.rb +18 -14
  28. data/lib/fontisan/hints/hint_converter.rb +1 -1
  29. data/lib/fontisan/hints/hint_validator.rb +13 -10
  30. data/lib/fontisan/hints/truetype_instruction_analyzer.rb +15 -8
  31. data/lib/fontisan/hints/truetype_instruction_generator.rb +1 -1
  32. data/lib/fontisan/models/collection_validation_report.rb +104 -0
  33. data/lib/fontisan/models/font_report.rb +24 -0
  34. data/lib/fontisan/models/validation_report.rb +7 -2
  35. data/lib/fontisan/open_type_font.rb +18 -425
  36. data/lib/fontisan/optimizers/charstring_rewriter.rb +1 -1
  37. data/lib/fontisan/optimizers/subroutine_optimizer.rb +6 -2
  38. data/lib/fontisan/sfnt_font.rb +699 -0
  39. data/lib/fontisan/sfnt_table.rb +264 -0
  40. data/lib/fontisan/subset/glyph_mapping.rb +2 -0
  41. data/lib/fontisan/subset/table_subsetter.rb +2 -2
  42. data/lib/fontisan/tables/cblc.rb +8 -4
  43. data/lib/fontisan/tables/cff/index.rb +2 -0
  44. data/lib/fontisan/tables/cff.rb +6 -3
  45. data/lib/fontisan/tables/cff2/private_dict_blend_handler.rb +1 -1
  46. data/lib/fontisan/tables/cff2.rb +1 -1
  47. data/lib/fontisan/tables/cmap.rb +5 -5
  48. data/lib/fontisan/tables/cmap_table.rb +231 -0
  49. data/lib/fontisan/tables/glyf.rb +8 -10
  50. data/lib/fontisan/tables/glyf_table.rb +255 -0
  51. data/lib/fontisan/tables/head.rb +3 -3
  52. data/lib/fontisan/tables/head_table.rb +111 -0
  53. data/lib/fontisan/tables/hhea.rb +4 -4
  54. data/lib/fontisan/tables/hhea_table.rb +255 -0
  55. data/lib/fontisan/tables/hmtx_table.rb +191 -0
  56. data/lib/fontisan/tables/loca_table.rb +212 -0
  57. data/lib/fontisan/tables/maxp.rb +2 -2
  58. data/lib/fontisan/tables/maxp_table.rb +258 -0
  59. data/lib/fontisan/tables/name.rb +1 -1
  60. data/lib/fontisan/tables/name_table.rb +176 -0
  61. data/lib/fontisan/tables/os2.rb +8 -8
  62. data/lib/fontisan/tables/os2_table.rb +329 -0
  63. data/lib/fontisan/tables/post.rb +2 -2
  64. data/lib/fontisan/tables/post_table.rb +183 -0
  65. data/lib/fontisan/tables/sbix.rb +5 -4
  66. data/lib/fontisan/true_type_font.rb +12 -464
  67. data/lib/fontisan/utilities/checksum_calculator.rb +0 -44
  68. data/lib/fontisan/validation/collection_validator.rb +4 -2
  69. data/lib/fontisan/validators/basic_validator.rb +11 -21
  70. data/lib/fontisan/validators/font_book_validator.rb +29 -50
  71. data/lib/fontisan/validators/opentype_validator.rb +24 -28
  72. data/lib/fontisan/validators/validator.rb +87 -66
  73. data/lib/fontisan/validators/web_font_validator.rb +16 -21
  74. data/lib/fontisan/version.rb +1 -1
  75. data/lib/fontisan/woff2/glyf_transformer.rb +31 -8
  76. data/lib/fontisan/woff2/hmtx_transformer.rb +2 -1
  77. data/lib/fontisan/woff2/table_transformer.rb +4 -2
  78. data/lib/fontisan/woff2_font.rb +4 -2
  79. data/lib/fontisan/woff_font.rb +46 -30
  80. data/lib/fontisan.rb +2 -2
  81. data/scripts/compare_stack_aware.rb +1 -1
  82. data/scripts/measure_optimization.rb +1 -2
  83. metadata +23 -2
data/.rubocop_todo.yml CHANGED
@@ -1,78 +1,29 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2026-01-06 02:07:50 UTC using RuboCop version 1.81.7.
3
+ # on 2026-01-17 02:13:05 UTC using RuboCop version 1.82.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
9
  # Offense count: 1
10
- # Configuration parameters: Severity.
11
10
  Gemspec/RequiredRubyVersion:
12
11
  Exclude:
13
12
  - 'fontisan.gemspec'
14
13
 
15
- # Offense count: 1
16
- # This cop supports safe autocorrection (--autocorrect).
17
- # Configuration parameters: EnforcedStyle, IndentationWidth.
18
- # SupportedStyles: with_first_argument, with_fixed_indentation
19
- Layout/ArgumentAlignment:
20
- Exclude:
21
- - 'lib/fontisan/converters/woff2_encoder.rb'
22
-
23
- # Offense count: 3
24
- # This cop supports safe autocorrection (--autocorrect).
25
- Layout/EmptyLineAfterGuardClause:
26
- Exclude:
27
- - 'lib/fontisan/commands/validate_command.rb'
28
- - 'lib/fontisan/hints/truetype_instruction_analyzer.rb'
29
- - 'lib/fontisan/models/validation_report.rb'
30
-
31
- # Offense count: 1
32
- # This cop supports safe autocorrection (--autocorrect).
33
- Layout/EmptyLinesAroundExceptionHandlingKeywords:
34
- Exclude:
35
- - 'lib/fontisan/hints/hint_validator.rb'
36
-
37
- # Offense count: 32
38
- # This cop supports safe autocorrection (--autocorrect).
39
- # Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
40
- Layout/ExtraSpacing:
41
- Exclude:
42
- - 'lib/fontisan/commands/info_command.rb'
43
- - 'lib/fontisan/hints/truetype_instruction_analyzer.rb'
44
- - 'lib/fontisan/tables/glyf.rb'
45
- - 'lib/fontisan/tables/head.rb'
46
- - 'lib/fontisan/tables/maxp.rb'
47
- - 'lib/fontisan/tables/os2.rb'
48
- - 'lib/fontisan/tables/sbix.rb'
49
- - 'spec/fontisan/tables/sbix_spec.rb'
50
- - 'spec/fontisan/validators/basic_validator_spec.rb'
51
- - 'spec/integration/color_emoji_fonts_spec.rb'
52
- - 'spec/integration/dfont_pack_spec.rb'
53
-
54
- # Offense count: 1313
14
+ # Offense count: 1259
55
15
  # This cop supports safe autocorrection (--autocorrect).
56
- # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
16
+ # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
57
17
  # URISchemes: http, https
58
18
  Layout/LineLength:
59
19
  Enabled: false
60
20
 
61
- # Offense count: 1
62
- # This cop supports safe autocorrection (--autocorrect).
63
- # Configuration parameters: EnforcedStyle.
64
- # SupportedStyles: final_newline, final_blank_line
65
- Layout/TrailingEmptyLines:
66
- Exclude:
67
- - 'lib/fontisan/collection/shared_logic.rb'
68
-
69
- # Offense count: 19
70
- # This cop supports safe autocorrection (--autocorrect).
71
- # Configuration parameters: AllowInHeredoc.
72
- Layout/TrailingWhitespace:
21
+ # Offense count: 3
22
+ Lint/CopDirectiveSyntax:
73
23
  Exclude:
74
- - 'check_dfont.rb'
75
- - 'spec/fontisan/converters/woff2_encoder_integration_spec.rb'
24
+ - 'lib/fontisan/converters/woff_writer.rb'
25
+ - 'lib/fontisan/woff2_font.rb'
26
+ - 'spec/fontisan/variation/cache_spec.rb'
76
27
 
77
28
  # Offense count: 27
78
29
  # Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches, IgnoreDuplicateElseBranch.
@@ -85,13 +36,22 @@ Lint/DuplicateMethods:
85
36
  - 'lib/fontisan/tables/glyf.rb'
86
37
  - 'lib/fontisan/woff2_font.rb'
87
38
 
88
- # Offense count: 2
39
+ # Offense count: 1
40
+ # Configuration parameters: AllowComments.
41
+ Lint/EmptyClass:
42
+ Exclude:
43
+ - 'lib/fontisan.rb'
44
+
45
+ # Offense count: 5
89
46
  # This cop supports safe autocorrection (--autocorrect).
90
47
  # Configuration parameters: AllowComments.
91
48
  Lint/EmptyConditionalBody:
92
49
  Exclude:
93
50
  - 'lib/fontisan/cli.rb'
94
51
  - 'lib/fontisan/variation/variable_svg_generator.rb'
52
+ - 'spec/fontisan/lazy_loading_spec.rb'
53
+ - 'spec/fontisan/loading_modes_spec.rb'
54
+ - 'spec/integration/subroutine_roundtrip_spec.rb'
95
55
 
96
56
  # Offense count: 3
97
57
  Lint/FloatComparison:
@@ -116,51 +76,21 @@ Lint/StructNewOverride:
116
76
  Exclude:
117
77
  - 'lib/fontisan/optimizers/pattern_analyzer.rb'
118
78
 
119
- # Offense count: 22
120
- # This cop supports safe autocorrection (--autocorrect).
121
- # Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
122
- Lint/UnusedBlockArgument:
123
- Exclude:
124
- - 'lib/fontisan/validators/opentype_validator.rb'
125
- - 'spec/fontisan/tables/sbix_spec.rb'
126
- - 'spec/fontisan/validators/profile_loader_spec.rb'
127
- - 'spec/fontisan/validators/validator_spec.rb'
128
-
129
- # Offense count: 13
79
+ # Offense count: 8
130
80
  # This cop supports safe autocorrection (--autocorrect).
131
81
  # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods, NotImplementedExceptions.
132
82
  # NotImplementedExceptions: NotImplementedError
133
83
  Lint/UnusedMethodArgument:
134
84
  Exclude:
135
85
  - 'lib/fontisan.rb'
136
- - 'lib/fontisan/converters/collection_converter.rb'
137
86
  - 'lib/fontisan/font_loader.rb'
138
- - 'lib/fontisan/optimizers/charstring_rewriter.rb'
139
87
  - 'lib/fontisan/tables/cff2/private_dict_blend_handler.rb'
140
- - 'lib/fontisan/tables/glyf.rb'
141
88
  - 'lib/fontisan/utilities/brotli_wrapper.rb'
142
- - 'lib/fontisan/validators/validator.rb'
143
89
  - 'lib/fontisan/variation/table_accessor.rb'
144
90
  - 'lib/fontisan/woff2/glyf_transformer.rb'
145
91
  - 'lib/fontisan/woff_font.rb'
146
92
 
147
- # Offense count: 2
148
- # This cop supports safe autocorrection (--autocorrect).
149
- # Configuration parameters: ContextCreatingMethods, MethodCreatingMethods.
150
- Lint/UselessAccessModifier:
151
- Exclude:
152
- - 'lib/fontisan.rb'
153
- - 'lib/fontisan/tables/cmap.rb'
154
-
155
- # Offense count: 4
156
- # This cop supports safe autocorrection (--autocorrect).
157
- Lint/UselessAssignment:
158
- Exclude:
159
- - 'lib/fontisan/hints/truetype_instruction_analyzer.rb'
160
- - 'spec/fontisan/hints/hint_round_trip_spec.rb'
161
- - 'spec/fontisan/validators/validator_spec.rb'
162
-
163
- # Offense count: 464
93
+ # Offense count: 477
164
94
  # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
165
95
  Metrics/AbcSize:
166
96
  Enabled: false
@@ -169,19 +99,19 @@ Metrics/AbcSize:
169
99
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
170
100
  # AllowedMethods: refine
171
101
  Metrics/BlockLength:
172
- Max: 91
102
+ Max: 80
173
103
 
174
104
  # Offense count: 8
175
105
  # Configuration parameters: CountBlocks, CountModifierForms.
176
106
  Metrics/BlockNesting:
177
107
  Max: 5
178
108
 
179
- # Offense count: 233
109
+ # Offense count: 238
180
110
  # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
181
111
  Metrics/CyclomaticComplexity:
182
112
  Enabled: false
183
113
 
184
- # Offense count: 707
114
+ # Offense count: 786
185
115
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
186
116
  Metrics/MethodLength:
187
117
  Max: 135
@@ -192,11 +122,19 @@ Metrics/ParameterLists:
192
122
  Max: 39
193
123
  MaxOptionalParameters: 4
194
124
 
195
- # Offense count: 171
125
+ # Offense count: 175
196
126
  # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
197
127
  Metrics/PerceivedComplexity:
198
128
  Enabled: false
199
129
 
130
+ # Offense count: 1
131
+ # This cop supports unsafe autocorrection (--autocorrect-all).
132
+ # Configuration parameters: EnforcedStyleForLeadingUnderscores.
133
+ # SupportedStylesForLeadingUnderscores: disallowed, required, optional
134
+ Naming/MemoizedInstanceVariableName:
135
+ Exclude:
136
+ - 'lib/fontisan/sfnt_font.rb'
137
+
200
138
  # Offense count: 17
201
139
  # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
202
140
  # AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
@@ -207,6 +145,23 @@ Naming/MethodParameterName:
207
145
  - 'lib/fontisan/tables/glyf/curve_converter.rb'
208
146
  - 'lib/fontisan/variation/optimizer.rb'
209
147
 
148
+ # Offense count: 12
149
+ # Configuration parameters: Mode, AllowedMethods, AllowedPatterns, AllowBangMethods, WaywardPredicates.
150
+ # AllowedMethods: call
151
+ # WaywardPredicates: nonzero?
152
+ Naming/PredicateMethod:
153
+ Exclude:
154
+ - 'lib/fontisan/collection/builder.rb'
155
+ - 'lib/fontisan/converters/outline_converter.rb'
156
+ - 'lib/fontisan/converters/svg_generator.rb'
157
+ - 'lib/fontisan/converters/table_copier.rb'
158
+ - 'lib/fontisan/converters/woff2_encoder.rb'
159
+ - 'lib/fontisan/optimizers/charstring_rewriter.rb'
160
+ - 'lib/fontisan/sfnt_table.rb'
161
+ - 'lib/fontisan/subset/options.rb'
162
+ - 'lib/fontisan/validation/collection_validator.rb'
163
+ - 'lib/fontisan/variation/metrics_adjuster.rb'
164
+
210
165
  # Offense count: 87
211
166
  # Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
212
167
  # SupportedStyles: snake_case, normalcase, non_integer
@@ -214,32 +169,6 @@ Naming/MethodParameterName:
214
169
  Naming/VariableNumber:
215
170
  Enabled: false
216
171
 
217
- # Offense count: 25
218
- # Configuration parameters: MinSize.
219
- Performance/CollectionLiteralInLoop:
220
- Exclude:
221
- - 'lib/fontisan/collection/builder.rb'
222
- - 'lib/fontisan/open_type_font.rb'
223
- - 'lib/fontisan/tables/cff/charstring.rb'
224
- - 'lib/fontisan/tables/cff/private_dict_writer.rb'
225
- - 'lib/fontisan/tables/cff2.rb'
226
- - 'lib/fontisan/tables/cff2/region_matcher.rb'
227
- - 'lib/fontisan/tables/sbix.rb'
228
- - 'lib/fontisan/true_type_font.rb'
229
- - 'lib/fontisan/variation/validator.rb'
230
- - 'lib/fontisan/woff2/table_transformer.rb'
231
- - 'spec/fontisan/cli_spec.rb'
232
- - 'spec/fontisan/commands/glyphs_command_spec.rb'
233
- - 'spec/fontisan/commands/info_command_spec.rb'
234
- - 'spec/fontisan/commands/tables_command_spec.rb'
235
-
236
- # Offense count: 3
237
- # This cop supports unsafe autocorrection (--autocorrect-all).
238
- Performance/TimesMap:
239
- Exclude:
240
- - 'lib/fontisan/font_loader.rb'
241
- - 'lib/fontisan/tables/cff2.rb'
242
-
243
172
  # Offense count: 23
244
173
  RSpec/AnyInstance:
245
174
  Exclude:
@@ -250,13 +179,13 @@ RSpec/AnyInstance:
250
179
  - 'spec/fontisan/variation/parallel_generator_spec.rb'
251
180
  - 'spec/integration/format_conversion_spec.rb'
252
181
 
253
- # Offense count: 107
182
+ # Offense count: 106
254
183
  # Configuration parameters: Prefixes, AllowedPatterns.
255
184
  # Prefixes: when, with, without
256
185
  RSpec/ContextWording:
257
186
  Enabled: false
258
187
 
259
- # Offense count: 22
188
+ # Offense count: 23
260
189
  # Configuration parameters: IgnoredMetadata.
261
190
  RSpec/DescribeClass:
262
191
  Enabled: false
@@ -267,7 +196,7 @@ RSpec/DescribeMethod:
267
196
  - 'spec/fontisan/collection/variable_font_builder_spec.rb'
268
197
  - 'spec/fontisan/converters/woff2_encoder_integration_spec.rb'
269
198
 
270
- # Offense count: 1280
199
+ # Offense count: 1288
271
200
  # Configuration parameters: CountAsOne.
272
201
  RSpec/ExampleLength:
273
202
  Max: 66
@@ -341,11 +270,11 @@ RSpec/MultipleDescribes:
341
270
  - 'spec/fontisan/utils/thread_pool_spec.rb'
342
271
  - 'spec/fontisan/variation/cache_spec.rb'
343
272
 
344
- # Offense count: 1697
273
+ # Offense count: 1699
345
274
  RSpec/MultipleExpectations:
346
275
  Max: 19
347
276
 
348
- # Offense count: 149
277
+ # Offense count: 150
349
278
  # Configuration parameters: AllowSubject.
350
279
  RSpec/MultipleMemoizedHelpers:
351
280
  Max: 13
@@ -365,9 +294,10 @@ RSpec/NoExpectationExample:
365
294
  - 'spec/fontisan/validators/validator_spec.rb'
366
295
  - 'spec/fontisan/variation/variable_svg_generator_spec.rb'
367
296
 
368
- # Offense count: 11
297
+ # Offense count: 13
369
298
  RSpec/RepeatedExample:
370
299
  Exclude:
300
+ - 'spec/documentation_examples_spec.rb'
371
301
  - 'spec/fontisan/hints/truetype_instruction_generator_spec.rb'
372
302
  - 'spec/fontisan/metrics_calculator_spec.rb'
373
303
  - 'spec/fontisan/tables/os2_spec.rb'
@@ -409,13 +339,7 @@ RSpec/SubjectStub:
409
339
  Exclude:
410
340
  - 'spec/fontisan/variation/delta_applier_spec.rb'
411
341
 
412
- # Offense count: 4
413
- # This cop supports unsafe autocorrection (--autocorrect-all).
414
- RSpec/VerifiedDoubleReference:
415
- Exclude:
416
- - 'spec/fontisan/variation/parallel_generator_spec.rb'
417
-
418
- # Offense count: 289
342
+ # Offense count: 291
419
343
  # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
420
344
  RSpec/VerifiedDoubles:
421
345
  Enabled: false
@@ -430,47 +354,15 @@ Security/Open:
430
354
  Exclude:
431
355
  - 'Rakefile'
432
356
 
433
- # Offense count: 12
434
- # This cop supports safe autocorrection (--autocorrect).
435
- # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
436
- # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
437
- # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
438
- # FunctionalMethods: let, let!, subject, watch
439
- # AllowedMethods: lambda, proc, it
440
- Style/BlockDelimiters:
441
- Exclude:
442
- - 'spec/fontisan/converters/extended_woff2_spec.rb'
443
- - 'spec/fontisan/hints/hint_validator_spec.rb'
444
- - 'spec/fontisan/hints/truetype_instruction_analyzer_spec.rb'
445
- - 'spec/fontisan/tables/colr_spec.rb'
446
- - 'spec/fontisan/tables/cpal_spec.rb'
447
- - 'spec/fontisan/validators/profile_loader_spec.rb'
448
- - 'spec/integration/font_validation_spec.rb'
449
-
450
- # Offense count: 1
451
- # This cop supports unsafe autocorrection (--autocorrect-all).
452
- Style/CombinableLoops:
453
- Exclude:
454
- - 'lib/fontisan/woff2_font.rb'
455
-
456
- # Offense count: 2
457
- # This cop supports safe autocorrection (--autocorrect).
458
- # Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions.
459
- # SupportedStyles: assign_to_condition, assign_inside_condition
460
- Style/ConditionalAssignment:
461
- Exclude:
462
- - 'lib/fontisan/formatters/text_formatter.rb'
463
-
464
- # Offense count: 2
357
+ # Offense count: 4
465
358
  # This cop supports safe autocorrection (--autocorrect).
466
- # Configuration parameters: EnforcedStyle, AllowComments.
467
- # SupportedStyles: empty, nil, both
468
- Style/EmptyElse:
359
+ Style/ComparableClamp:
469
360
  Exclude:
470
- - 'lib/fontisan/commands/convert_command.rb'
471
- - 'lib/fontisan/validators/validator.rb'
361
+ - 'lib/fontisan/tables/cff2/blend_operator.rb'
362
+ - 'lib/fontisan/variable/axis_normalizer.rb'
363
+ - 'lib/fontisan/variation/interpolator.rb'
472
364
 
473
- # Offense count: 17
365
+ # Offense count: 11
474
366
  # This cop supports safe autocorrection (--autocorrect).
475
367
  # Configuration parameters: EnforcedStyle, MaxUnannotatedPlaceholdersAllowed, Mode, AllowedMethods, AllowedPatterns.
476
368
  # SupportedStyles: annotated, template, unannotated
@@ -479,198 +371,10 @@ Style/FormatStringToken:
479
371
  - 'lib/fontisan/formatters/text_formatter.rb'
480
372
  - 'scripts/measure_optimization.rb'
481
373
 
482
- # Offense count: 5
483
- # This cop supports unsafe autocorrection (--autocorrect-all).
484
- # Configuration parameters: AllowedReceivers.
485
- # AllowedReceivers: Thread.current
486
- Style/HashEachMethods:
487
- Exclude:
488
- - 'lib/fontisan/converters/woff_writer.rb'
489
- - 'lib/fontisan/subset/table_subsetter.rb'
490
- - 'spec/fontisan/subset/glyph_mapping_spec.rb'
491
- - 'spec/fontisan/validators/profile_loader_spec.rb'
492
-
493
- # Offense count: 2
374
+ # Offense count: 3
494
375
  # Configuration parameters: MinBranchesCount.
495
376
  Style/HashLikeCase:
496
377
  Exclude:
378
+ - 'lib/fontisan/commands/convert_command.rb'
497
379
  - 'lib/fontisan/commands/unpack_command.rb'
498
380
  - 'lib/fontisan/models/validation_report.rb'
499
-
500
- # Offense count: 1
501
- # This cop supports safe autocorrection (--autocorrect).
502
- # Configuration parameters: AllowIfModifier.
503
- Style/IfInsideElse:
504
- Exclude:
505
- - 'Rakefile'
506
-
507
- # Offense count: 6
508
- # This cop supports safe autocorrection (--autocorrect).
509
- Style/MultilineTernaryOperator:
510
- Exclude:
511
- - 'lib/fontisan/validators/validator.rb'
512
-
513
- # Offense count: 3
514
- # This cop supports safe autocorrection (--autocorrect).
515
- # Configuration parameters: AllowMethodComparison, ComparisonsThreshold.
516
- Style/MultipleComparison:
517
- Exclude:
518
- - 'lib/fontisan/tables/head.rb'
519
- - 'lib/fontisan/tables/name.rb'
520
- - 'lib/fontisan/tables/post.rb'
521
-
522
- # Offense count: 6
523
- # This cop supports safe autocorrection (--autocorrect).
524
- # Configuration parameters: IncludeSemanticChanges.
525
- Style/NonNilCheck:
526
- Exclude:
527
- - 'lib/fontisan/validators/validator.rb'
528
-
529
- # Offense count: 24
530
- # This cop supports unsafe autocorrection (--autocorrect-all).
531
- # Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns.
532
- # SupportedStyles: predicate, comparison
533
- Style/NumericPredicate:
534
- Exclude:
535
- - 'spec/**/*'
536
- - 'lib/fontisan/font_loader.rb'
537
- - 'lib/fontisan/hints/hint_converter.rb'
538
- - 'lib/fontisan/hints/hint_validator.rb'
539
- - 'lib/fontisan/hints/truetype_instruction_analyzer.rb'
540
- - 'lib/fontisan/tables/cff2/private_dict_blend_handler.rb'
541
- - 'lib/fontisan/tables/cmap.rb'
542
- - 'lib/fontisan/tables/head.rb'
543
- - 'lib/fontisan/tables/hhea.rb'
544
- - 'lib/fontisan/tables/name.rb'
545
- - 'lib/fontisan/tables/os2.rb'
546
- - 'lib/fontisan/tables/post.rb'
547
-
548
- # Offense count: 1
549
- # This cop supports safe autocorrection (--autocorrect).
550
- Style/RedundantAssignment:
551
- Exclude:
552
- - 'lib/fontisan/converters/woff2_encoder.rb'
553
-
554
- # Offense count: 1
555
- # This cop supports safe autocorrection (--autocorrect).
556
- Style/RedundantBegin:
557
- Exclude:
558
- - 'lib/fontisan/tables/glyf.rb'
559
-
560
- # Offense count: 10
561
- # This cop supports unsafe autocorrection (--autocorrect-all).
562
- # Configuration parameters: SafeForConstants.
563
- Style/RedundantFetchBlock:
564
- Exclude:
565
- - 'spec/fontisan/variation/cache_spec.rb'
566
-
567
- # Offense count: 3
568
- # This cop supports safe autocorrection (--autocorrect).
569
- # Configuration parameters: EnforcedStyle.
570
- # SupportedStyles: implicit, explicit
571
- Style/RescueStandardError:
572
- Exclude:
573
- - 'lib/fontisan/cli.rb'
574
- - 'lib/fontisan/commands/validate_command.rb'
575
- - 'lib/fontisan/validators/validator.rb'
576
-
577
- # Offense count: 7
578
- # This cop supports unsafe autocorrection (--autocorrect-all).
579
- # Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
580
- # AllowedMethods: present?, blank?, presence, try, try!
581
- Style/SafeNavigation:
582
- Exclude:
583
- - 'lib/fontisan/cli.rb'
584
- - 'lib/fontisan/tables/maxp.rb'
585
- - 'lib/fontisan/tables/os2.rb'
586
- - 'lib/fontisan/validators/validator.rb'
587
-
588
- # Offense count: 1
589
- # This cop supports safe autocorrection (--autocorrect).
590
- # Configuration parameters: AllowModifier.
591
- Style/SoleNestedConditional:
592
- Exclude:
593
- - 'lib/fontisan/hints/hint_validator.rb'
594
-
595
- # Offense count: 4
596
- # This cop supports unsafe autocorrection (--autocorrect-all).
597
- # Configuration parameters: Mode.
598
- Style/StringConcatenation:
599
- Exclude:
600
- - 'spec/fontisan/tables/cbdt_spec.rb'
601
-
602
- # Offense count: 56
603
- # This cop supports safe autocorrection (--autocorrect).
604
- # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
605
- # SupportedStyles: single_quotes, double_quotes
606
- Style/StringLiterals:
607
- Exclude:
608
- - 'check_dfont.rb'
609
- - 'lib/fontisan/commands/convert_command.rb'
610
- - 'lib/fontisan/converters/collection_converter.rb'
611
- - 'lib/fontisan/validators/font_book_validator.rb'
612
- - 'lib/fontisan/validators/opentype_validator.rb'
613
- - 'lib/fontisan/validators/web_font_validator.rb'
614
-
615
- # Offense count: 2
616
- # This cop supports safe autocorrection (--autocorrect).
617
- # Configuration parameters: .
618
- # SupportedStyles: percent, brackets
619
- Style/SymbolArray:
620
- EnforcedStyle: percent
621
- MinSize: 3
622
-
623
- # Offense count: 50
624
- # This cop supports unsafe autocorrection (--autocorrect-all).
625
- # Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, AllowComments.
626
- # AllowedMethods: define_method
627
- Style/SymbolProc:
628
- Exclude:
629
- - 'lib/fontisan/validators/basic_validator.rb'
630
- - 'lib/fontisan/validators/font_book_validator.rb'
631
- - 'lib/fontisan/validators/opentype_validator.rb'
632
- - 'lib/fontisan/validators/web_font_validator.rb'
633
- - 'spec/fontisan/validators/validator_spec.rb'
634
-
635
- # Offense count: 69
636
- # This cop supports safe autocorrection (--autocorrect).
637
- # Configuration parameters: EnforcedStyleForMultiline.
638
- # SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
639
- Style/TrailingCommaInArguments:
640
- Exclude:
641
- - 'lib/fontisan/cli.rb'
642
- - 'lib/fontisan/commands/convert_command.rb'
643
- - 'lib/fontisan/commands/info_command.rb'
644
- - 'spec/fontisan/converters/woff2_encoder_integration_spec.rb'
645
- - 'spec/fontisan/models/validation_report_spec.rb'
646
- - 'spec/fontisan/optimizers/charstring_rewriter_spec.rb'
647
- - 'spec/fontisan/tables/cblc_spec.rb'
648
- - 'spec/fontisan/tables/sbix_spec.rb'
649
- - 'spec/fontisan/validators/basic_validator_spec.rb'
650
- - 'spec/integration/color_emoji_fonts_spec.rb'
651
- - 'spec/integration/dfont_pack_spec.rb'
652
-
653
- # Offense count: 12
654
- # This cop supports safe autocorrection (--autocorrect).
655
- # Configuration parameters: EnforcedStyleForMultiline.
656
- # SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
657
- Style/TrailingCommaInArrayLiteral:
658
- Exclude:
659
- - 'spec/fontisan/hints/truetype_instruction_analyzer_spec.rb'
660
- - 'spec/fontisan/tables/colr_spec.rb'
661
- - 'spec/fontisan/tables/cpal_spec.rb'
662
- - 'spec/fontisan/variation/parallel_generator_spec.rb'
663
-
664
- # Offense count: 1
665
- # This cop supports safe autocorrection (--autocorrect).
666
- # Configuration parameters: EnforcedStyleForMultiline.
667
- # SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
668
- Style/TrailingCommaInHashLiteral:
669
- Exclude:
670
- - 'lib/fontisan/hints/truetype_instruction_generator.rb'
671
-
672
- # Offense count: 1
673
- # This cop supports unsafe autocorrection (--autocorrect-all).
674
- Style/ZeroLengthPredicate:
675
- Exclude:
676
- - 'lib/fontisan/hints/hint_converter.rb'
data/CHANGELOG.md ADDED
@@ -0,0 +1,116 @@
1
+ # Changelog
2
+
3
+ All notable changes to Fontisan will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ### Added
11
+ - Comprehensive documentation for WOFF/WOFF2 format support
12
+ - Color fonts documentation (COLR/CPAL, sbix, SVG tables)
13
+ - Font validation framework documentation
14
+ - Apple legacy font formats documentation ('true' signature, dfont)
15
+ - Font collection validation documentation
16
+ - Updated font hinting documentation
17
+ - Enhanced README with all v0.2.1-v0.2.7 features
18
+
19
+ ### Changed
20
+ - Improved documentation organization with dedicated feature guides
21
+ - Added more examples for command-line and Ruby API usage
22
+
23
+ ## [0.2.7] - 2026-01-06
24
+
25
+ ### Added
26
+ - Collection validation support with per-font reporting
27
+ - CollectionValidationReport model with overall status
28
+ - FontReport model for individual font validation results
29
+ - ValidateCommand.validate_collection method
30
+
31
+ ### Fixed
32
+ - Windows compatibility for collection extraction
33
+ - Various test fixes unrelated to collection validation
34
+
35
+ ## [0.2.6] - 2026-01-05
36
+
37
+ ### Added
38
+ - Apple dfont collection support
39
+ - DfontParser for reading dfont format
40
+ - DfontBuilder for writing dfont format
41
+ - Proper handling of dfont as collection in info command
42
+
43
+ ### Fixed
44
+ - Spec refactor for rubocop compliance
45
+ - Re-enabled previously skipped specs
46
+
47
+ ## [0.2.5] - 2026-01-03
48
+
49
+ ### Added
50
+ - Font validation framework
51
+ - Validator DSL for defining validation checks
52
+ - Predefined validation profiles (indexability, usability, production, web, spec_compliance)
53
+ - ValidationReport model with structured results
54
+ - 56 validation helper methods across 8 OpenType tables
55
+ - ValidateCommand with comprehensive CLI options
56
+
57
+ ### Changed
58
+ - Improved lazy loading performance
59
+ - Removed page size alignment (was causing performance issues)
60
+
61
+ ## [0.2.4] - 2026-01-03
62
+
63
+ ### Fixed
64
+ - Subroutine-related issues
65
+ - Spec fixes
66
+ - Glyph builder fixes
67
+ - Test font fixtures for validation testing
68
+
69
+ ### Added
70
+ - Color fonts support (COLR/CPAL tables)
71
+ - WOFF/WOFF2 conversion support
72
+ - WOFF/WOFF2 info command support
73
+ - WOFF2 validation support
74
+ - ColorGlyph, ColorLayer, ColorPalette models
75
+ - BitmapGlyph, BitmapStrike models
76
+ - SvgGlyph model
77
+ - CBLC, CBDT, COLR, CPAL, sbix, SVG table support
78
+
79
+ ## [0.2.3] - 2025-12-30
80
+
81
+ ### Added
82
+ - WOFF/WOFF2 font version display
83
+ - WOFF2 validation checks
84
+ - Proper TTC/OTC content info handling
85
+ - Collection info displays all fonts with metadata
86
+
87
+ ## [0.2.2] - 2025-12-30
88
+
89
+ ### Added
90
+ - Brief mode for font info command (`--brief` flag)
91
+ - 5x faster font indexing using metadata loading mode
92
+ - Only 13 essential attributes in brief mode
93
+ - Support for 5x performance improvement in batch processing
94
+
95
+ ### Changed
96
+ - README refactor for better organization
97
+
98
+ ## [0.2.1] - 2025-12-28
99
+
100
+ ### Added
101
+ - Proper font hinting implementation
102
+ - Bidirectional TrueType <-> PostScript hint conversion
103
+ - HintValidator for validating converted hints
104
+ - TrueTypeInstructionAnalyzer for analyzing instructions
105
+ - TrueTypeInstructionGenerator for generating instructions
106
+ - Hint round-trip validation
107
+ - CFF2 variable font support for PostScript hints
108
+
109
+ ## [0.2.0] - 2025-12-17
110
+
111
+ ### Added
112
+ - Initial release of Fontisan
113
+ - Basic font conversion capabilities
114
+ - Font information display
115
+ - TTC/OTC collection support
116
+ - Basic validation framework