fontisan 0.2.11 → 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 (38) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +214 -51
  3. data/README.adoc +160 -0
  4. data/lib/fontisan/cli.rb +177 -6
  5. data/lib/fontisan/commands/convert_command.rb +32 -1
  6. data/lib/fontisan/config/conversion_matrix.yml +132 -4
  7. data/lib/fontisan/constants.rb +12 -0
  8. data/lib/fontisan/conversion_options.rb +378 -0
  9. data/lib/fontisan/converters/collection_converter.rb +45 -10
  10. data/lib/fontisan/converters/format_converter.rb +2 -0
  11. data/lib/fontisan/converters/outline_converter.rb +78 -4
  12. data/lib/fontisan/converters/type1_converter.rb +559 -0
  13. data/lib/fontisan/font_loader.rb +46 -3
  14. data/lib/fontisan/type1/afm_generator.rb +436 -0
  15. data/lib/fontisan/type1/afm_parser.rb +298 -0
  16. data/lib/fontisan/type1/agl.rb +456 -0
  17. data/lib/fontisan/type1/charstring_converter.rb +240 -0
  18. data/lib/fontisan/type1/charstrings.rb +408 -0
  19. data/lib/fontisan/type1/conversion_options.rb +243 -0
  20. data/lib/fontisan/type1/decryptor.rb +183 -0
  21. data/lib/fontisan/type1/encodings.rb +697 -0
  22. data/lib/fontisan/type1/font_dictionary.rb +514 -0
  23. data/lib/fontisan/type1/generator.rb +220 -0
  24. data/lib/fontisan/type1/inf_generator.rb +332 -0
  25. data/lib/fontisan/type1/pfa_generator.rb +343 -0
  26. data/lib/fontisan/type1/pfa_parser.rb +158 -0
  27. data/lib/fontisan/type1/pfb_generator.rb +291 -0
  28. data/lib/fontisan/type1/pfb_parser.rb +166 -0
  29. data/lib/fontisan/type1/pfm_generator.rb +610 -0
  30. data/lib/fontisan/type1/pfm_parser.rb +433 -0
  31. data/lib/fontisan/type1/private_dict.rb +285 -0
  32. data/lib/fontisan/type1/ttf_to_type1_converter.rb +327 -0
  33. data/lib/fontisan/type1/upm_scaler.rb +118 -0
  34. data/lib/fontisan/type1.rb +73 -0
  35. data/lib/fontisan/type1_font.rb +331 -0
  36. data/lib/fontisan/version.rb +1 -1
  37. data/lib/fontisan.rb +2 -0
  38. metadata +26 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d5afdba14f32dbf6e482d0f17c64afdcc5dbe62b0567f59e42287234757ec1c3
4
- data.tar.gz: 6bdf19ae13494e1599dbb523bab6e6b7179ac288ac4d65d26b3cefb1e749878b
3
+ metadata.gz: b67e8e2428844b9c61766fffe36934694f4572373b1bd3ab1cfbe3348aa5d9f2
4
+ data.tar.gz: 4f80609efc6ce157565a60f813f6f95f1ccd6e04636c58d93dba07ebcb6d6a16
5
5
  SHA512:
6
- metadata.gz: e4e5fe71fe99f4edef0432684799419d4bcd634bffd879b804955a3777728a50828797210766e8cd3c2141cbbd7b0a23adb8feef0f8046557548be3d77ff5bbb
7
- data.tar.gz: 287c2f971e1c439de9d1465dbd244247ba65ad57fe2babecb873632429b9f04a935b569e9a1660ab47201e0b4604dac6947642b14b5dc28f353abc97a04c8661
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 10:49:34 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,13 +11,107 @@ Gemspec/RequiredRubyVersion:
11
11
  Exclude:
12
12
  - 'fontisan.gemspec'
13
13
 
14
- # Offense count: 1261
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
+
70
+ # Offense count: 2
71
+ # This cop supports safe autocorrection (--autocorrect).
72
+ # Configuration parameters: EnforcedStyle.
73
+ # SupportedStyles: normal, indented_internal_methods
74
+ Layout/IndentationConsistency:
75
+ Exclude:
76
+ - 'spec/fontisan/converters/collection_converter_spec.rb'
77
+
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
15
86
  # This cop supports safe autocorrection (--autocorrect).
16
87
  # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
17
88
  # URISchemes: http, https
18
89
  Layout/LineLength:
19
90
  Enabled: false
20
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
+
21
115
  # Offense count: 3
22
116
  Lint/CopDirectiveSyntax:
23
117
  Exclude:
@@ -25,15 +119,16 @@ Lint/CopDirectiveSyntax:
25
119
  - 'lib/fontisan/woff2_font.rb'
26
120
  - 'spec/fontisan/variation/cache_spec.rb'
27
121
 
28
- # Offense count: 27
122
+ # Offense count: 34
29
123
  # Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches, IgnoreDuplicateElseBranch.
30
124
  Lint/DuplicateBranch:
31
125
  Enabled: false
32
126
 
33
- # Offense count: 2
127
+ # Offense count: 6
34
128
  Lint/DuplicateMethods:
35
129
  Exclude:
36
130
  - 'lib/fontisan/tables/glyf.rb'
131
+ - 'lib/fontisan/type1_font.rb'
37
132
  - 'lib/fontisan/woff2_font.rb'
38
133
 
39
134
  # Offense count: 1
@@ -58,16 +153,13 @@ Lint/FloatComparison:
58
153
  Exclude:
59
154
  - 'lib/fontisan/tables/post.rb'
60
155
 
61
- # Offense count: 2
62
- Lint/HashCompareByIdentity:
63
- Exclude:
64
- - 'lib/fontisan/collection/table_analyzer.rb'
65
-
66
- # Offense count: 3
156
+ # Offense count: 6
67
157
  Lint/IneffectiveAccessModifier:
68
158
  Exclude:
159
+ - 'lib/fontisan/conversion_options.rb'
69
160
  - 'lib/fontisan/models/outline.rb'
70
161
  - 'lib/fontisan/models/ttx/tables/binary_table.rb'
162
+ - 'lib/fontisan/type1/generator.rb'
71
163
 
72
164
  # Offense count: 2
73
165
  # Configuration parameters: AllowedParentClasses.
@@ -81,6 +173,13 @@ Lint/StructNewOverride:
81
173
  Exclude:
82
174
  - 'lib/fontisan/optimizers/pattern_analyzer.rb'
83
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
+
84
183
  # Offense count: 8
85
184
  # This cop supports safe autocorrection (--autocorrect).
86
185
  # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods, NotImplementedExceptions.
@@ -95,13 +194,13 @@ Lint/UnusedMethodArgument:
95
194
  - 'lib/fontisan/woff2/glyf_transformer.rb'
96
195
  - 'lib/fontisan/woff_font.rb'
97
196
 
98
- # Offense count: 2
99
- # This cop supports safe autocorrection (--autocorrect).
100
- Lint/UselessAssignment:
197
+ # Offense count: 5
198
+ Lint/UselessConstantScoping:
101
199
  Exclude:
102
- - 'lib/fontisan/converters/cff_table_builder.rb'
200
+ - 'lib/fontisan/conversion_options.rb'
201
+ - 'lib/fontisan/type1/charstrings.rb'
103
202
 
104
- # Offense count: 480
203
+ # Offense count: 527
105
204
  # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
106
205
  Metrics/AbcSize:
107
206
  Enabled: false
@@ -117,28 +216,35 @@ Metrics/BlockLength:
117
216
  Metrics/BlockNesting:
118
217
  Max: 5
119
218
 
120
- # Offense count: 239
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
121
227
  # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
122
228
  Metrics/CyclomaticComplexity:
123
229
  Enabled: false
124
230
 
125
- # Offense count: 788
231
+ # Offense count: 874
126
232
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
127
233
  Metrics/MethodLength:
128
234
  Max: 135
129
235
 
130
- # Offense count: 21
236
+ # Offense count: 22
131
237
  # Configuration parameters: CountKeywordArgs.
132
238
  Metrics/ParameterLists:
133
239
  Max: 39
134
240
  MaxOptionalParameters: 4
135
241
 
136
- # Offense count: 176
242
+ # Offense count: 214
137
243
  # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
138
244
  Metrics/PerceivedComplexity:
139
245
  Enabled: false
140
246
 
141
- # Offense count: 17
247
+ # Offense count: 20
142
248
  # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
143
249
  # AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
144
250
  Naming/MethodParameterName:
@@ -146,9 +252,10 @@ Naming/MethodParameterName:
146
252
  - 'lib/fontisan/optimizers/subroutine_optimizer.rb'
147
253
  - 'lib/fontisan/tables/cff2/blend_operator.rb'
148
254
  - 'lib/fontisan/tables/glyf/curve_converter.rb'
255
+ - 'lib/fontisan/type1/ttf_to_type1_converter.rb'
149
256
  - 'lib/fontisan/variation/optimizer.rb'
150
257
 
151
- # Offense count: 12
258
+ # Offense count: 13
152
259
  # Configuration parameters: Mode, AllowedMethods, AllowedPatterns, AllowBangMethods, WaywardPredicates.
153
260
  # AllowedMethods: call
154
261
  # WaywardPredicates: nonzero?
@@ -158,6 +265,7 @@ Naming/PredicateMethod:
158
265
  - 'lib/fontisan/converters/outline_converter.rb'
159
266
  - 'lib/fontisan/converters/svg_generator.rb'
160
267
  - 'lib/fontisan/converters/table_copier.rb'
268
+ - 'lib/fontisan/converters/type1_converter.rb'
161
269
  - 'lib/fontisan/converters/woff2_encoder.rb'
162
270
  - 'lib/fontisan/optimizers/charstring_rewriter.rb'
163
271
  - 'lib/fontisan/sfnt_table.rb'
@@ -165,7 +273,26 @@ Naming/PredicateMethod:
165
273
  - 'lib/fontisan/validation/collection_validator.rb'
166
274
  - 'lib/fontisan/variation/metrics_adjuster.rb'
167
275
 
168
- # 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
169
296
  # Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
170
297
  # SupportedStyles: snake_case, normalcase, non_integer
171
298
  # AllowedIdentifiers: TLS1_1, TLS1_2, capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
@@ -182,7 +309,7 @@ RSpec/AnyInstance:
182
309
  - 'spec/fontisan/variation/parallel_generator_spec.rb'
183
310
  - 'spec/integration/format_conversion_spec.rb'
184
311
 
185
- # Offense count: 106
312
+ # Offense count: 113
186
313
  # Configuration parameters: Prefixes, AllowedPatterns.
187
314
  # Prefixes: when, with, without
188
315
  RSpec/ContextWording:
@@ -193,18 +320,21 @@ RSpec/ContextWording:
193
320
  RSpec/DescribeClass:
194
321
  Enabled: false
195
322
 
196
- # Offense count: 2
323
+ # Offense count: 5
197
324
  RSpec/DescribeMethod:
198
325
  Exclude:
199
326
  - 'spec/fontisan/collection/variable_font_builder_spec.rb'
200
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'
201
331
 
202
- # Offense count: 1288
332
+ # Offense count: 1370
203
333
  # Configuration parameters: CountAsOne.
204
334
  RSpec/ExampleLength:
205
335
  Max: 66
206
336
 
207
- # Offense count: 8
337
+ # Offense count: 9
208
338
  # This cop supports safe autocorrection (--autocorrect).
209
339
  RSpec/ExpectActual:
210
340
  Exclude:
@@ -213,6 +343,7 @@ RSpec/ExpectActual:
213
343
  - 'spec/fontisan/converters/extended_woff2_spec.rb'
214
344
  - 'spec/fontisan/converters/woff2_round_trip_spec.rb'
215
345
  - 'spec/fontisan/subset/builder_spec.rb'
346
+ - 'spec/fontisan/type1_real_fonts_spec.rb'
216
347
  - 'spec/fontisan/utils/thread_pool_spec.rb'
217
348
  - 'spec/fontisan/validators/basic_validator_spec.rb'
218
349
  - 'spec/fontisan/variation/validator_spec.rb'
@@ -250,7 +381,7 @@ RSpec/IteratedExpectation:
250
381
  Exclude:
251
382
  - 'spec/fontisan/tables/glyf_spec.rb'
252
383
 
253
- # Offense count: 19
384
+ # Offense count: 25
254
385
  # Configuration parameters: EnforcedStyle.
255
386
  # SupportedStyles: have_received, receive
256
387
  RSpec/MessageSpies:
@@ -259,6 +390,8 @@ RSpec/MessageSpies:
259
390
  - 'spec/fontisan/collection/variable_font_builder_spec.rb'
260
391
  - 'spec/fontisan/commands/pack_command_spec.rb'
261
392
  - 'spec/fontisan/commands/unpack_command_spec.rb'
393
+ - 'spec/fontisan/converters/outline_converter_spec.rb'
394
+ - 'spec/fontisan/converters/type1_converter_spec.rb'
262
395
  - 'spec/fontisan/glyph_accessor_spec.rb'
263
396
  - 'spec/fontisan/metrics_calculator_spec.rb'
264
397
  - 'spec/fontisan/subset/builder_spec.rb'
@@ -273,7 +406,7 @@ RSpec/MultipleDescribes:
273
406
  - 'spec/fontisan/utils/thread_pool_spec.rb'
274
407
  - 'spec/fontisan/variation/cache_spec.rb'
275
408
 
276
- # Offense count: 1699
409
+ # Offense count: 1793
277
410
  RSpec/MultipleExpectations:
278
411
  Max: 19
279
412
 
@@ -297,6 +430,12 @@ RSpec/NoExpectationExample:
297
430
  - 'spec/fontisan/validators/validator_spec.rb'
298
431
  - 'spec/fontisan/variation/variable_svg_generator_spec.rb'
299
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
+
300
439
  # Offense count: 13
301
440
  RSpec/RepeatedExample:
302
441
  Exclude:
@@ -305,27 +444,19 @@ RSpec/RepeatedExample:
305
444
  - 'spec/fontisan/metrics_calculator_spec.rb'
306
445
  - 'spec/fontisan/tables/os2_spec.rb'
307
446
 
308
- # 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
309
456
  # Configuration parameters: CustomTransform, IgnoreMethods, IgnoreMetadata, InflectorPath, EnforcedInflector.
310
457
  # SupportedInflectors: default, active_support
311
458
  RSpec/SpecFilePathFormat:
312
- Exclude:
313
- - '**/spec/routing/**/*'
314
- - 'spec/fontisan/collection/variable_font_builder_spec.rb'
315
- - 'spec/fontisan/hints/postscript_hint_applier_spec.rb'
316
- - 'spec/fontisan/hints/postscript_hint_extractor_spec.rb'
317
- - 'spec/fontisan/hints/truetype_hint_applier_spec.rb'
318
- - 'spec/fontisan/hints/truetype_hint_extractor_spec.rb'
319
- - 'spec/fontisan/hints/truetype_instruction_analyzer_spec.rb'
320
- - 'spec/fontisan/hints/truetype_instruction_generator_spec.rb'
321
- - 'spec/fontisan/tables/cff/charstring_builder_spec.rb'
322
- - 'spec/fontisan/tables/cff/charstring_parser_spec.rb'
323
- - 'spec/fontisan/tables/cff/charstring_rebuilder_spec.rb'
324
- - 'spec/fontisan/tables/cff/charstring_spec.rb'
325
- - 'spec/fontisan/tables/glyf/curve_converter_spec.rb'
326
- - 'spec/fontisan/tables/glyf/glyph_builder_spec.rb'
327
- - 'spec/fontisan/validators/opentype_validator_spec.rb'
328
- - 'spec/fontisan/woff2/header_spec.rb'
459
+ Enabled: false
329
460
 
330
461
  # Offense count: 1
331
462
  RSpec/SpecFilePathSuffix:
@@ -342,7 +473,7 @@ RSpec/SubjectStub:
342
473
  Exclude:
343
474
  - 'spec/fontisan/variation/delta_applier_spec.rb'
344
475
 
345
- # Offense count: 291
476
+ # Offense count: 294
346
477
  # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
347
478
  RSpec/VerifiedDoubles:
348
479
  Enabled: false
@@ -357,11 +488,25 @@ Security/Open:
357
488
  Exclude:
358
489
  - 'Rakefile'
359
490
 
360
- # 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
361
505
  # This cop supports safe autocorrection (--autocorrect).
362
506
  Style/ComparableClamp:
363
507
  Exclude:
364
508
  - 'lib/fontisan/tables/cff2/blend_operator.rb'
509
+ - 'lib/fontisan/type1/pfm_generator.rb'
365
510
  - 'lib/fontisan/variable/axis_normalizer.rb'
366
511
  - 'lib/fontisan/variation/interpolator.rb'
367
512
 
@@ -383,8 +528,26 @@ Style/HashLikeCase:
383
528
  - 'lib/fontisan/models/validation_report.rb'
384
529
 
385
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
386
548
  # This cop supports safe autocorrection (--autocorrect).
387
- # Configuration parameters: AllowNamedUnderscoreVariables.
388
- Style/TrailingUnderscoreVariable:
549
+ # Configuration parameters: EnforcedStyleForMultiline.
550
+ # SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
551
+ Style/TrailingCommaInHashLiteral:
389
552
  Exclude:
390
- - 'lib/fontisan/converters/cff_table_builder.rb'
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