fontisan 0.2.7 → 0.2.8

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 (63) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +103 -0
  3. data/.rubocop_todo.yml +106 -319
  4. data/Gemfile +1 -1
  5. data/README.adoc +81 -14
  6. data/Rakefile +12 -7
  7. data/benchmark/variation_quick_bench.rb +1 -1
  8. data/lib/fontisan/cli.rb +45 -13
  9. data/lib/fontisan/collection/dfont_builder.rb +2 -1
  10. data/lib/fontisan/commands/convert_command.rb +2 -4
  11. data/lib/fontisan/commands/info_command.rb +3 -3
  12. data/lib/fontisan/commands/pack_command.rb +2 -1
  13. data/lib/fontisan/commands/validate_command.rb +157 -6
  14. data/lib/fontisan/converters/collection_converter.rb +22 -13
  15. data/lib/fontisan/converters/svg_generator.rb +2 -1
  16. data/lib/fontisan/converters/woff2_encoder.rb +6 -6
  17. data/lib/fontisan/converters/woff_writer.rb +3 -1
  18. data/lib/fontisan/font_loader.rb +7 -6
  19. data/lib/fontisan/formatters/text_formatter.rb +18 -14
  20. data/lib/fontisan/hints/hint_converter.rb +1 -1
  21. data/lib/fontisan/hints/hint_validator.rb +13 -10
  22. data/lib/fontisan/hints/truetype_instruction_analyzer.rb +15 -8
  23. data/lib/fontisan/hints/truetype_instruction_generator.rb +1 -1
  24. data/lib/fontisan/models/collection_validation_report.rb +104 -0
  25. data/lib/fontisan/models/font_report.rb +24 -0
  26. data/lib/fontisan/models/validation_report.rb +7 -2
  27. data/lib/fontisan/open_type_font.rb +2 -3
  28. data/lib/fontisan/optimizers/charstring_rewriter.rb +1 -1
  29. data/lib/fontisan/optimizers/subroutine_optimizer.rb +6 -2
  30. data/lib/fontisan/subset/glyph_mapping.rb +2 -0
  31. data/lib/fontisan/subset/table_subsetter.rb +2 -2
  32. data/lib/fontisan/tables/cblc.rb +8 -4
  33. data/lib/fontisan/tables/cff/index.rb +2 -0
  34. data/lib/fontisan/tables/cff.rb +6 -3
  35. data/lib/fontisan/tables/cff2/private_dict_blend_handler.rb +1 -1
  36. data/lib/fontisan/tables/cff2.rb +1 -1
  37. data/lib/fontisan/tables/cmap.rb +5 -5
  38. data/lib/fontisan/tables/glyf.rb +8 -10
  39. data/lib/fontisan/tables/head.rb +3 -3
  40. data/lib/fontisan/tables/hhea.rb +4 -4
  41. data/lib/fontisan/tables/maxp.rb +2 -2
  42. data/lib/fontisan/tables/name.rb +1 -1
  43. data/lib/fontisan/tables/os2.rb +8 -8
  44. data/lib/fontisan/tables/post.rb +2 -2
  45. data/lib/fontisan/tables/sbix.rb +5 -4
  46. data/lib/fontisan/true_type_font.rb +2 -3
  47. data/lib/fontisan/utilities/checksum_calculator.rb +0 -44
  48. data/lib/fontisan/validation/collection_validator.rb +4 -2
  49. data/lib/fontisan/validators/basic_validator.rb +11 -21
  50. data/lib/fontisan/validators/font_book_validator.rb +29 -50
  51. data/lib/fontisan/validators/opentype_validator.rb +24 -28
  52. data/lib/fontisan/validators/validator.rb +87 -66
  53. data/lib/fontisan/validators/web_font_validator.rb +16 -21
  54. data/lib/fontisan/version.rb +1 -1
  55. data/lib/fontisan/woff2/glyf_transformer.rb +31 -8
  56. data/lib/fontisan/woff2/hmtx_transformer.rb +2 -1
  57. data/lib/fontisan/woff2/table_transformer.rb +4 -2
  58. data/lib/fontisan/woff2_font.rb +4 -2
  59. data/lib/fontisan/woff_font.rb +2 -2
  60. data/lib/fontisan.rb +2 -2
  61. data/scripts/compare_stack_aware.rb +1 -1
  62. data/scripts/measure_optimization.rb +1 -2
  63. metadata +4 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 39c9d53cc2e783d606e838535f0fe703a74718bd36b1864a7a5070ae0a4e46f2
4
- data.tar.gz: a84826024c22f54279c657ac22c66f9d7f6030f4d46158a16d7801559783b521
3
+ metadata.gz: e9f774cfee2477366d97b8954c481262eedd928b1c5abae59f559e570aafb294
4
+ data.tar.gz: 0f744a6ba709c5e2c6eb0e81e33ec41d4cbe78d0beb6bd3519b395568257d37c
5
5
  SHA512:
6
- metadata.gz: fbb949d64435949177b73be36751fdd3e0a89cfcbfdd3032f2307b825f10148cac330db52807aa2df1558393b55390096266a100e30ca83244b962a6f3e7d5c7
7
- data.tar.gz: c6c0b91fd3d690d126720b135d99b8cd87b706066e38b84b9b2ce44069c8811d710cc271a7df48c8c8e20dc57c1702798347442872708c756df0323f838b63fe
6
+ metadata.gz: 59e98be337dc89d359cdb4d7a8a80749d2b89a2d82dda2280550ccd834143f9191752cdc083179907d01f2d3a87695b9a6758b2ad3d910b4a4af79e919479767
7
+ data.tar.gz: 5913d2f154cbf0961436ac7e85dad4d2f8d64ac4a52d1c9709014a33ed112eaf1a9f3a931a0b7f62e469eba0bd5e87589fe677c0e36c8971f042c850b0abe412
data/.rubocop.yml CHANGED
@@ -7,7 +7,110 @@ inherit_from:
7
7
  # local repo-specific modifications
8
8
  # ...
9
9
 
10
+ AllCops:
11
+ NewCops: enable
12
+
10
13
  plugins:
11
14
  - rubocop-performance
12
15
  - rubocop-rake
13
16
  - rubocop-rspec
17
+
18
+ # Prevent combining loops in WOFF2 SFNT building - the two loops must remain separate
19
+ # to maintain correct SFNT structure (all directory entries first, then all data)
20
+ Style/CombinableLoops:
21
+ Exclude:
22
+ - 'lib/fontisan/woff2_font.rb'
23
+
24
+ # Disable Performance/Size - Index class doesn't have Enumerable methods
25
+ # .count > 0 and .count.zero? are the appropriate checks
26
+ Performance/Size:
27
+ Enabled: false
28
+
29
+ # Disable Style/CollectionQuerying - Using .count.zero? is clearer than .none?
30
+ # for Index classes, and .count > 0 is clearer than .any?
31
+ Style/CollectionQuerying:
32
+ Enabled: false
33
+
34
+ # Disable Style/MapIntoArray - Using .each is sometimes clearer than .map
35
+ # especially when building arrays with complex transformations
36
+ Style/MapIntoArray:
37
+ Enabled: false
38
+
39
+ # Disable Style/HashSlice - Using .select is clearer than .slice for filtering
40
+ # especially when the filter logic is complex
41
+ Style/HashSlice:
42
+ Enabled: false
43
+
44
+ # Disable Performance/CollectionLiteralInLoop - Array literals in loops are fine
45
+ # when they're small (3 elements) and self-documenting
46
+ Performance/CollectionLiteralInLoop:
47
+ Enabled: false
48
+
49
+ # Disable Style/SelfAssignment - Self-assignment branches are needed
50
+ # for signed/unsigned conversion patterns (e.g., x = x >= 0x8000 ? x - 0x10000 : x)
51
+ Style/SelfAssignment:
52
+ Enabled: false
53
+
54
+ # Disable Style/RedundantSelfAssignmentBranch - Self-assignment branches are needed
55
+ # for signed/unsigned conversion patterns in font data parsing
56
+ Style/RedundantSelfAssignmentBranch:
57
+ Enabled: false
58
+
59
+ # Disable Lint/AmbiguousOperatorPrecedence - Expressions are clear enough
60
+ # Adding parentheses would reduce readability for arithmetic operations
61
+ Lint/AmbiguousOperatorPrecedence:
62
+ Enabled: false
63
+
64
+ # Disable Lint/AmbiguousRange - Ranges are clear enough without parentheses
65
+ Lint/AmbiguousRange:
66
+ Enabled: false
67
+
68
+ # Disable Style/ReturnNilInPredicateMethodDefinition - Returning nil is sometimes
69
+ # more appropriate than false for predicate methods that check bounds/index validity
70
+ Style/ReturnNilInPredicateMethodDefinition:
71
+ Enabled: false
72
+
73
+ # Disable Style/ComparableBetween - Using >= and <= is clearer than .between?
74
+ # for numeric comparisons, especially with signed/unsigned conversions
75
+ Style/ComparableBetween:
76
+ Enabled: false
77
+
78
+ # Disable Performance/MapCompact - Using .map {}.compact is clearer than filter_map
79
+ # when the block has complex logic
80
+ Performance/MapCompact:
81
+ Enabled: false
82
+
83
+ # Disable Style/SelectByRegexp - Using .select { |k| k.match?(pattern) } is clearer
84
+ # than grep for complex regex patterns
85
+ Style/SelectByRegexp:
86
+ Enabled: false
87
+
88
+ # Disable Style/FetchEnvVar - Using ENV[] is clearer than ENV.fetch
89
+ # when we want nil to be returned for unset environment variables
90
+ Style/FetchEnvVar:
91
+ Enabled: false
92
+
93
+ # Disable Lint/NonAtomicFileOperation - Existence checks before Dir.mkdir_p
94
+ # are useful for clarity and to avoid spurious failures
95
+ Lint/NonAtomicFileOperation:
96
+ Enabled: false
97
+
98
+ # Disable Style/RedundantInitialize - Initialize calls can be useful
99
+ # for clarity and to ensure parent initialization happens correctly
100
+ Style/RedundantInitialize:
101
+ Enabled: false
102
+
103
+ # Disable Style/SuperArguments - Explicit super arguments are clearer
104
+ # than implicit, especially when the signature might change
105
+ Style/SuperArguments:
106
+ Enabled: false
107
+
108
+ # Disable Layout/LineEndStringConcatenationIndentation - String concatenation
109
+ # indentation is fine as-is for readability
110
+ Layout/LineEndStringConcatenationIndentation:
111
+ Enabled: false
112
+
113
+ # Disable Style/BitwisePredicate - anybits?/nobits?/allbits? require Ruby 3.3+
114
+ # Bitwise AND checks with != 0 are clearer for font bitmasks
115
+ Style/BitwisePredicate:
116
+ Enabled: false