fontisan 0.2.10 → 0.2.12

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 (46) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +216 -42
  3. data/README.adoc +160 -0
  4. data/lib/fontisan/cli.rb +177 -6
  5. data/lib/fontisan/collection/table_analyzer.rb +88 -3
  6. data/lib/fontisan/commands/convert_command.rb +32 -1
  7. data/lib/fontisan/config/conversion_matrix.yml +132 -4
  8. data/lib/fontisan/constants.rb +12 -0
  9. data/lib/fontisan/conversion_options.rb +378 -0
  10. data/lib/fontisan/converters/cff_table_builder.rb +198 -0
  11. data/lib/fontisan/converters/collection_converter.rb +45 -10
  12. data/lib/fontisan/converters/format_converter.rb +2 -0
  13. data/lib/fontisan/converters/glyf_table_builder.rb +63 -0
  14. data/lib/fontisan/converters/outline_converter.rb +111 -374
  15. data/lib/fontisan/converters/outline_extraction.rb +93 -0
  16. data/lib/fontisan/converters/outline_optimizer.rb +89 -0
  17. data/lib/fontisan/converters/type1_converter.rb +559 -0
  18. data/lib/fontisan/font_loader.rb +46 -3
  19. data/lib/fontisan/glyph_accessor.rb +29 -1
  20. data/lib/fontisan/type1/afm_generator.rb +436 -0
  21. data/lib/fontisan/type1/afm_parser.rb +298 -0
  22. data/lib/fontisan/type1/agl.rb +456 -0
  23. data/lib/fontisan/type1/charstring_converter.rb +240 -0
  24. data/lib/fontisan/type1/charstrings.rb +408 -0
  25. data/lib/fontisan/type1/conversion_options.rb +243 -0
  26. data/lib/fontisan/type1/decryptor.rb +183 -0
  27. data/lib/fontisan/type1/encodings.rb +697 -0
  28. data/lib/fontisan/type1/font_dictionary.rb +514 -0
  29. data/lib/fontisan/type1/generator.rb +220 -0
  30. data/lib/fontisan/type1/inf_generator.rb +332 -0
  31. data/lib/fontisan/type1/pfa_generator.rb +343 -0
  32. data/lib/fontisan/type1/pfa_parser.rb +158 -0
  33. data/lib/fontisan/type1/pfb_generator.rb +291 -0
  34. data/lib/fontisan/type1/pfb_parser.rb +166 -0
  35. data/lib/fontisan/type1/pfm_generator.rb +610 -0
  36. data/lib/fontisan/type1/pfm_parser.rb +433 -0
  37. data/lib/fontisan/type1/private_dict.rb +285 -0
  38. data/lib/fontisan/type1/ttf_to_type1_converter.rb +327 -0
  39. data/lib/fontisan/type1/upm_scaler.rb +118 -0
  40. data/lib/fontisan/type1.rb +73 -0
  41. data/lib/fontisan/type1_font.rb +331 -0
  42. data/lib/fontisan/variation/cache.rb +1 -0
  43. data/lib/fontisan/version.rb +1 -1
  44. data/lib/fontisan/woff2_font.rb +3 -3
  45. data/lib/fontisan.rb +2 -0
  46. metadata +30 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 56f9d8ef4cfdc6eff4a70e8a6c658d276342e2ef11a272e2ba4e683fa8b1ce6e
4
- data.tar.gz: a6a0102247dbd1069785afab4b296bc2ade281be5e81526aa3e89029ca61ac56
3
+ metadata.gz: b67e8e2428844b9c61766fffe36934694f4572373b1bd3ab1cfbe3348aa5d9f2
4
+ data.tar.gz: 4f80609efc6ce157565a60f813f6f95f1ccd6e04636c58d93dba07ebcb6d6a16
5
5
  SHA512:
6
- metadata.gz: f8e8b4df368e19a52bf9c3bc3c2e0d58cb33f7d2235c67b5f077abfa2a4ca1b2e00c21b29d9c56e72cbb167d43b178d295bc95676518c9de7d0c66a3fbc52383
7
- data.tar.gz: 7e42e9a834e044c5577523a22a32d79eb92a32769e244c24c1b52cfe6242a2dbb4da0370e536abc8e66cbdfb38ee5eecc53e68e238a643902dc06105d08ac62c
6
+ metadata.gz: 5c3e35aaf576698dca9937305b4e422fe89e6f5dc3427ab5f54bdf12f72785fe6eb05649d850077d9fa7133e42ca9cd20eae0c4fa2c60911b9576cad92d5fe55
7
+ data.tar.gz: f9debe8c4d0706012a37abc30b30c35bc6508523d7946d270824f0a61f650ed2596c52b666589464004182950ccf3083972e520f1767c698c2c337da269e201d
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2026-01-17 04:54:25 UTC using RuboCop version 1.82.1.
3
+ # on 2026-01-19 14:07:09 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
@@ -11,20 +11,107 @@ Gemspec/RequiredRubyVersion:
11
11
  Exclude:
12
12
  - 'fontisan.gemspec'
13
13
 
14
+ # Offense count: 10
15
+ # This cop supports safe autocorrection (--autocorrect).
16
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
17
+ # SupportedStyles: with_first_argument, with_fixed_indentation
18
+ Layout/ArgumentAlignment:
19
+ Exclude:
20
+ - 'lib/fontisan/cli.rb'
21
+ - 'spec/fontisan/converters/type1_converter_spec.rb'
22
+
23
+ # Offense count: 3
24
+ # This cop supports safe autocorrection (--autocorrect).
25
+ # Configuration parameters: EnforcedStyleAlignWith.
26
+ # SupportedStylesAlignWith: either, start_of_block, start_of_line
27
+ Layout/BlockAlignment:
28
+ Exclude:
29
+ - 'spec/fontisan/converters/collection_converter_spec.rb'
30
+
31
+ # Offense count: 1
32
+ # This cop supports safe autocorrection (--autocorrect).
33
+ Layout/BlockEndNewline:
34
+ Exclude:
35
+ - 'spec/fontisan/converters/collection_converter_spec.rb'
36
+
37
+ # Offense count: 2
38
+ # This cop supports safe autocorrection (--autocorrect).
39
+ Layout/ClosingParenthesisIndentation:
40
+ Exclude:
41
+ - 'spec/fontisan/type1/pfm_parser_spec.rb'
42
+
43
+ # Offense count: 4
44
+ # This cop supports safe autocorrection (--autocorrect).
45
+ # Configuration parameters: AllowForAlignment.
46
+ Layout/CommentIndentation:
47
+ Exclude:
48
+ - 'spec/fontisan/converters/collection_converter_spec.rb'
49
+
50
+ # Offense count: 2
51
+ # This cop supports safe autocorrection (--autocorrect).
52
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
53
+ # SupportedStyles: consistent, consistent_relative_to_receiver, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
54
+ Layout/FirstArgumentIndentation:
55
+ Exclude:
56
+ - 'spec/fontisan/type1/pfm_parser_spec.rb'
57
+
58
+ # Offense count: 10
59
+ # This cop supports safe autocorrection (--autocorrect).
60
+ # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
61
+ # SupportedHashRocketStyles: key, separator, table
62
+ # SupportedColonStyles: key, separator, table
63
+ # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
64
+ Layout/HashAlignment:
65
+ Exclude:
66
+ - 'lib/fontisan/cli.rb'
67
+ - 'spec/fontisan/commands/convert_command_spec.rb'
68
+ - 'spec/fontisan/converters/type1_converter_spec.rb'
69
+
14
70
  # Offense count: 2
15
71
  # This cop supports safe autocorrection (--autocorrect).
16
- # Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
17
- Layout/ExtraSpacing:
72
+ # Configuration parameters: EnforcedStyle.
73
+ # SupportedStyles: normal, indented_internal_methods
74
+ Layout/IndentationConsistency:
18
75
  Exclude:
19
- - 'lib/fontisan/sfnt_font.rb'
76
+ - 'spec/fontisan/converters/collection_converter_spec.rb'
20
77
 
21
- # Offense count: 1259
78
+ # Offense count: 4
79
+ # This cop supports safe autocorrection (--autocorrect).
80
+ # Configuration parameters: Width, AllowedPatterns.
81
+ Layout/IndentationWidth:
82
+ Exclude:
83
+ - 'spec/fontisan/converters/collection_converter_spec.rb'
84
+
85
+ # Offense count: 1437
22
86
  # This cop supports safe autocorrection (--autocorrect).
23
87
  # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
24
88
  # URISchemes: http, https
25
89
  Layout/LineLength:
26
90
  Enabled: false
27
91
 
92
+ # Offense count: 2
93
+ # This cop supports safe autocorrection (--autocorrect).
94
+ # Configuration parameters: EnforcedStyle.
95
+ # SupportedStyles: symmetrical, new_line, same_line
96
+ Layout/MultilineMethodCallBraceLayout:
97
+ Exclude:
98
+ - 'spec/fontisan/type1/pfm_parser_spec.rb'
99
+
100
+ # Offense count: 1
101
+ # This cop supports safe autocorrection (--autocorrect).
102
+ # Configuration parameters: EnforcedStyle.
103
+ # SupportedStyles: final_newline, final_blank_line
104
+ Layout/TrailingEmptyLines:
105
+ Exclude:
106
+ - 'spec/fontisan/converters/type1_converter_spec.rb'
107
+
108
+ # Offense count: 4
109
+ # This cop supports safe autocorrection (--autocorrect).
110
+ # Configuration parameters: AllowInHeredoc.
111
+ Layout/TrailingWhitespace:
112
+ Exclude:
113
+ - 'spec/fontisan/converters/type1_converter_spec.rb'
114
+
28
115
  # Offense count: 3
29
116
  Lint/CopDirectiveSyntax:
30
117
  Exclude:
@@ -32,15 +119,16 @@ Lint/CopDirectiveSyntax:
32
119
  - 'lib/fontisan/woff2_font.rb'
33
120
  - 'spec/fontisan/variation/cache_spec.rb'
34
121
 
35
- # Offense count: 27
122
+ # Offense count: 34
36
123
  # Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches, IgnoreDuplicateElseBranch.
37
124
  Lint/DuplicateBranch:
38
125
  Enabled: false
39
126
 
40
- # Offense count: 2
127
+ # Offense count: 6
41
128
  Lint/DuplicateMethods:
42
129
  Exclude:
43
130
  - 'lib/fontisan/tables/glyf.rb'
131
+ - 'lib/fontisan/type1_font.rb'
44
132
  - 'lib/fontisan/woff2_font.rb'
45
133
 
46
134
  # Offense count: 1
@@ -65,11 +153,13 @@ Lint/FloatComparison:
65
153
  Exclude:
66
154
  - 'lib/fontisan/tables/post.rb'
67
155
 
68
- # Offense count: 3
156
+ # Offense count: 6
69
157
  Lint/IneffectiveAccessModifier:
70
158
  Exclude:
159
+ - 'lib/fontisan/conversion_options.rb'
71
160
  - 'lib/fontisan/models/outline.rb'
72
161
  - 'lib/fontisan/models/ttx/tables/binary_table.rb'
162
+ - 'lib/fontisan/type1/generator.rb'
73
163
 
74
164
  # Offense count: 2
75
165
  # Configuration parameters: AllowedParentClasses.
@@ -83,6 +173,13 @@ Lint/StructNewOverride:
83
173
  Exclude:
84
174
  - 'lib/fontisan/optimizers/pattern_analyzer.rb'
85
175
 
176
+ # Offense count: 2
177
+ # This cop supports safe autocorrection (--autocorrect).
178
+ # Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
179
+ Lint/UnusedBlockArgument:
180
+ Exclude:
181
+ - 'spec/fontisan/converters/type1_converter_spec.rb'
182
+
86
183
  # Offense count: 8
87
184
  # This cop supports safe autocorrection (--autocorrect).
88
185
  # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods, NotImplementedExceptions.
@@ -97,7 +194,13 @@ Lint/UnusedMethodArgument:
97
194
  - 'lib/fontisan/woff2/glyf_transformer.rb'
98
195
  - 'lib/fontisan/woff_font.rb'
99
196
 
100
- # Offense count: 477
197
+ # Offense count: 5
198
+ Lint/UselessConstantScoping:
199
+ Exclude:
200
+ - 'lib/fontisan/conversion_options.rb'
201
+ - 'lib/fontisan/type1/charstrings.rb'
202
+
203
+ # Offense count: 527
101
204
  # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
102
205
  Metrics/AbcSize:
103
206
  Enabled: false
@@ -113,28 +216,35 @@ Metrics/BlockLength:
113
216
  Metrics/BlockNesting:
114
217
  Max: 5
115
218
 
116
- # Offense count: 238
219
+ # Offense count: 2
220
+ # Configuration parameters: LengthThreshold.
221
+ Metrics/CollectionLiteralLength:
222
+ Exclude:
223
+ - 'lib/fontisan/type1/agl.rb'
224
+ - 'lib/fontisan/type1/encodings.rb'
225
+
226
+ # Offense count: 283
117
227
  # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
118
228
  Metrics/CyclomaticComplexity:
119
229
  Enabled: false
120
230
 
121
- # Offense count: 785
231
+ # Offense count: 874
122
232
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
123
233
  Metrics/MethodLength:
124
234
  Max: 135
125
235
 
126
- # Offense count: 20
236
+ # Offense count: 22
127
237
  # Configuration parameters: CountKeywordArgs.
128
238
  Metrics/ParameterLists:
129
239
  Max: 39
130
240
  MaxOptionalParameters: 4
131
241
 
132
- # Offense count: 175
242
+ # Offense count: 214
133
243
  # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
134
244
  Metrics/PerceivedComplexity:
135
245
  Enabled: false
136
246
 
137
- # Offense count: 17
247
+ # Offense count: 20
138
248
  # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
139
249
  # AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
140
250
  Naming/MethodParameterName:
@@ -142,9 +252,10 @@ Naming/MethodParameterName:
142
252
  - 'lib/fontisan/optimizers/subroutine_optimizer.rb'
143
253
  - 'lib/fontisan/tables/cff2/blend_operator.rb'
144
254
  - 'lib/fontisan/tables/glyf/curve_converter.rb'
255
+ - 'lib/fontisan/type1/ttf_to_type1_converter.rb'
145
256
  - 'lib/fontisan/variation/optimizer.rb'
146
257
 
147
- # Offense count: 12
258
+ # Offense count: 13
148
259
  # Configuration parameters: Mode, AllowedMethods, AllowedPatterns, AllowBangMethods, WaywardPredicates.
149
260
  # AllowedMethods: call
150
261
  # WaywardPredicates: nonzero?
@@ -154,6 +265,7 @@ Naming/PredicateMethod:
154
265
  - 'lib/fontisan/converters/outline_converter.rb'
155
266
  - 'lib/fontisan/converters/svg_generator.rb'
156
267
  - 'lib/fontisan/converters/table_copier.rb'
268
+ - 'lib/fontisan/converters/type1_converter.rb'
157
269
  - 'lib/fontisan/converters/woff2_encoder.rb'
158
270
  - 'lib/fontisan/optimizers/charstring_rewriter.rb'
159
271
  - 'lib/fontisan/sfnt_table.rb'
@@ -161,7 +273,26 @@ Naming/PredicateMethod:
161
273
  - 'lib/fontisan/validation/collection_validator.rb'
162
274
  - 'lib/fontisan/variation/metrics_adjuster.rb'
163
275
 
164
- # Offense count: 87
276
+ # Offense count: 1
277
+ # Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros, UseSorbetSigs.
278
+ # NamePrefix: is_, has_, have_, does_
279
+ # ForbiddenPrefixes: is_, has_, have_, does_
280
+ # AllowedMethods: is_a?
281
+ # MethodDefinitionMacros: define_method, define_singleton_method
282
+ Naming/PredicatePrefix:
283
+ Exclude:
284
+ - '../../../.cache/rubocop_cache/spec/**/*'
285
+ - 'lib/fontisan/type1/afm_generator.rb'
286
+
287
+ # Offense count: 21
288
+ # Configuration parameters: EnforcedStyle, AllowedIdentifiers, AllowedPatterns, ForbiddenIdentifiers, ForbiddenPatterns.
289
+ # SupportedStyles: snake_case, camelCase
290
+ Naming/VariableName:
291
+ Exclude:
292
+ - 'lib/fontisan/type1/pfm_generator.rb'
293
+ - 'lib/fontisan/type1/pfm_parser.rb'
294
+
295
+ # Offense count: 112
165
296
  # Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
166
297
  # SupportedStyles: snake_case, normalcase, non_integer
167
298
  # AllowedIdentifiers: TLS1_1, TLS1_2, capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
@@ -178,7 +309,7 @@ RSpec/AnyInstance:
178
309
  - 'spec/fontisan/variation/parallel_generator_spec.rb'
179
310
  - 'spec/integration/format_conversion_spec.rb'
180
311
 
181
- # Offense count: 106
312
+ # Offense count: 113
182
313
  # Configuration parameters: Prefixes, AllowedPatterns.
183
314
  # Prefixes: when, with, without
184
315
  RSpec/ContextWording:
@@ -189,18 +320,21 @@ RSpec/ContextWording:
189
320
  RSpec/DescribeClass:
190
321
  Enabled: false
191
322
 
192
- # Offense count: 2
323
+ # Offense count: 5
193
324
  RSpec/DescribeMethod:
194
325
  Exclude:
195
326
  - 'spec/fontisan/collection/variable_font_builder_spec.rb'
196
327
  - 'spec/fontisan/converters/woff2_encoder_integration_spec.rb'
328
+ - 'spec/fontisan/type1/afm_parser_spec.rb'
329
+ - 'spec/fontisan/type1/pfm_parser_spec.rb'
330
+ - 'spec/fontisan/type1_real_fonts_spec.rb'
197
331
 
198
- # Offense count: 1288
332
+ # Offense count: 1370
199
333
  # Configuration parameters: CountAsOne.
200
334
  RSpec/ExampleLength:
201
335
  Max: 66
202
336
 
203
- # Offense count: 8
337
+ # Offense count: 9
204
338
  # This cop supports safe autocorrection (--autocorrect).
205
339
  RSpec/ExpectActual:
206
340
  Exclude:
@@ -209,6 +343,7 @@ RSpec/ExpectActual:
209
343
  - 'spec/fontisan/converters/extended_woff2_spec.rb'
210
344
  - 'spec/fontisan/converters/woff2_round_trip_spec.rb'
211
345
  - 'spec/fontisan/subset/builder_spec.rb'
346
+ - 'spec/fontisan/type1_real_fonts_spec.rb'
212
347
  - 'spec/fontisan/utils/thread_pool_spec.rb'
213
348
  - 'spec/fontisan/validators/basic_validator_spec.rb'
214
349
  - 'spec/fontisan/variation/validator_spec.rb'
@@ -246,7 +381,7 @@ RSpec/IteratedExpectation:
246
381
  Exclude:
247
382
  - 'spec/fontisan/tables/glyf_spec.rb'
248
383
 
249
- # Offense count: 19
384
+ # Offense count: 25
250
385
  # Configuration parameters: EnforcedStyle.
251
386
  # SupportedStyles: have_received, receive
252
387
  RSpec/MessageSpies:
@@ -255,6 +390,8 @@ RSpec/MessageSpies:
255
390
  - 'spec/fontisan/collection/variable_font_builder_spec.rb'
256
391
  - 'spec/fontisan/commands/pack_command_spec.rb'
257
392
  - 'spec/fontisan/commands/unpack_command_spec.rb'
393
+ - 'spec/fontisan/converters/outline_converter_spec.rb'
394
+ - 'spec/fontisan/converters/type1_converter_spec.rb'
258
395
  - 'spec/fontisan/glyph_accessor_spec.rb'
259
396
  - 'spec/fontisan/metrics_calculator_spec.rb'
260
397
  - 'spec/fontisan/subset/builder_spec.rb'
@@ -269,7 +406,7 @@ RSpec/MultipleDescribes:
269
406
  - 'spec/fontisan/utils/thread_pool_spec.rb'
270
407
  - 'spec/fontisan/variation/cache_spec.rb'
271
408
 
272
- # Offense count: 1699
409
+ # Offense count: 1793
273
410
  RSpec/MultipleExpectations:
274
411
  Max: 19
275
412
 
@@ -293,6 +430,12 @@ RSpec/NoExpectationExample:
293
430
  - 'spec/fontisan/validators/validator_spec.rb'
294
431
  - 'spec/fontisan/variation/variable_svg_generator_spec.rb'
295
432
 
433
+ # Offense count: 7
434
+ # This cop supports unsafe autocorrection (--autocorrect-all).
435
+ RSpec/ReceiveMessages:
436
+ Exclude:
437
+ - 'spec/fontisan/converters/type1_converter_spec.rb'
438
+
296
439
  # Offense count: 13
297
440
  RSpec/RepeatedExample:
298
441
  Exclude:
@@ -301,27 +444,19 @@ RSpec/RepeatedExample:
301
444
  - 'spec/fontisan/metrics_calculator_spec.rb'
302
445
  - 'spec/fontisan/tables/os2_spec.rb'
303
446
 
304
- # Offense count: 15
447
+ # Offense count: 2
448
+ # This cop supports safe autocorrection (--autocorrect).
449
+ # Configuration parameters: EnforcedStyle.
450
+ # SupportedStyles: and_return, block
451
+ RSpec/ReturnFromStub:
452
+ Exclude:
453
+ - 'spec/fontisan/converters/type1_converter_spec.rb'
454
+
455
+ # Offense count: 20
305
456
  # Configuration parameters: CustomTransform, IgnoreMethods, IgnoreMetadata, InflectorPath, EnforcedInflector.
306
457
  # SupportedInflectors: default, active_support
307
458
  RSpec/SpecFilePathFormat:
308
- Exclude:
309
- - '**/spec/routing/**/*'
310
- - 'spec/fontisan/collection/variable_font_builder_spec.rb'
311
- - 'spec/fontisan/hints/postscript_hint_applier_spec.rb'
312
- - 'spec/fontisan/hints/postscript_hint_extractor_spec.rb'
313
- - 'spec/fontisan/hints/truetype_hint_applier_spec.rb'
314
- - 'spec/fontisan/hints/truetype_hint_extractor_spec.rb'
315
- - 'spec/fontisan/hints/truetype_instruction_analyzer_spec.rb'
316
- - 'spec/fontisan/hints/truetype_instruction_generator_spec.rb'
317
- - 'spec/fontisan/tables/cff/charstring_builder_spec.rb'
318
- - 'spec/fontisan/tables/cff/charstring_parser_spec.rb'
319
- - 'spec/fontisan/tables/cff/charstring_rebuilder_spec.rb'
320
- - 'spec/fontisan/tables/cff/charstring_spec.rb'
321
- - 'spec/fontisan/tables/glyf/curve_converter_spec.rb'
322
- - 'spec/fontisan/tables/glyf/glyph_builder_spec.rb'
323
- - 'spec/fontisan/validators/opentype_validator_spec.rb'
324
- - 'spec/fontisan/woff2/header_spec.rb'
459
+ Enabled: false
325
460
 
326
461
  # Offense count: 1
327
462
  RSpec/SpecFilePathSuffix:
@@ -338,7 +473,7 @@ RSpec/SubjectStub:
338
473
  Exclude:
339
474
  - 'spec/fontisan/variation/delta_applier_spec.rb'
340
475
 
341
- # Offense count: 291
476
+ # Offense count: 294
342
477
  # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
343
478
  RSpec/VerifiedDoubles:
344
479
  Enabled: false
@@ -353,11 +488,25 @@ Security/Open:
353
488
  Exclude:
354
489
  - 'Rakefile'
355
490
 
356
- # Offense count: 4
491
+ # Offense count: 11
492
+ # This cop supports safe autocorrection (--autocorrect).
493
+ # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
494
+ # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
495
+ # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
496
+ # FunctionalMethods: let, let!, subject, watch
497
+ # AllowedMethods: lambda, proc, it
498
+ Style/BlockDelimiters:
499
+ Exclude:
500
+ - 'spec/fontisan/converters/collection_converter_spec.rb'
501
+ - 'spec/fontisan/converters/outline_converter_spec.rb'
502
+ - 'spec/fontisan/converters/type1_converter_spec.rb'
503
+
504
+ # Offense count: 6
357
505
  # This cop supports safe autocorrection (--autocorrect).
358
506
  Style/ComparableClamp:
359
507
  Exclude:
360
508
  - 'lib/fontisan/tables/cff2/blend_operator.rb'
509
+ - 'lib/fontisan/type1/pfm_generator.rb'
361
510
  - 'lib/fontisan/variable/axis_normalizer.rb'
362
511
  - 'lib/fontisan/variation/interpolator.rb'
363
512
 
@@ -377,3 +526,28 @@ Style/HashLikeCase:
377
526
  - 'lib/fontisan/commands/convert_command.rb'
378
527
  - 'lib/fontisan/commands/unpack_command.rb'
379
528
  - 'lib/fontisan/models/validation_report.rb'
529
+
530
+ # Offense count: 1
531
+ # Configuration parameters: AllowedMethods.
532
+ # AllowedMethods: respond_to_missing?
533
+ Style/OptionalBooleanParameter:
534
+ Exclude:
535
+ - 'lib/fontisan/conversion_options.rb'
536
+
537
+ # Offense count: 7
538
+ # This cop supports safe autocorrection (--autocorrect).
539
+ # Configuration parameters: EnforcedStyleForMultiline.
540
+ # SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
541
+ Style/TrailingCommaInArguments:
542
+ Exclude:
543
+ - 'spec/fontisan/commands/convert_command_spec.rb'
544
+ - 'spec/fontisan/converters/outline_converter_spec.rb'
545
+ - 'spec/fontisan/converters/type1_converter_spec.rb'
546
+
547
+ # Offense count: 2
548
+ # This cop supports safe autocorrection (--autocorrect).
549
+ # Configuration parameters: EnforcedStyleForMultiline.
550
+ # SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
551
+ Style/TrailingCommaInHashLiteral:
552
+ Exclude:
553
+ - 'spec/fontisan/converters/collection_converter_spec.rb'
data/README.adoc CHANGED
@@ -2045,6 +2045,166 @@ All TrueType fonts are converted to OpenType/CFF format.
2045
2045
  ====
2046
2046
 
2047
2047
 
2048
+ == Font conversion options
2049
+
2050
+ === General
2051
+
2052
+ Fontisan provides a comprehensive conversion options system based on the TypeTool 3
2053
+ manual's recommended options for different font format conversions. The system supports:
2054
+
2055
+ * Format-specific default options
2056
+ * Named presets for common workflows
2057
+ * Fine-grained control over conversion behavior
2058
+ * Type-safe option validation
2059
+
2060
+ The conversion options system gives you control over how fonts are converted between
2061
+ formats, with options for opening (reading) fonts and generating (writing) fonts.
2062
+
2063
+ For complete documentation, see link:docs/CONVERSION_GUIDE.adoc[Conversion Guide]
2064
+ and link:docs/TYPE1_FONTS.adoc[Type 1 Font Support].
2065
+
2066
+
2067
+ === Show recommended options
2068
+
2069
+ Use `--show-options` to display the recommended options for a conversion:
2070
+
2071
+ [source,shell]
2072
+ ----
2073
+ $ fontisan convert font.ttf --to otf --show-options
2074
+
2075
+ Recommended options for TTF → OTF conversion:
2076
+ ======================================================================
2077
+
2078
+ Opening options:
2079
+ --convert-curves: true
2080
+ --scale-to-1000: true
2081
+ --autohint: true
2082
+ --decompose-composites: false
2083
+ --store-custom-tables: true
2084
+
2085
+ Generating options:
2086
+ --hinting-mode: auto
2087
+ --decompose-on-output: true
2088
+
2089
+ Available presets:
2090
+ type1_to_modern
2091
+ modern_to_type1
2092
+ web_optimized
2093
+ archive_to_modern
2094
+
2095
+ To use preset:
2096
+ fontisan convert ttf --to otf --preset <name> --output output.ext
2097
+ ----
2098
+
2099
+
2100
+ === Using presets
2101
+
2102
+ Presets provide pre-configured options for common conversion scenarios:
2103
+
2104
+ [source,shell]
2105
+ ----
2106
+ # Convert Type 1 to modern OpenType
2107
+ fontisan convert font.pfb --to otf --preset type1_to_modern --output font.otf
2108
+
2109
+ # Convert to web-optimized WOFF2
2110
+ fontisan convert font.otf --to woff2 --preset web_optimized --output font.woff2
2111
+
2112
+ # Convert font archive to modern format
2113
+ fontisan convert family.ttc --to otc --preset archive_to_modern --output family.otc
2114
+ ----
2115
+
2116
+
2117
+ === Custom conversion options
2118
+
2119
+ Individual options can be specified for fine-grained control:
2120
+
2121
+ Opening options (control how the source font is read):
2122
+
2123
+ * `--decompose` - Decompose composite glyphs
2124
+ * `--convert-curves` - Convert curve types during conversion
2125
+ * `--scale-to-1000` - Scale units-per-em to 1000
2126
+ * `--autohint` - Auto-hint the font
2127
+ * `--generate-unicode` - Generate Unicode mappings (Type 1)
2128
+
2129
+ Generating options (control how the output font is written):
2130
+
2131
+ * `--hinting-mode` - Hint mode: preserve, auto, none, or full
2132
+ * `--optimize-tables` - Enable table optimization
2133
+ * `--decompose-on-output` - Decompose composites in output
2134
+
2135
+ [source,shell]
2136
+ ----
2137
+ # Convert with autohinting and optimization
2138
+ fontisan convert font.ttf --to otf --output font.otf \
2139
+ --autohint --hinting-mode auto --optimize-tables
2140
+ ----
2141
+
2142
+ For detailed information on all available options and conversion scenarios,
2143
+ see the link:docs/CONVERSION_GUIDE.adoc[Conversion Guide].
2144
+
2145
+
2146
+ === Ruby API usage
2147
+
2148
+ .Using recommended options
2149
+ [example]
2150
+ ====
2151
+ [source,ruby]
2152
+ ----
2153
+ require 'fontisan'
2154
+
2155
+ # Get recommended options for TTF → OTF conversion
2156
+ options = Fontisan::ConversionOptions.recommended(from: :ttf, to: :otf)
2157
+
2158
+ # Access opening and generating options
2159
+ options.opening # => { convert_curves: true, scale_to_1000: true, ... }
2160
+ options.generating # => { hinting_mode: "auto", decompose_on_output: true }
2161
+
2162
+ # Use with converter
2163
+ converter = Fontisan::Converters::OutlineConverter.new
2164
+ tables = converter.convert(font, options: options)
2165
+ ----
2166
+ ====
2167
+
2168
+
2169
+ .Using presets programmatically
2170
+ [example]
2171
+ ====
2172
+ [source,ruby]
2173
+ ----
2174
+ require 'fontisan'
2175
+
2176
+ # Load a preset
2177
+ options = Fontisan::ConversionOptions.from_preset(:type1_to_modern)
2178
+
2179
+ # Convert with preset
2180
+ converter = Fontisan::Converters::Type1Converter.new
2181
+ tables = converter.convert(font, options: options)
2182
+ ----
2183
+ ====
2184
+
2185
+
2186
+ .Building custom options
2187
+ [example]
2188
+ ====
2189
+ [source,ruby]
2190
+ ----
2191
+ require 'fontisan'
2192
+
2193
+ # Build custom conversion options
2194
+ options = Fontisan::ConversionOptions.new(
2195
+ from: :ttf,
2196
+ to: :otf,
2197
+ opening: { autohint: true, convert_curves: true },
2198
+ generating: { hinting_mode: "auto" }
2199
+ )
2200
+
2201
+ # Use with converter
2202
+ converter = Fontisan::Converters::OutlineConverter.new
2203
+ tables = converter.convert(font, options: options)
2204
+ ----
2205
+ ====
2206
+
2207
+
2048
2208
  == Round-Trip validation
2049
2209
 
2050
2210
  === General