fontisan 0.4.49-aarch64-linux
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.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +141 -0
- data/.rubocop_todo.yml +433 -0
- data/BENCHMARKS.md +56 -0
- data/BUG-stitcher-drops-isolated-cps.md +58 -0
- data/BUG-stitcher-drops-plane1-codepoints.md +310 -0
- data/BUG-stitcher-gid-cap-65535.md +110 -0
- data/CHANGELOG.md +293 -0
- data/Gemfile +40 -0
- data/LICENSE +28 -0
- data/README.adoc +2811 -0
- data/Rakefile +156 -0
- data/TODO.bug-fixes/01-cff-expert-charsets.md +27 -0
- data/TODO.bug-fixes/02-cff2-subroutine-stubs.md +32 -0
- data/TODO.bug-fixes/03-variation-subsetter-placeholders.md +42 -0
- data/TODO.bug-fixes/04-ufo-image-compile-roundtrip.md +28 -0
- data/TODO.bug-fixes/05-stale-cff-comment.md +18 -0
- data/TODO.bug-fixes/06-instance-woff2-output.md +24 -0
- data/TODO.bug-fixes/07-encapsulation-violations.md +38 -0
- data/TODO.bug-fixes/08-respond-to-violations.md +25 -0
- data/TODO.bug-fixes/09-type1-cff-seac-expansion.md +22 -0
- data/TODO.bug-fixes/10-ttf-type1-composite-glyphs.md +23 -0
- data/TODO.bug-fixes/11-remaining-respond-to.md +25 -0
- data/TODO.bug-fixes/12-type1-generators-duck-typing.md +80 -0
- data/TODO.bug-fixes/13-hint-extractor-duck-typing.md +30 -0
- data/TODO.bug-fixes/14-font-interface-type-checks.md +82 -0
- data/TODO.bug-fixes/15-glyph-type-checks-and-simple-glyph-points-bug.md +49 -0
- data/TODO.bug-fixes/16-variation-table-checks.md +31 -0
- data/TODO.bug-fixes/17-ufo-and-stitcher-cleanup.md +32 -0
- data/TODO.bug-fixes/18-generic-value-and-io-checks.md +56 -0
- data/TODO.bug-fixes/19-serialization-migration.md +52 -0
- data/TODO.bug-fixes/20-variation-validator-type-checks.md +29 -0
- data/TODO.bug-fixes/21-xml-builder-send.md +24 -0
- data/TODO.bug-fixes/22-type1-converter-font-info.md +25 -0
- data/TODO.bug-fixes/23-boundary-type-checks.md +31 -0
- data/TODO.bug-fixes/24-validator-dynamic-field-key.md +25 -0
- data/TODO.bug-fixes/25-serialization-migration.md +49 -0
- data/TODO.bug-fixes/26-variation-preserver-spec-migration.md +25 -0
- data/TODO.bug-fixes/27-table-class-registry.md +50 -0
- data/TODO.bug-fixes/28-spec-doubles-cleanup.md +40 -0
- data/TODO.bug-fixes/29-strategy-registries.md +30 -0
- data/TODO.bug-fixes/30-eliminate-send-in-specs.md +36 -0
- data/TODO.bug-fixes/README.md +52 -0
- data/TODO.improvements/01-cbdt-cblc-gid-stable-propagation.md +73 -0
- data/TODO.improvements/02-collection-outline-priority.md +48 -0
- data/TODO.improvements/03-fontisan-audit-command.md +219 -0
- data/TODO.improvements/04-ufo-composite-glyph-encoding.md +46 -0
- data/TODO.improvements/05-otf-compiler-real-cff.md +63 -0
- data/TODO.improvements/06-cff2-blend-vsindex-operators.md +51 -0
- data/TODO.improvements/07-cpal-v1-header-fields.md +71 -0
- data/TODO.improvements/08-cff-standard-string-table.md +52 -0
- data/TODO.improvements/09-type1-seac-expansion.md +57 -0
- data/TODO.improvements/10-ufo-image-set-feature-writers.md +71 -0
- data/TODO.improvements/11-kern-groups-plist.md +49 -0
- data/TODO.improvements/12-cbdt-fixture-bindata-conversion.md +68 -0
- data/TODO.improvements/13-split-octokit-fetcher.md +45 -0
- data/TODO.improvements/14-rubocop-baseline-chip.md +62 -0
- data/TODO.improvements/15-cff-cff2-subsetter-strategy.md +78 -0
- data/TODO.improvements/README.md +58 -0
- data/benchmark/baseline.json +5 -0
- data/benchmark/ci_gate.rb +217 -0
- data/benchmark/compile_benchmark.rb +78 -0
- data/benchmark/corpus/harness.rb +175 -0
- data/benchmark/corpus/ops.rb +150 -0
- data/benchmark/corpus/run.rb +182 -0
- data/benchmark/corpus/scan_child.rb +8 -0
- data/benchmark/corpus/tiers.rb +176 -0
- data/benchmark/tier_baseline.json +12 -0
- data/benchmark/variation_quick_bench.rb +47 -0
- data/build_mingw32_stub.rb +15 -0
- data/docs/.gitignore +17 -0
- data/docs/.vitepress/config.ts +373 -0
- data/docs/.vitepress/theme/components/ApiMethod.vue +127 -0
- data/docs/.vitepress/theme/components/Badge.vue +51 -0
- data/docs/.vitepress/theme/components/FeatureComparison.vue +87 -0
- data/docs/.vitepress/theme/components/HeroCodeBlock.vue +98 -0
- data/docs/.vitepress/theme/components/WithinHero.vue +30 -0
- data/docs/.vitepress/theme/index.ts +22 -0
- data/docs/.vitepress/theme/style.css +628 -0
- data/docs/AFDKO_MIGRATION.adoc +175 -0
- data/docs/APPLE_LEGACY_FONTS.adoc +173 -0
- data/docs/CFF2_SUPPORT.adoc +184 -0
- data/docs/COLLECTION_VALIDATION.adoc +204 -0
- data/docs/COLOR_FONTS.adoc +127 -0
- data/docs/CONVERSION_GUIDE.adoc +656 -0
- data/docs/EXTRACT_TTC_MIGRATION.md +549 -0
- data/docs/FEATURE_PARITY.adoc +263 -0
- data/docs/FONT_HINTING.adoc +570 -0
- data/docs/STITCHER_GUIDE.adoc +436 -0
- data/docs/SVG_TO_GLYF.adoc +118 -0
- data/docs/TTX.adoc +176 -0
- data/docs/TYPE1_FONTS.adoc +445 -0
- data/docs/UFO_COMPILATION.adoc +397 -0
- data/docs/VALIDATION.adoc +254 -0
- data/docs/VARIABLE_FONT_OPERATIONS.adoc +599 -0
- data/docs/WOFF_WOFF2_FORMATS.adoc +220 -0
- data/docs/api/conversion-options.md +164 -0
- data/docs/api/converters/curve-converter.md +34 -0
- data/docs/api/converters/hint-converter.md +34 -0
- data/docs/api/converters/outline-converter.md +27 -0
- data/docs/api/font-loader.md +117 -0
- data/docs/api/font-writer.md +103 -0
- data/docs/api/index.md +79 -0
- data/docs/api/layer.md +89 -0
- data/docs/api/models/glyph-accessor.md +43 -0
- data/docs/api/models/glyph.md +40 -0
- data/docs/api/models/table-analyzer.md +35 -0
- data/docs/api/sfnt-font.md +53 -0
- data/docs/api/type1-font.md +43 -0
- data/docs/api/validators/font-validator.md +31 -0
- data/docs/api/validators/helper.md +36 -0
- data/docs/api/validators/profile.md +39 -0
- data/docs/cli/convert.md +148 -0
- data/docs/cli/dump-table.md +110 -0
- data/docs/cli/export.md +176 -0
- data/docs/cli/features.md +124 -0
- data/docs/cli/glyphs.md +90 -0
- data/docs/cli/index.md +232 -0
- data/docs/cli/info.md +254 -0
- data/docs/cli/instance.md +122 -0
- data/docs/cli/ls.md +95 -0
- data/docs/cli/optical-size.md +94 -0
- data/docs/cli/pack.md +125 -0
- data/docs/cli/scripts.md +105 -0
- data/docs/cli/subset.md +58 -0
- data/docs/cli/tables.md +84 -0
- data/docs/cli/unicode.md +101 -0
- data/docs/cli/validate-collection.md +95 -0
- data/docs/cli/validate.md +56 -0
- data/docs/cli/variable.md +126 -0
- data/docs/cli/version.md +46 -0
- data/docs/guide/cli/convert.md +108 -0
- data/docs/guide/cli/export.md +138 -0
- data/docs/guide/cli/index.md +99 -0
- data/docs/guide/cli/info.md +144 -0
- data/docs/guide/cli/pack.md +155 -0
- data/docs/guide/cli/subset.md +149 -0
- data/docs/guide/cli/validate.md +139 -0
- data/docs/guide/color-fonts/bitmaps.md +194 -0
- data/docs/guide/color-fonts/colr-cpal.md +175 -0
- data/docs/guide/color-fonts/index.md +140 -0
- data/docs/guide/color-fonts/svg.md +154 -0
- data/docs/guide/color.md +51 -0
- data/docs/guide/comparisons/font-validator.md +222 -0
- data/docs/guide/comparisons/fonttools.md +200 -0
- data/docs/guide/comparisons/index.md +83 -0
- data/docs/guide/comparisons/lcdf-typetools.md +205 -0
- data/docs/guide/contributing.md +279 -0
- data/docs/guide/conversion/collections.md +251 -0
- data/docs/guide/conversion/curves.md +246 -0
- data/docs/guide/conversion/index.md +157 -0
- data/docs/guide/conversion/options.md +280 -0
- data/docs/guide/conversion/ttf-otf.md +184 -0
- data/docs/guide/conversion/type1.md +208 -0
- data/docs/guide/conversion/web.md +299 -0
- data/docs/guide/conversion.md +40 -0
- data/docs/guide/engines.md +117 -0
- data/docs/guide/formats/collections.md +147 -0
- data/docs/guide/formats/dfont.md +99 -0
- data/docs/guide/formats/index.md +65 -0
- data/docs/guide/formats/otf.md +103 -0
- data/docs/guide/formats/svg.md +97 -0
- data/docs/guide/formats/ttf.md +105 -0
- data/docs/guide/formats/type1.md +118 -0
- data/docs/guide/formats/woff.md +139 -0
- data/docs/guide/hinting/autohint.md +141 -0
- data/docs/guide/hinting/conversion.md +161 -0
- data/docs/guide/hinting/index.md +86 -0
- data/docs/guide/hinting/postscript.md +149 -0
- data/docs/guide/hinting/truetype.md +135 -0
- data/docs/guide/hinting.md +44 -0
- data/docs/guide/index.md +152 -0
- data/docs/guide/installation.md +116 -0
- data/docs/guide/migrations/extract-ttc.md +549 -0
- data/docs/guide/migrations/font-validator.md +260 -0
- data/docs/guide/migrations/fonttools.md +208 -0
- data/docs/guide/migrations/index.md +64 -0
- data/docs/guide/migrations/otfinfo.md +197 -0
- data/docs/guide/quick-start.md +204 -0
- data/docs/guide/type1.md +58 -0
- data/docs/guide/universal-outline.md +151 -0
- data/docs/guide/validation/custom.md +195 -0
- data/docs/guide/validation/helpers.md +188 -0
- data/docs/guide/validation/index.md +132 -0
- data/docs/guide/validation/profiles.md +156 -0
- data/docs/guide/validation.md +47 -0
- data/docs/guide/variable-fonts/advanced.md +231 -0
- data/docs/guide/variable-fonts/axes.md +209 -0
- data/docs/guide/variable-fonts/conversion.md +197 -0
- data/docs/guide/variable-fonts/index.md +84 -0
- data/docs/guide/variable-fonts/instances.md +187 -0
- data/docs/guide/variable-fonts/named-instances.md +194 -0
- data/docs/guide/variable-fonts/static.md +168 -0
- data/docs/guide/variable.md +58 -0
- data/docs/guide/woff.md +61 -0
- data/docs/index.md +136 -0
- data/docs/lychee.toml +41 -0
- data/docs/package-lock.json +2560 -0
- data/docs/package.json +15 -0
- data/docs/public/apple-touch-icon.png +0 -0
- data/docs/public/favicon-96x96.png +0 -0
- data/docs/public/favicon.ico +0 -0
- data/docs/public/favicon.svg +1 -0
- data/docs/public/logo-full.svg +1 -0
- data/docs/public/logo.svg +1 -0
- data/docs/public/robots.txt +4 -0
- data/docs/public/site.webmanifest +21 -0
- data/docs/public/web-app-manifest-192x192.png +0 -0
- data/docs/public/web-app-manifest-512x512.png +0 -0
- data/docs/reference-facade.md +130 -0
- data/docs/scripts/post-build.mjs +81 -0
- data/exe/fontisan +7 -0
- data/lib/fontisan/audit/check.rb +47 -0
- data/lib/fontisan/audit/check_registry.rb +77 -0
- data/lib/fontisan/audit/checks/cff_table_check.rb +87 -0
- data/lib/fontisan/audit/checks/cmap_check.rb +256 -0
- data/lib/fontisan/audit/checks/collection_integrity_check.rb +102 -0
- data/lib/fontisan/audit/checks/format_round_trip_check.rb +150 -0
- data/lib/fontisan/audit/checks/glyf_table_check.rb +115 -0
- data/lib/fontisan/audit/checks/glyph_name_check.rb +107 -0
- data/lib/fontisan/audit/checks/head_check.rb +96 -0
- data/lib/fontisan/audit/checks/hhea_check.rb +68 -0
- data/lib/fontisan/audit/checks/hinting_check.rb +163 -0
- data/lib/fontisan/audit/checks/kern_check.rb +47 -0
- data/lib/fontisan/audit/checks/layout_table_check.rb +70 -0
- data/lib/fontisan/audit/checks/maxp_check.rb +85 -0
- data/lib/fontisan/audit/checks/name_table_check.rb +78 -0
- data/lib/fontisan/audit/checks/naming_consistency_check.rb +102 -0
- data/lib/fontisan/audit/checks/opentype_conformance_check.rb +108 -0
- data/lib/fontisan/audit/checks/os2_check.rb +117 -0
- data/lib/fontisan/audit/checks/ots_compatibility_check.rb +191 -0
- data/lib/fontisan/audit/checks/post_check.rb +75 -0
- data/lib/fontisan/audit/checks/table_directory_check.rb +157 -0
- data/lib/fontisan/audit/checks/variable_font_check.rb +151 -0
- data/lib/fontisan/audit/checks/woff2_validation_check.rb +140 -0
- data/lib/fontisan/audit/checks.rb +42 -0
- data/lib/fontisan/audit.rb +20 -0
- data/lib/fontisan/base_collection.rb +312 -0
- data/lib/fontisan/binary/base_record.rb +82 -0
- data/lib/fontisan/binary/structures.rb +82 -0
- data/lib/fontisan/binary.rb +11 -0
- data/lib/fontisan/byte_ops.rb +314 -0
- data/lib/fontisan/cli.rb +1111 -0
- data/lib/fontisan/collection/builder.rb +336 -0
- data/lib/fontisan/collection/dfont_builder.rb +305 -0
- data/lib/fontisan/collection/offset_calculator.rb +229 -0
- data/lib/fontisan/collection/reader/stats.rb +23 -0
- data/lib/fontisan/collection/reader.rb +90 -0
- data/lib/fontisan/collection/shared_logic.rb +52 -0
- data/lib/fontisan/collection/table_analyzer.rb +289 -0
- data/lib/fontisan/collection/table_deduplicator.rb +317 -0
- data/lib/fontisan/collection/writer.rb +289 -0
- data/lib/fontisan/collection.rb +16 -0
- data/lib/fontisan/commands/audit_command.rb +288 -0
- data/lib/fontisan/commands/base_command.rb +88 -0
- data/lib/fontisan/commands/convert_command.rb +506 -0
- data/lib/fontisan/commands/dump_table_command.rb +68 -0
- data/lib/fontisan/commands/export_command.rb +157 -0
- data/lib/fontisan/commands/features_command.rb +90 -0
- data/lib/fontisan/commands/glyphs_command.rb +50 -0
- data/lib/fontisan/commands/info_command.rb +447 -0
- data/lib/fontisan/commands/instance_command.rb +357 -0
- data/lib/fontisan/commands/ls_command.rb +107 -0
- data/lib/fontisan/commands/multi_format_output.rb +64 -0
- data/lib/fontisan/commands/optical_size_command.rb +38 -0
- data/lib/fontisan/commands/pack_command.rb +344 -0
- data/lib/fontisan/commands/scripts_command.rb +56 -0
- data/lib/fontisan/commands/subset_command.rb +285 -0
- data/lib/fontisan/commands/tables_command.rb +52 -0
- data/lib/fontisan/commands/unicode_command.rb +73 -0
- data/lib/fontisan/commands/unpack_command.rb +387 -0
- data/lib/fontisan/commands/validate_collection_command.rb +127 -0
- data/lib/fontisan/commands/validate_command.rb +305 -0
- data/lib/fontisan/commands/variable_command.rb +87 -0
- data/lib/fontisan/commands.rb +30 -0
- data/lib/fontisan/config/collection_settings.yml +56 -0
- data/lib/fontisan/config/conversion_matrix.yml +626 -0
- data/lib/fontisan/config/export_settings.yml +66 -0
- data/lib/fontisan/config/features.yml +143 -0
- data/lib/fontisan/config/scripts.yml +42 -0
- data/lib/fontisan/config/subset_profiles.yml +106 -0
- data/lib/fontisan/config/svg_settings.yml +60 -0
- data/lib/fontisan/config/variable_settings.yml +99 -0
- data/lib/fontisan/config/woff2_settings.yml +77 -0
- data/lib/fontisan/constants.rb +219 -0
- data/lib/fontisan/conversion_options.rb +389 -0
- data/lib/fontisan/converters/cff_table_builder.rb +195 -0
- data/lib/fontisan/converters/collection_converter.rb +520 -0
- data/lib/fontisan/converters/conversion_strategy.rb +211 -0
- data/lib/fontisan/converters/format_converter.rb +536 -0
- data/lib/fontisan/converters/glyf_table_builder.rb +61 -0
- data/lib/fontisan/converters/outline_converter.rb +720 -0
- data/lib/fontisan/converters/outline_extraction.rb +88 -0
- data/lib/fontisan/converters/outline_optimizer.rb +84 -0
- data/lib/fontisan/converters/svg_generator.rb +236 -0
- data/lib/fontisan/converters/table_copier.rb +107 -0
- data/lib/fontisan/converters/type1_converter.rb +1201 -0
- data/lib/fontisan/converters/woff2_encoder.rb +520 -0
- data/lib/fontisan/converters/woff_writer.rb +358 -0
- data/lib/fontisan/converters.rb +21 -0
- data/lib/fontisan/dfont_collection.rb +288 -0
- data/lib/fontisan/engine.rb +393 -0
- data/lib/fontisan/error.rb +281 -0
- data/lib/fontisan/export/exporter.rb +255 -0
- data/lib/fontisan/export/table_serializer.rb +140 -0
- data/lib/fontisan/export/transformers/font_to_ttx.rb +163 -0
- data/lib/fontisan/export/transformers/head_transformer.rb +94 -0
- data/lib/fontisan/export/transformers/hhea_transformer.rb +57 -0
- data/lib/fontisan/export/transformers/maxp_transformer.rb +61 -0
- data/lib/fontisan/export/transformers/name_transformer.rb +61 -0
- data/lib/fontisan/export/transformers/os2_transformer.rb +119 -0
- data/lib/fontisan/export/transformers/post_transformer.rb +49 -0
- data/lib/fontisan/export/transformers.rb +17 -0
- data/lib/fontisan/export/ttx_generator.rb +526 -0
- data/lib/fontisan/export/ttx_parser.rb +300 -0
- data/lib/fontisan/export.rb +13 -0
- data/lib/fontisan/ffi/client.rb +123 -0
- data/lib/fontisan/ffi/libfontisan_cdylib.so +0 -0
- data/lib/fontisan/ffi.rb +387 -0
- data/lib/fontisan/ffi_platform.rb +24 -0
- data/lib/fontisan/font_loader.rb +315 -0
- data/lib/fontisan/font_writer.rb +309 -0
- data/lib/fontisan/formatters/text_formatter.rb +517 -0
- data/lib/fontisan/formatters.rb +9 -0
- data/lib/fontisan/glyph_accessor.rb +525 -0
- data/lib/fontisan/hints/hint_converter.rb +309 -0
- data/lib/fontisan/hints/hint_validator.rb +287 -0
- data/lib/fontisan/hints/postscript_hint_applier.rb +255 -0
- data/lib/fontisan/hints/postscript_hint_extractor.rb +347 -0
- data/lib/fontisan/hints/truetype_hint_applier.rb +117 -0
- data/lib/fontisan/hints/truetype_hint_extractor.rb +283 -0
- data/lib/fontisan/hints/truetype_instruction_analyzer.rb +268 -0
- data/lib/fontisan/hints/truetype_instruction_generator.rb +266 -0
- data/lib/fontisan/hints.rb +19 -0
- data/lib/fontisan/loading_modes.rb +113 -0
- data/lib/fontisan/metrics_calculator.rb +275 -0
- data/lib/fontisan/models/all_scripts_features_info.rb +20 -0
- data/lib/fontisan/models/audit_report.rb +196 -0
- data/lib/fontisan/models/bitmap_glyph.rb +123 -0
- data/lib/fontisan/models/bitmap_strike.rb +94 -0
- data/lib/fontisan/models/collection_brief_info.rb +36 -0
- data/lib/fontisan/models/collection_font_summary.rb +52 -0
- data/lib/fontisan/models/collection_info.rb +79 -0
- data/lib/fontisan/models/collection_list_info.rb +36 -0
- data/lib/fontisan/models/collection_validation_report.rb +102 -0
- data/lib/fontisan/models/color_glyph.rb +56 -0
- data/lib/fontisan/models/color_layer.rb +53 -0
- data/lib/fontisan/models/color_palette.rb +60 -0
- data/lib/fontisan/models/features_info.rb +42 -0
- data/lib/fontisan/models/font_export.rb +158 -0
- data/lib/fontisan/models/font_info.rb +98 -0
- data/lib/fontisan/models/font_report.rb +23 -0
- data/lib/fontisan/models/font_summary.rb +48 -0
- data/lib/fontisan/models/glyph_info.rb +26 -0
- data/lib/fontisan/models/glyph_outline.rb +343 -0
- data/lib/fontisan/models/hint.rb +404 -0
- data/lib/fontisan/models/optical_size_info.rb +33 -0
- data/lib/fontisan/models/outline.rb +667 -0
- data/lib/fontisan/models/scripts_info.rb +39 -0
- data/lib/fontisan/models/svg_glyph.rb +89 -0
- data/lib/fontisan/models/table_info.rb +55 -0
- data/lib/fontisan/models/table_sharing_info.rb +40 -0
- data/lib/fontisan/models/ttx/glyph_order.rb +31 -0
- data/lib/fontisan/models/ttx/tables/binary_table.rb +67 -0
- data/lib/fontisan/models/ttx/tables/head_table.rb +74 -0
- data/lib/fontisan/models/ttx/tables/hhea_table.rb +74 -0
- data/lib/fontisan/models/ttx/tables/maxp_table.rb +55 -0
- data/lib/fontisan/models/ttx/tables/name_table.rb +45 -0
- data/lib/fontisan/models/ttx/tables/os2_table.rb +157 -0
- data/lib/fontisan/models/ttx/tables/post_table.rb +50 -0
- data/lib/fontisan/models/ttx/tables.rb +21 -0
- data/lib/fontisan/models/ttx/ttfont.rb +41 -0
- data/lib/fontisan/models/ttx.rb +14 -0
- data/lib/fontisan/models/unicode_mappings.rb +42 -0
- data/lib/fontisan/models/validation_report.rb +435 -0
- data/lib/fontisan/models/variable_font_info.rb +82 -0
- data/lib/fontisan/models.rb +49 -0
- data/lib/fontisan/native/3.2/fontisan_native.so +0 -0
- data/lib/fontisan/native/3.3/fontisan_native.so +0 -0
- data/lib/fontisan/native/3.4/fontisan_native.so +0 -0
- data/lib/fontisan/native/4.0/fontisan_native.so +0 -0
- data/lib/fontisan/native.rb +235 -0
- data/lib/fontisan/open_type_collection.rb +49 -0
- data/lib/fontisan/open_type_font.rb +161 -0
- data/lib/fontisan/open_type_font_extensions.rb +54 -0
- data/lib/fontisan/optimizers/charstring_rewriter.rb +172 -0
- data/lib/fontisan/optimizers/pattern_analyzer.rb +310 -0
- data/lib/fontisan/optimizers/stack_tracker.rb +246 -0
- data/lib/fontisan/optimizers/subroutine_builder.rb +135 -0
- data/lib/fontisan/optimizers/subroutine_generator.rb +207 -0
- data/lib/fontisan/optimizers/subroutine_optimizer.rb +114 -0
- data/lib/fontisan/optimizers.rb +14 -0
- data/lib/fontisan/outline_extractor.rb +417 -0
- data/lib/fontisan/output_guard.rb +40 -0
- data/lib/fontisan/parsers/dfont_parser.rb +191 -0
- data/lib/fontisan/parsers/tag.rb +77 -0
- data/lib/fontisan/parsers.rb +10 -0
- data/lib/fontisan/pipeline/format_detector.rb +176 -0
- data/lib/fontisan/pipeline/output_writer.rb +161 -0
- data/lib/fontisan/pipeline/strategies/base_strategy.rb +75 -0
- data/lib/fontisan/pipeline/strategies/instance_strategy.rb +89 -0
- data/lib/fontisan/pipeline/strategies/named_strategy.rb +114 -0
- data/lib/fontisan/pipeline/strategies/preserve_strategy.rb +54 -0
- data/lib/fontisan/pipeline/strategies.rb +16 -0
- data/lib/fontisan/pipeline/transformation_pipeline.rb +407 -0
- data/lib/fontisan/pipeline/variation_resolver.rb +158 -0
- data/lib/fontisan/pipeline.rb +14 -0
- data/lib/fontisan/reference/table_digests.rb +251 -0
- data/lib/fontisan/reference.rb +663 -0
- data/lib/fontisan/scan.rb +372 -0
- data/lib/fontisan/sfnt_builder.rb +66 -0
- data/lib/fontisan/sfnt_directory.rb +41 -0
- data/lib/fontisan/sfnt_font.rb +749 -0
- data/lib/fontisan/sfnt_source.rb +28 -0
- data/lib/fontisan/sfnt_table.rb +260 -0
- data/lib/fontisan/stitcher/cbdt_propagator.rb +212 -0
- data/lib/fontisan/stitcher/collection_result.rb +19 -0
- data/lib/fontisan/stitcher/deduplicator.rb +47 -0
- data/lib/fontisan/stitcher/format_metadata.rb +51 -0
- data/lib/fontisan/stitcher/glyph_cloner.rb +41 -0
- data/lib/fontisan/stitcher/glyph_copier.rb +110 -0
- data/lib/fontisan/stitcher/glyph_limit.rb +53 -0
- data/lib/fontisan/stitcher/glyph_signature.rb +51 -0
- data/lib/fontisan/stitcher/partition_strategy/base.rb +52 -0
- data/lib/fontisan/stitcher/partition_strategy/blueprint.rb +24 -0
- data/lib/fontisan/stitcher/partition_strategy/by_block.rb +430 -0
- data/lib/fontisan/stitcher/partition_strategy/by_plane.rb +161 -0
- data/lib/fontisan/stitcher/partition_strategy/by_script.rb +309 -0
- data/lib/fontisan/stitcher/partition_strategy/partition.rb +24 -0
- data/lib/fontisan/stitcher/partition_strategy.rb +24 -0
- data/lib/fontisan/stitcher/selector/codepoints.rb +29 -0
- data/lib/fontisan/stitcher/selector/gid.rb +25 -0
- data/lib/fontisan/stitcher/selector/range.rb +30 -0
- data/lib/fontisan/stitcher/selector.rb +26 -0
- data/lib/fontisan/stitcher/source.rb +459 -0
- data/lib/fontisan/stitcher/unique_glyph_name.rb +46 -0
- data/lib/fontisan/stitcher.rb +185 -0
- data/lib/fontisan/stitcher_cli.rb +69 -0
- data/lib/fontisan/subset/builder.rb +263 -0
- data/lib/fontisan/subset/glyph_mapping.rb +222 -0
- data/lib/fontisan/subset/options.rb +142 -0
- data/lib/fontisan/subset/profile.rb +152 -0
- data/lib/fontisan/subset/shared_state.rb +42 -0
- data/lib/fontisan/subset/subset_context.rb +20 -0
- data/lib/fontisan/subset/table_strategy/cbdt.rb +30 -0
- data/lib/fontisan/subset/table_strategy/cblc.rb +27 -0
- data/lib/fontisan/subset/table_strategy/cff.rb +92 -0
- data/lib/fontisan/subset/table_strategy/cff2.rb +391 -0
- data/lib/fontisan/subset/table_strategy/cmap.rb +146 -0
- data/lib/fontisan/subset/table_strategy/color_bitmap_placement.rb +20 -0
- data/lib/fontisan/subset/table_strategy/color_bitmap_strike_plan.rb +45 -0
- data/lib/fontisan/subset/table_strategy/color_bitmap_subset_plan.rb +62 -0
- data/lib/fontisan/subset/table_strategy/color_bitmap_subsetter.rb +182 -0
- data/lib/fontisan/subset/table_strategy/color_bitmap_subtable_plan.rb +59 -0
- data/lib/fontisan/subset/table_strategy/glyf.rb +29 -0
- data/lib/fontisan/subset/table_strategy/glyf_loca_builder.rb +146 -0
- data/lib/fontisan/subset/table_strategy/head.rb +43 -0
- data/lib/fontisan/subset/table_strategy/hhea.rb +67 -0
- data/lib/fontisan/subset/table_strategy/hmtx.rb +52 -0
- data/lib/fontisan/subset/table_strategy/loca.rb +41 -0
- data/lib/fontisan/subset/table_strategy/maxp.rb +23 -0
- data/lib/fontisan/subset/table_strategy/name.rb +19 -0
- data/lib/fontisan/subset/table_strategy/os2.rb +21 -0
- data/lib/fontisan/subset/table_strategy/pass_through.rb +20 -0
- data/lib/fontisan/subset/table_strategy/post.rb +37 -0
- data/lib/fontisan/subset/table_strategy.rb +79 -0
- data/lib/fontisan/subset/table_subsetter.rb +110 -0
- data/lib/fontisan/subset.rb +16 -0
- data/lib/fontisan/svg/font_face_generator.rb +274 -0
- data/lib/fontisan/svg/font_generator.rb +256 -0
- data/lib/fontisan/svg/glyph_generator.rb +201 -0
- data/lib/fontisan/svg/standalone_glyph.rb +132 -0
- data/lib/fontisan/svg/view_box_calculator.rb +137 -0
- data/lib/fontisan/svg.rb +13 -0
- data/lib/fontisan/svg_to_glyf/assembler.rb +174 -0
- data/lib/fontisan/svg_to_glyf/document.rb +102 -0
- data/lib/fontisan/svg_to_glyf/geometry/affine_transform.rb +112 -0
- data/lib/fontisan/svg_to_glyf/geometry/normalizer.rb +62 -0
- data/lib/fontisan/svg_to_glyf/geometry/transform_parser.rb +98 -0
- data/lib/fontisan/svg_to_glyf/geometry.rb +15 -0
- data/lib/fontisan/svg_to_glyf/path/command.rb +18 -0
- data/lib/fontisan/svg_to_glyf/path/contour_builder.rb +140 -0
- data/lib/fontisan/svg_to_glyf/path/parser.rb +98 -0
- data/lib/fontisan/svg_to_glyf/path/state.rb +79 -0
- data/lib/fontisan/svg_to_glyf/path.rb +14 -0
- data/lib/fontisan/svg_to_glyf.rb +62 -0
- data/lib/fontisan/tables/cbdt.rb +113 -0
- data/lib/fontisan/tables/cblc.rb +172 -0
- data/lib/fontisan/tables/cblc_big_glyph_metrics.rb +28 -0
- data/lib/fontisan/tables/cblc_bitmap_size.rb +67 -0
- data/lib/fontisan/tables/cblc_glyph_bitmap_location.rb +28 -0
- data/lib/fontisan/tables/cblc_index_subtable.rb +104 -0
- data/lib/fontisan/tables/cblc_index_subtable_array_entry.rb +20 -0
- data/lib/fontisan/tables/cblc_index_subtable_format_parser.rb +150 -0
- data/lib/fontisan/tables/cblc_index_subtable_header.rb +18 -0
- data/lib/fontisan/tables/cblc_sbit_line_metrics.rb +28 -0
- data/lib/fontisan/tables/cff/cff2_charstring_builder.rb +225 -0
- data/lib/fontisan/tables/cff/cff_glyph.rb +176 -0
- data/lib/fontisan/tables/cff/charset.rb +276 -0
- data/lib/fontisan/tables/cff/charstring.rb +978 -0
- data/lib/fontisan/tables/cff/charstring_builder.rb +356 -0
- data/lib/fontisan/tables/cff/charstring_parser.rb +249 -0
- data/lib/fontisan/tables/cff/charstring_rebuilder.rb +168 -0
- data/lib/fontisan/tables/cff/charstrings_index.rb +159 -0
- data/lib/fontisan/tables/cff/dict.rb +353 -0
- data/lib/fontisan/tables/cff/dict_builder.rb +260 -0
- data/lib/fontisan/tables/cff/encoding.rb +273 -0
- data/lib/fontisan/tables/cff/expert_charsets.rb +85 -0
- data/lib/fontisan/tables/cff/header.rb +100 -0
- data/lib/fontisan/tables/cff/hint_operation_injector.rb +207 -0
- data/lib/fontisan/tables/cff/index.rb +241 -0
- data/lib/fontisan/tables/cff/index_builder.rb +170 -0
- data/lib/fontisan/tables/cff/offset_recalculator.rb +70 -0
- data/lib/fontisan/tables/cff/private_dict.rb +282 -0
- data/lib/fontisan/tables/cff/private_dict_writer.rb +129 -0
- data/lib/fontisan/tables/cff/standard_strings_data.rb +83 -0
- data/lib/fontisan/tables/cff/table_builder.rb +215 -0
- data/lib/fontisan/tables/cff/top_dict.rb +234 -0
- data/lib/fontisan/tables/cff.rb +497 -0
- data/lib/fontisan/tables/cff2/blend_operator.rb +240 -0
- data/lib/fontisan/tables/cff2/charstring_parser.rb +624 -0
- data/lib/fontisan/tables/cff2/dict_encoder.rb +94 -0
- data/lib/fontisan/tables/cff2/fd_select.rb +142 -0
- data/lib/fontisan/tables/cff2/header.rb +34 -0
- data/lib/fontisan/tables/cff2/index.rb +155 -0
- data/lib/fontisan/tables/cff2/index_builder.rb +80 -0
- data/lib/fontisan/tables/cff2/operand_stack.rb +232 -0
- data/lib/fontisan/tables/cff2/private_dict_blend_handler.rb +247 -0
- data/lib/fontisan/tables/cff2/region_matcher.rb +200 -0
- data/lib/fontisan/tables/cff2/table_builder.rb +567 -0
- data/lib/fontisan/tables/cff2/table_reader.rb +418 -0
- data/lib/fontisan/tables/cff2/variation_data_extractor.rb +212 -0
- data/lib/fontisan/tables/cff2.rb +353 -0
- data/lib/fontisan/tables/cmap.rb +399 -0
- data/lib/fontisan/tables/cmap_table.rb +228 -0
- data/lib/fontisan/tables/colr.rb +290 -0
- data/lib/fontisan/tables/cpal.rb +381 -0
- data/lib/fontisan/tables/cvar.rb +204 -0
- data/lib/fontisan/tables/fvar.rb +159 -0
- data/lib/fontisan/tables/glyf/compound_glyph.rb +482 -0
- data/lib/fontisan/tables/glyf/compound_glyph_resolver.rb +135 -0
- data/lib/fontisan/tables/glyf/curve_converter.rb +349 -0
- data/lib/fontisan/tables/glyf/glyph_builder.rb +468 -0
- data/lib/fontisan/tables/glyf/simple_glyph.rb +391 -0
- data/lib/fontisan/tables/glyf.rb +347 -0
- data/lib/fontisan/tables/glyf_table.rb +252 -0
- data/lib/fontisan/tables/gpos/glyph_filter.rb +87 -0
- data/lib/fontisan/tables/gpos/kerning_pairs.rb +215 -0
- data/lib/fontisan/tables/gpos/pair_position.rb +274 -0
- data/lib/fontisan/tables/gpos.rb +139 -0
- data/lib/fontisan/tables/gsub.rb +116 -0
- data/lib/fontisan/tables/gvar.rb +232 -0
- data/lib/fontisan/tables/head.rb +208 -0
- data/lib/fontisan/tables/head_table.rb +108 -0
- data/lib/fontisan/tables/hhea.rb +199 -0
- data/lib/fontisan/tables/hhea_table.rb +252 -0
- data/lib/fontisan/tables/hmtx.rb +281 -0
- data/lib/fontisan/tables/hmtx_table.rb +188 -0
- data/lib/fontisan/tables/hvar.rb +192 -0
- data/lib/fontisan/tables/layout_common.rb +245 -0
- data/lib/fontisan/tables/loca.rb +323 -0
- data/lib/fontisan/tables/loca_table.rb +209 -0
- data/lib/fontisan/tables/maxp.rb +253 -0
- data/lib/fontisan/tables/maxp_table.rb +255 -0
- data/lib/fontisan/tables/mvar.rb +185 -0
- data/lib/fontisan/tables/name.rb +340 -0
- data/lib/fontisan/tables/name_table.rb +173 -0
- data/lib/fontisan/tables/os2.rb +291 -0
- data/lib/fontisan/tables/os2_table.rb +326 -0
- data/lib/fontisan/tables/post.rb +206 -0
- data/lib/fontisan/tables/post_table.rb +180 -0
- data/lib/fontisan/tables/registry.rb +71 -0
- data/lib/fontisan/tables/sbix.rb +379 -0
- data/lib/fontisan/tables/svg.rb +300 -0
- data/lib/fontisan/tables/variation_common.rb +345 -0
- data/lib/fontisan/tables/vvar.rb +234 -0
- data/lib/fontisan/tables.rb +69 -0
- data/lib/fontisan/true_type_collection.rb +160 -0
- data/lib/fontisan/true_type_font.rb +80 -0
- data/lib/fontisan/true_type_font_extensions.rb +54 -0
- data/lib/fontisan/type1/afm_generator.rb +379 -0
- data/lib/fontisan/type1/afm_parser.rb +299 -0
- data/lib/fontisan/type1/agl.rb +456 -0
- data/lib/fontisan/type1/cff_to_type1_converter.rb +307 -0
- data/lib/fontisan/type1/charstring_converter.rb +238 -0
- data/lib/fontisan/type1/charstrings.rb +441 -0
- data/lib/fontisan/type1/conversion_options.rb +242 -0
- data/lib/fontisan/type1/decryptor.rb +183 -0
- data/lib/fontisan/type1/encodings.rb +695 -0
- data/lib/fontisan/type1/font_dictionary.rb +576 -0
- data/lib/fontisan/type1/generator.rb +217 -0
- data/lib/fontisan/type1/inf_generator.rb +307 -0
- data/lib/fontisan/type1/pfa_generator.rb +376 -0
- data/lib/fontisan/type1/pfa_parser.rb +159 -0
- data/lib/fontisan/type1/pfb_generator.rb +321 -0
- data/lib/fontisan/type1/pfb_parser.rb +166 -0
- data/lib/fontisan/type1/pfm_generator.rb +589 -0
- data/lib/fontisan/type1/pfm_parser.rb +433 -0
- data/lib/fontisan/type1/private_dict.rb +363 -0
- data/lib/fontisan/type1/seac_expander.rb +517 -0
- data/lib/fontisan/type1/ttf_to_type1_converter.rb +389 -0
- data/lib/fontisan/type1/upm_scaler.rb +118 -0
- data/lib/fontisan/type1.rb +48 -0
- data/lib/fontisan/type1_font.rb +347 -0
- data/lib/fontisan/ufo/anchor.rb +17 -0
- data/lib/fontisan/ufo/bounds.rb +91 -0
- data/lib/fontisan/ufo/cli.rb +105 -0
- data/lib/fontisan/ufo/compile/avar.rb +46 -0
- data/lib/fontisan/ufo/compile/base_compiler.rb +162 -0
- data/lib/fontisan/ufo/compile/cbdt_cblc.rb +104 -0
- data/lib/fontisan/ufo/compile/cff.rb +229 -0
- data/lib/fontisan/ufo/compile/cff2.rb +323 -0
- data/lib/fontisan/ufo/compile/cff2_subroutines.rb +39 -0
- data/lib/fontisan/ufo/compile/cmap.rb +143 -0
- data/lib/fontisan/ufo/compile/colr.rb +80 -0
- data/lib/fontisan/ufo/compile/cpal.rb +62 -0
- data/lib/fontisan/ufo/compile/feature_compiler.rb +161 -0
- data/lib/fontisan/ufo/compile/feature_writers/base.rb +56 -0
- data/lib/fontisan/ufo/compile/feature_writers/curs.rb +72 -0
- data/lib/fontisan/ufo/compile/feature_writers/gdef.rb +92 -0
- data/lib/fontisan/ufo/compile/feature_writers/kern.rb +50 -0
- data/lib/fontisan/ufo/compile/feature_writers/kern2.rb +57 -0
- data/lib/fontisan/ufo/compile/feature_writers/mark.rb +45 -0
- data/lib/fontisan/ufo/compile/feature_writers/mark_family_base.rb +124 -0
- data/lib/fontisan/ufo/compile/feature_writers/mkmk.rb +53 -0
- data/lib/fontisan/ufo/compile/feature_writers.rb +38 -0
- data/lib/fontisan/ufo/compile/filters/cubic_to_quadratic.rb +176 -0
- data/lib/fontisan/ufo/compile/filters/decompose_components.rb +33 -0
- data/lib/fontisan/ufo/compile/filters/flatten_components.rb +22 -0
- data/lib/fontisan/ufo/compile/filters/propagate_anchors.rb +102 -0
- data/lib/fontisan/ufo/compile/filters/remove_overlaps.rb +95 -0
- data/lib/fontisan/ufo/compile/filters/reverse_contour_direction.rb +27 -0
- data/lib/fontisan/ufo/compile/filters/sort_contours.rb +69 -0
- data/lib/fontisan/ufo/compile/filters/transformations.rb +113 -0
- data/lib/fontisan/ufo/compile/filters.rb +69 -0
- data/lib/fontisan/ufo/compile/fvar.rb +113 -0
- data/lib/fontisan/ufo/compile/glyf_loca.rb +206 -0
- data/lib/fontisan/ufo/compile/gpos.rb +248 -0
- data/lib/fontisan/ufo/compile/gsub.rb +267 -0
- data/lib/fontisan/ufo/compile/gvar.rb +225 -0
- data/lib/fontisan/ufo/compile/head.rb +97 -0
- data/lib/fontisan/ufo/compile/hhea.rb +57 -0
- data/lib/fontisan/ufo/compile/hmtx.rb +38 -0
- data/lib/fontisan/ufo/compile/hvar.rb +42 -0
- data/lib/fontisan/ufo/compile/item_variation_store.rb +100 -0
- data/lib/fontisan/ufo/compile/math.rb +143 -0
- data/lib/fontisan/ufo/compile/maxp.rb +57 -0
- data/lib/fontisan/ufo/compile/meta.rb +51 -0
- data/lib/fontisan/ufo/compile/mvar.rb +59 -0
- data/lib/fontisan/ufo/compile/name.rb +81 -0
- data/lib/fontisan/ufo/compile/os2.rb +81 -0
- data/lib/fontisan/ufo/compile/otf2_compiler.rb +40 -0
- data/lib/fontisan/ufo/compile/otf_compiler.rb +34 -0
- data/lib/fontisan/ufo/compile/post.rb +32 -0
- data/lib/fontisan/ufo/compile/sbix.rb +100 -0
- data/lib/fontisan/ufo/compile/stat.rb +106 -0
- data/lib/fontisan/ufo/compile/svg_table.rb +60 -0
- data/lib/fontisan/ufo/compile/ttf_compiler.rb +75 -0
- data/lib/fontisan/ufo/compile/variable_otf.rb +84 -0
- data/lib/fontisan/ufo/compile/variable_ttf.rb +161 -0
- data/lib/fontisan/ufo/compile.rb +72 -0
- data/lib/fontisan/ufo/component.rb +18 -0
- data/lib/fontisan/ufo/contour.rb +34 -0
- data/lib/fontisan/ufo/convert/from_bin_data.rb +366 -0
- data/lib/fontisan/ufo/convert/to_dfont.rb +45 -0
- data/lib/fontisan/ufo/convert/to_otc.rb +40 -0
- data/lib/fontisan/ufo/convert/to_otf.rb +18 -0
- data/lib/fontisan/ufo/convert/to_otf2.rb +20 -0
- data/lib/fontisan/ufo/convert/to_postscript.rb +64 -0
- data/lib/fontisan/ufo/convert/to_ttc.rb +35 -0
- data/lib/fontisan/ufo/convert/to_ttf.rb +21 -0
- data/lib/fontisan/ufo/convert/to_woff.rb +61 -0
- data/lib/fontisan/ufo/convert/to_woff2.rb +50 -0
- data/lib/fontisan/ufo/convert.rb +84 -0
- data/lib/fontisan/ufo/data_set.rb +21 -0
- data/lib/fontisan/ufo/features.rb +17 -0
- data/lib/fontisan/ufo/font.rb +63 -0
- data/lib/fontisan/ufo/glyph.rb +445 -0
- data/lib/fontisan/ufo/glyph_exists_error.rb +23 -0
- data/lib/fontisan/ufo/groups.rb +45 -0
- data/lib/fontisan/ufo/guideline.rb +19 -0
- data/lib/fontisan/ufo/image.rb +29 -0
- data/lib/fontisan/ufo/image_set.rb +99 -0
- data/lib/fontisan/ufo/info.rb +133 -0
- data/lib/fontisan/ufo/kerning.rb +32 -0
- data/lib/fontisan/ufo/layer.rb +78 -0
- data/lib/fontisan/ufo/layer_set.rb +37 -0
- data/lib/fontisan/ufo/lib.rb +24 -0
- data/lib/fontisan/ufo/plist.rb +123 -0
- data/lib/fontisan/ufo/point.rb +32 -0
- data/lib/fontisan/ufo/reader.rb +163 -0
- data/lib/fontisan/ufo/transformation.rb +50 -0
- data/lib/fontisan/ufo/writer.rb +123 -0
- data/lib/fontisan/ufo.rb +47 -0
- data/lib/fontisan/unicode/plane.rb +44 -0
- data/lib/fontisan/unicode.rb +17 -0
- data/lib/fontisan/utilities/brotli_wrapper.rb +177 -0
- data/lib/fontisan/utilities/checksum_calculator.rb +104 -0
- data/lib/fontisan/utilities/padding.rb +61 -0
- data/lib/fontisan/utilities.rb +11 -0
- data/lib/fontisan/utils/thread_pool.rb +134 -0
- data/lib/fontisan/utils.rb +10 -0
- data/lib/fontisan/validation/collection_validator.rb +265 -0
- data/lib/fontisan/validation.rb +9 -0
- data/lib/fontisan/validators/basic_validator.rb +73 -0
- data/lib/fontisan/validators/font_book_validator.rb +107 -0
- data/lib/fontisan/validators/opentype_validator.rb +118 -0
- data/lib/fontisan/validators/profile_loader.rb +134 -0
- data/lib/fontisan/validators/validator.rb +494 -0
- data/lib/fontisan/validators/web_font_validator.rb +95 -0
- data/lib/fontisan/validators.rb +14 -0
- data/lib/fontisan/variable/axis_normalizer.rb +215 -0
- data/lib/fontisan/variable/delta_applicator.rb +302 -0
- data/lib/fontisan/variable/glyph_delta_processor.rb +218 -0
- data/lib/fontisan/variable/instancer.rb +172 -0
- data/lib/fontisan/variable/metric_delta_processor.rb +282 -0
- data/lib/fontisan/variable/region_matcher.rb +208 -0
- data/lib/fontisan/variable/static_font_builder.rb +209 -0
- data/lib/fontisan/variable/table_updater.rb +219 -0
- data/lib/fontisan/variable.rb +16 -0
- data/lib/fontisan/variation/blend_applier.rb +197 -0
- data/lib/fontisan/variation/cache.rb +299 -0
- data/lib/fontisan/variation/cache_key_builder.rb +162 -0
- data/lib/fontisan/variation/converter.rb +373 -0
- data/lib/fontisan/variation/data_extractor.rb +84 -0
- data/lib/fontisan/variation/delta_applier.rb +262 -0
- data/lib/fontisan/variation/delta_parser.rb +228 -0
- data/lib/fontisan/variation/inspector.rb +275 -0
- data/lib/fontisan/variation/instance_font_wrapper.rb +41 -0
- data/lib/fontisan/variation/instance_generator.rb +122 -0
- data/lib/fontisan/variation/instance_writer.rb +360 -0
- data/lib/fontisan/variation/instancing/axis_space.rb +136 -0
- data/lib/fontisan/variation/instancing/glyph_outline.rb +204 -0
- data/lib/fontisan/variation/instancing/gvar_reader.rb +146 -0
- data/lib/fontisan/variation/instancing/item_variation_store.rb +92 -0
- data/lib/fontisan/variation/instancing/name_rewriter.rb +90 -0
- data/lib/fontisan/variation/instancing/true_type_instancer.rb +326 -0
- data/lib/fontisan/variation/instancing.rb +20 -0
- data/lib/fontisan/variation/interpolator.rb +231 -0
- data/lib/fontisan/variation/metrics_adjuster.rb +309 -0
- data/lib/fontisan/variation/optimizer.rb +417 -0
- data/lib/fontisan/variation/parallel_generator.rb +147 -0
- data/lib/fontisan/variation/region_matcher.rb +221 -0
- data/lib/fontisan/variation/subsetter.rb +400 -0
- data/lib/fontisan/variation/table_accessor.rb +105 -0
- data/lib/fontisan/variation/tuple_variation_header.rb +49 -0
- data/lib/fontisan/variation/validator.rb +336 -0
- data/lib/fontisan/variation/variable_svg_generator.rb +235 -0
- data/lib/fontisan/variation/variation_context.rb +208 -0
- data/lib/fontisan/variation/variation_preserver.rb +287 -0
- data/lib/fontisan/variation.rb +33 -0
- data/lib/fontisan/version.rb +5 -0
- data/lib/fontisan/version.rb.orig +9 -0
- data/lib/fontisan/woff2/collection_decoder.rb +223 -0
- data/lib/fontisan/woff2/collection_encoder.rb +302 -0
- data/lib/fontisan/woff2/directory.rb +255 -0
- data/lib/fontisan/woff2/encoder_rules.rb +114 -0
- data/lib/fontisan/woff2/glyf_canonicalizer.rb +90 -0
- data/lib/fontisan/woff2/glyf_loca_reconstruct.rb +401 -0
- data/lib/fontisan/woff2/glyf_loca_transform.rb +319 -0
- data/lib/fontisan/woff2/header.rb +101 -0
- data/lib/fontisan/woff2/hmtx_transformer.rb +140 -0
- data/lib/fontisan/woff2/sfnt_checksum.rb +107 -0
- data/lib/fontisan/woff2/table_transformer.rb +575 -0
- data/lib/fontisan/woff2/triplet_codec.rb +181 -0
- data/lib/fontisan/woff2/uint255.rb +101 -0
- data/lib/fontisan/woff2.rb +21 -0
- data/lib/fontisan/woff2_collection.rb +127 -0
- data/lib/fontisan/woff2_font.rb +754 -0
- data/lib/fontisan/woff_container.rb +83 -0
- data/lib/fontisan/woff_font.rb +554 -0
- data/lib/fontisan.rb +299 -0
- data/rakelib/bench.rake +9 -0
- data/rakelib/cdylib.rake +39 -0
- data/rakelib/corpus.rake +272 -0
- data/rakelib/corpus_convert.rake +43 -0
- data/rakelib/corpus_goldens.rake +22 -0
- data/rakelib/corpus_malformed.rake +20 -0
- data/rakelib/corpus_scan.rake +24 -0
- data/rakelib/java.rake +61 -0
- data/rakelib/native.rake +43 -0
- data/scripts/build-woff2.sh +57 -0
- data/scripts/compare_stack_aware.rb +187 -0
- data/scripts/corpus/generate_convert_goldens.rb +478 -0
- data/scripts/corpus/generate_goldens.rb +282 -0
- data/scripts/corpus/generate_malformed_goldens.rb +254 -0
- data/scripts/corpus/generate_scan_goldens.rb +98 -0
- data/scripts/measure_optimization.rb +148 -0
- data/scripts/tier_fallback.rb +228 -0
- data/scripts/tier_smoke.rb +72 -0
- metadata +945 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# 15 — Glyph type checks + SimpleGlyph#points bug
|
|
2
|
+
|
|
3
|
+
## Priority
|
|
4
|
+
P0
|
|
5
|
+
|
|
6
|
+
## Problem
|
|
7
|
+
~15 `respond_to?` calls probe glyph shape (`:simple?`, `:compound?`,
|
|
8
|
+
`:points`, `:bounding_box`). Plus the latent bug discovered in PR #135:
|
|
9
|
+
`Type1::TTFToType1Converter#extract_points` calls `glyph.points.each`
|
|
10
|
+
but `Tables::SimpleGlyph` has no `points` method. The `respond_to?`
|
|
11
|
+
check silently masked this for years.
|
|
12
|
+
|
|
13
|
+
## Sites
|
|
14
|
+
- `type1/ttf_to_type1_converter.rb:140` `respond_to?(:points)` — masks bug
|
|
15
|
+
- `type1/pfa_generator.rb:307` `respond_to?(:points)` — same bug
|
|
16
|
+
- `type1/pfb_generator.rb:276` `respond_to?(:points)` — same bug
|
|
17
|
+
- `ufo/convert/from_bin_data.rb:192/:312/:323/:325` `respond_to?(:simple?)` / `:compound?`
|
|
18
|
+
- `ufo/convert/from_bin_data.rb:361` `respond_to?(:glyph_name)`
|
|
19
|
+
- `stitcher/source.rb:287/:289/:375/:377` `respond_to?(:simple?)` / `:compound?`
|
|
20
|
+
- `hints/truetype_hint_extractor.rb:66` `respond_to?(:instructions)`
|
|
21
|
+
- `tables/glyf.rb:243` already fixed in PR #135
|
|
22
|
+
|
|
23
|
+
## SimpleGlyph API surface (current)
|
|
24
|
+
- `num_contours`, `num_points`
|
|
25
|
+
- `points_for_contour(index)` → Array<Hash{x,y,on_curve}>
|
|
26
|
+
- `point_at(index)`, `on_curve?(index)`
|
|
27
|
+
- `bounding_box` → [x_min, y_min, x_max, y_max]
|
|
28
|
+
- `simple?`, `compound?`, `empty?`
|
|
29
|
+
|
|
30
|
+
## Approach
|
|
31
|
+
1. Add `Tables::SimpleGlyph#points` — returns a flat Array<Hash> across
|
|
32
|
+
all contours. Single source of truth, lazy-built.
|
|
33
|
+
2. Add `Tables::CompoundGlyph#points` — returns the union of component
|
|
34
|
+
points (or empty if no components).
|
|
35
|
+
3. Replace all `respond_to?(:points)` with `is_a?(Tables::SimpleGlyph)`.
|
|
36
|
+
4. Replace `respond_to?(:simple?)` / `:compound?` with `is_a?` against
|
|
37
|
+
`Tables::SimpleGlyph`, `Tables::CompoundGlyph`, `Tables::Cff::CFFGlyph`.
|
|
38
|
+
5. For `:bounding_box`, the typed glyph classes all have it — drop the
|
|
39
|
+
check.
|
|
40
|
+
6. For `:glyph_name` on Post glyph records, declare it as a method (or
|
|
41
|
+
always-present BinData field).
|
|
42
|
+
7. For `:instructions` on SimpleGlyph, declare it.
|
|
43
|
+
|
|
44
|
+
## Acceptance criteria
|
|
45
|
+
- 0 `respond_to?(:simple?)` / `:compound?` / `:points` / `:bounding_box` /
|
|
46
|
+
`:glyph_name` / `:instructions` in `lib/fontisan/`
|
|
47
|
+
- Type 1 conversion now produces non-empty CharString data for simple
|
|
48
|
+
glyphs (the previously-broken `extract_points` path)
|
|
49
|
+
- All Type 1 specs pass
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# 16 — Variation table checks
|
|
2
|
+
|
|
3
|
+
## Priority
|
|
4
|
+
P2
|
|
5
|
+
|
|
6
|
+
## Problem
|
|
7
|
+
~15 `respond_to?` calls in `lib/fontisan/variation/` probe variation
|
|
8
|
+
table shape (`:item_variation_store`, `:region_list`, `:num_axes`,
|
|
9
|
+
`:advance_height_delta_set`, etc.). All variation tables are typed
|
|
10
|
+
BinData records — these checks should be `is_a?` or direct calls.
|
|
11
|
+
|
|
12
|
+
## Sites
|
|
13
|
+
- `variation/validator.rb:106/:136/:142/:144/:199/:211/:275/:278/:281/:286`
|
|
14
|
+
- `variation/metrics_adjuster.rb:230/:233/:310`
|
|
15
|
+
- `variable/metric_delta_processor.rb:224/:229/:234`
|
|
16
|
+
- `variable/delta_applicator.rb:296`
|
|
17
|
+
|
|
18
|
+
## Approach
|
|
19
|
+
1. For each variation table (Fvar, Hvar, Vvar, Mvar, Cff2, ItemVariationStore),
|
|
20
|
+
verify the BinData-declared fields and methods.
|
|
21
|
+
2. Replace `respond_to?(:item_variation_store)` with `is_a?(Tables::Hvar)`
|
|
22
|
+
or `is_a?(Tables::Vvar)` etc., then call `.item_variation_store`
|
|
23
|
+
directly.
|
|
24
|
+
3. For optional fields (rare in variation tables), declare them with
|
|
25
|
+
defaults on the BinData record.
|
|
26
|
+
4. For `metrics_adjuster.rb:310` `respond_to?(:number_of_h_metrics=)`,
|
|
27
|
+
Hhea is a BinData record with a declared writer — drop the check.
|
|
28
|
+
|
|
29
|
+
## Acceptance criteria
|
|
30
|
+
- 0 `respond_to?` in `lib/fontisan/variation/` and `lib/fontisan/variable/`
|
|
31
|
+
- All variation specs pass
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# 17 — UFO convert and Stitcher cleanup
|
|
2
|
+
|
|
3
|
+
## Priority
|
|
4
|
+
P2
|
|
5
|
+
|
|
6
|
+
## Problem
|
|
7
|
+
~10 `respond_to?` calls in `ufo/convert/from_bin_data.rb` probe BinData
|
|
8
|
+
table shape. Plus 1 site in `ufo/compile/fvar.rb`.
|
|
9
|
+
|
|
10
|
+
## Sites
|
|
11
|
+
- `ufo/convert/from_bin_data.rb:64/:82` Name records access
|
|
12
|
+
- `ufo/convert/from_bin_data.rb:103/:105` Post italic_angle
|
|
13
|
+
- `ufo/convert/from_bin_data.rb:131` Cmap unicode_mappings
|
|
14
|
+
- `ufo/convert/from_bin_data.rb:149/:155` Hmtx parse/metric
|
|
15
|
+
- `ufo/convert/from_bin_data.rb:172` Loca parse
|
|
16
|
+
- `ufo/convert/from_bin_data.rb:192/:312/:323/:325` Glyph type (see TODO 15)
|
|
17
|
+
- `ufo/convert/from_bin_data.rb:361` Post glyph_name
|
|
18
|
+
- `ufo/compile/fvar.rb:23/:24` Info axes/named_instances
|
|
19
|
+
- `stitcher/source.rb:83/:193/:220/:228/:287/:289/:375/:377` (see TODO 14/15)
|
|
20
|
+
|
|
21
|
+
## Approach
|
|
22
|
+
1. Replace `name_table.respond_to?(:name_records)` with `is_a?(Tables::Name)`.
|
|
23
|
+
2. Replace `post.respond_to?(:italic_angle)` with `is_a?(Tables::Post)`.
|
|
24
|
+
3. Replace `cmap_table.respond_to?(:unicode_mappings)` with `is_a?(Tables::Cmap)`.
|
|
25
|
+
4. Replace `hmtx.respond_to?(:parse_with_context)` with `is_a?(Tables::Hmtx)`.
|
|
26
|
+
5. Replace `loca.respond_to?(:parse_with_context)` with `is_a?(Tables::Loca)`.
|
|
27
|
+
6. For `ufo/compile/fvar.rb`, the `font.info` is always a `Ufo::Info`.
|
|
28
|
+
Check `Ufo::Info#axes` exists; if not, add it.
|
|
29
|
+
|
|
30
|
+
## Acceptance criteria
|
|
31
|
+
- 0 `respond_to?` in `lib/fontisan/ufo/convert/` and `lib/fontisan/ufo/compile/`
|
|
32
|
+
- 0 stitcher/source.rb respond_to? (split across TODO 14/15)
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# 18 — Generic value and IO checks
|
|
2
|
+
|
|
3
|
+
## Priority
|
|
4
|
+
P3
|
|
5
|
+
|
|
6
|
+
## Problem
|
|
7
|
+
~20 `respond_to?` calls probe generic value shape (`:to_i`, `:bytesize`,
|
|
8
|
+
`:to_binary_s`, `:empty?`, `:b`) or IO capabilities (`:seek`, `:rewind`).
|
|
9
|
+
Some are valid duck-typing at system boundaries; others are dead
|
|
10
|
+
defensive code.
|
|
11
|
+
|
|
12
|
+
## Sites
|
|
13
|
+
### Generic value conversion
|
|
14
|
+
- `export/ttx_generator.rb:67/:474` `respond_to?(:to_i)`
|
|
15
|
+
- `export/transformers/name_transformer.rb:47`
|
|
16
|
+
- `export/transformers/post_transformer.rb:36`
|
|
17
|
+
- `export/transformers/head_transformer.rb:45`
|
|
18
|
+
- `export/transformers/maxp_transformer.rb:48`
|
|
19
|
+
- `export/transformers/os2_transformer.rb:104`
|
|
20
|
+
- `export/transformers/hhea_transformer.rb:44`
|
|
21
|
+
- `export/transformers/font_to_ttx.rb:106`
|
|
22
|
+
- `export/exporter.rb:184/:204/:209` `respond_to?(:to_binary_s)` / `:checksum`
|
|
23
|
+
- `export/ttx_generator.rb:296/:435`
|
|
24
|
+
|
|
25
|
+
### String/bytes shape
|
|
26
|
+
- `utilities/padding.rb:30/:55` `respond_to?(:bytesize)`
|
|
27
|
+
- `utilities/brotli_wrapper.rb:136` `respond_to?(:bytesize)`
|
|
28
|
+
- `type1/decryptor.rb:115` `respond_to?(:b)` — String always has `.b`
|
|
29
|
+
|
|
30
|
+
### IO capability
|
|
31
|
+
- `binary/base_record.rb:27/:37` `respond_to?(:empty?)` / `:rewind`
|
|
32
|
+
- `tables/cff/index.rb:61` `respond_to?(:seek)`
|
|
33
|
+
|
|
34
|
+
### Charstring shape
|
|
35
|
+
- `hints/postscript_hint_extractor.rb:60/:62` (see TODO 13)
|
|
36
|
+
|
|
37
|
+
### Pattern matching
|
|
38
|
+
- `optimizers/charstring_rewriter.rb:130` `respond_to?(:positions)`
|
|
39
|
+
|
|
40
|
+
## Approach
|
|
41
|
+
1. For `respond_to?(:to_i)`, replace with `Integer(value) rescue value`
|
|
42
|
+
— accepts Integer-coercible values, falls back to original.
|
|
43
|
+
2. For `respond_to?(:bytesize)`, narrow the type at the boundary: accept
|
|
44
|
+
`String` only, call `.bytesize` directly.
|
|
45
|
+
3. For `respond_to?(:to_binary_s)`, all BinData records respond to it.
|
|
46
|
+
Drop the check; if a non-BinData object is passed, fix the caller.
|
|
47
|
+
4. For `respond_to?(:b)` on String, just call `.b` (String always has it).
|
|
48
|
+
5. For IO `respond_to?(:seek)` / `:rewind`, accept `IO` / `StringIO`
|
|
49
|
+
only. Convert String inputs to StringIO at the boundary.
|
|
50
|
+
6. For `respond_to?(:empty?)`, the BinData array always responds — drop.
|
|
51
|
+
|
|
52
|
+
## Acceptance criteria
|
|
53
|
+
- 0 unnecessary `respond_to?` in `lib/fontisan/export/`, `lib/fontisan/utilities/`,
|
|
54
|
+
`lib/fontisan/binary/`
|
|
55
|
+
- Where duck-typing is genuinely needed at a system boundary, document
|
|
56
|
+
it with a comment
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# 19 — Hand-rolled serialization migration to lutaml-model
|
|
2
|
+
|
|
3
|
+
## Priority
|
|
4
|
+
P2
|
|
5
|
+
|
|
6
|
+
## Problem
|
|
7
|
+
5 sites hand-roll `to_h` / `to_hash` on model classes, bypassing
|
|
8
|
+
lutaml-model's declarative serialization. Violates the absolute rule:
|
|
9
|
+
"NEVER write `def to_h`, `def to_hash`, `def from_h`, `def from_hash` on
|
|
10
|
+
a model class."
|
|
11
|
+
|
|
12
|
+
## Sites
|
|
13
|
+
- `lib/fontisan/tables/hmtx.rb:54` `def to_h` — manual hash from instance vars
|
|
14
|
+
- `lib/fontisan/tables/cff/dict.rb:112` `def to_h` — manual hash
|
|
15
|
+
- `lib/fontisan/type1/generator.rb:167` `def to_hash` — manual result hash
|
|
16
|
+
- `lib/fontisan/type1/conversion_options.rb:105` `def to_hash` — manual hash
|
|
17
|
+
- `lib/fontisan/ufo/point.rb:32` `def to_h` — manual hash for GLIF output
|
|
18
|
+
|
|
19
|
+
## Approach
|
|
20
|
+
For each model class:
|
|
21
|
+
|
|
22
|
+
1. Make it inherit from `Lutaml::Model::Serializable`.
|
|
23
|
+
2. Replace instance variables with `attribute :name, :type` declarations.
|
|
24
|
+
3. Replace `to_h` / `to_hash` with a `key_value do ... end` mapping block.
|
|
25
|
+
4. Callers use `model.to_hash` (framework-provided) instead of
|
|
26
|
+
hand-rolled `to_h`.
|
|
27
|
+
|
|
28
|
+
### Special considerations
|
|
29
|
+
|
|
30
|
+
- **`Ufo::Point#to_h`**: produces a Hash for GLIF XML output. The
|
|
31
|
+
lutaml-model `key_value` mapping with `:x`, `:y`, `:type`, `:smooth`
|
|
32
|
+
fields handles this. The `smooth: true` only-if-set behavior is
|
|
33
|
+
modeled via lutaml-model's optional attribute pattern.
|
|
34
|
+
|
|
35
|
+
- **`Type1::Generator#to_hash`**: this is a *result* hash, not a model
|
|
36
|
+
serialization. Rename to `#to_result_hash` (or expose individual
|
|
37
|
+
accessors) to clarify it's not lutaml-model-shaped. OR convert the
|
|
38
|
+
result to a `Models::Type1GenerationResult` model.
|
|
39
|
+
|
|
40
|
+
- **`Type1::ConversionOptions#to_hash`**: this is a value object
|
|
41
|
+
representing conversion options. Migrate to lutaml-model with
|
|
42
|
+
`attribute` declarations for each option.
|
|
43
|
+
|
|
44
|
+
- **`Tables::Hmtx#to_h`**: BinData records already provide `snapshot`.
|
|
45
|
+
Remove the hand-rolled `to_h` and let callers use `snapshot`.
|
|
46
|
+
|
|
47
|
+
- **`Tables::Cff::Dict#to_h`**: same — use `snapshot`.
|
|
48
|
+
|
|
49
|
+
## Acceptance criteria
|
|
50
|
+
- 0 `def to_h` / `def to_hash` in `lib/fontisan/` (excluding lutaml-model
|
|
51
|
+
framework methods)
|
|
52
|
+
- All serialization goes through `lutaml-model`
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# 20 — Variation validator type checks
|
|
2
|
+
|
|
3
|
+
## Priority
|
|
4
|
+
P2
|
|
5
|
+
|
|
6
|
+
## Problem
|
|
7
|
+
11 `respond_to?` calls in `lib/fontisan/variation/validator.rb` probe
|
|
8
|
+
typed BinData records (Cff2, Hvar, ItemVariationStore, RegionList).
|
|
9
|
+
The checks were left in place in PR #136 because `validator_spec.rb`
|
|
10
|
+
uses minimal doubles without all the methods stubbed.
|
|
11
|
+
|
|
12
|
+
## Sites
|
|
13
|
+
- :106 `cff2.respond_to?(:num_axes)` — Cff2 always declares num_axes
|
|
14
|
+
- :136 `table.respond_to?(:item_variation_store)` — Hvar/Vvar/Mvar all do
|
|
15
|
+
- :142 `store.respond_to?(:region_list)` — ItemVariationStore has it
|
|
16
|
+
- :144 `region_list.respond_to?(:axis_count)` — RegionList has it
|
|
17
|
+
- :199 `hvar.respond_to?(:item_variation_store)` — Hvar has it
|
|
18
|
+
- :211 `store.respond_to?(:item_variation_data)` — ItemVariationStore has it
|
|
19
|
+
- :275/:278/:281/:286 region/region_list/region_axes checks
|
|
20
|
+
|
|
21
|
+
## Approach
|
|
22
|
+
1. Replace `respond_to?` with direct method calls.
|
|
23
|
+
2. Wrap in begin/rescue NoMethodError OR pre-validate with is_a?.
|
|
24
|
+
3. Update `validator_spec.rb` doubles to provide all methods the
|
|
25
|
+
validator now calls directly. Use Struct-based fakes if helpful.
|
|
26
|
+
|
|
27
|
+
## Acceptance criteria
|
|
28
|
+
- 0 `respond_to?` in `lib/fontisan/variation/validator.rb`
|
|
29
|
+
- All variation specs pass
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# 21 — XML builder send() → tag!
|
|
2
|
+
|
|
3
|
+
## Priority
|
|
4
|
+
P2
|
|
5
|
+
|
|
6
|
+
## Problem
|
|
7
|
+
3 `xml.send(tag.to_sym)` calls in export/ use `.send` to create XML
|
|
8
|
+
elements with dynamic tag names. This violates the "no private send"
|
|
9
|
+
rule even though it's a common Ruby XML builder pattern.
|
|
10
|
+
|
|
11
|
+
## Sites
|
|
12
|
+
- `lib/fontisan/models/ttx/tables/binary_table.rb:21` `xml.send(tag.to_sym)`
|
|
13
|
+
- `lib/fontisan/export/ttx_generator.rb:297` `xml.send(tag.to_sym)`
|
|
14
|
+
- `lib/fontisan/export/ttx_generator.rb:313` `xml.send(clean_tag.to_sym)`
|
|
15
|
+
|
|
16
|
+
## Approach
|
|
17
|
+
Replace `xml.send(tag.to_sym) { ... }` with `xml.tag!(tag) { ... }`
|
|
18
|
+
(or the Builder-native equivalent public method). Builder::XmlMarkup
|
|
19
|
+
and Nokogiri::XML::Builder both expose `tag!` as the public dynamic
|
|
20
|
+
element creator.
|
|
21
|
+
|
|
22
|
+
## Acceptance criteria
|
|
23
|
+
- 0 `send(` in `lib/fontisan/export/` and `lib/fontisan/models/ttx/`
|
|
24
|
+
- All export/ttx specs pass
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# 22 — Type1Converter font_info fields
|
|
2
|
+
|
|
3
|
+
## Priority
|
|
4
|
+
P2
|
|
5
|
+
|
|
6
|
+
## Problem
|
|
7
|
+
6 `respond_to?` calls in `lib/fontisan/converters/type1_converter.rb`
|
|
8
|
+
probe `font_info` for typed fields (family_name, full_name, version,
|
|
9
|
+
copyright, weight, notice). The font_info is always a `Type1::FontInfo`
|
|
10
|
+
model — these fields are declared.
|
|
11
|
+
|
|
12
|
+
## Sites
|
|
13
|
+
- :723/:728/:733/:738/:744/:749 font_info field probes
|
|
14
|
+
|
|
15
|
+
Plus 1 site at :160: `font.font_dictionary.respond_to?(:reload)` —
|
|
16
|
+
FontDictionary is a typed class.
|
|
17
|
+
|
|
18
|
+
## Approach
|
|
19
|
+
1. Verify `Type1::FontInfo` declares all the probed fields.
|
|
20
|
+
2. Replace `font_info.respond_to?(:family_name)` with direct call.
|
|
21
|
+
3. For `font_dictionary.respond_to?(:reload)`, use `is_a?(Type1Font::FontDictionary)`.
|
|
22
|
+
|
|
23
|
+
## Acceptance criteria
|
|
24
|
+
- 0 `respond_to?` in `lib/fontisan/converters/type1_converter.rb`
|
|
25
|
+
- All Type1 converter specs pass
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# 23 — Boundary type checks (padding, base_record)
|
|
2
|
+
|
|
3
|
+
## Priority
|
|
4
|
+
P3
|
|
5
|
+
|
|
6
|
+
## Problem
|
|
7
|
+
4 `respond_to?` calls in `utilities/padding.rb` and `binary/base_record.rb`
|
|
8
|
+
are at String/IO system boundaries. They're the last remaining
|
|
9
|
+
"legitimate" duck-typing sites, but the rule is absolute: no
|
|
10
|
+
respond_to?.
|
|
11
|
+
|
|
12
|
+
## Sites
|
|
13
|
+
- `padding.rb:30/:55` `size.respond_to?(:bytesize) ? size.bytesize : size`
|
|
14
|
+
— accepts both String (uses bytesize) and Integer (uses self)
|
|
15
|
+
- `base_record.rb:27` `io.respond_to?(:empty?) && io.empty?` — String check
|
|
16
|
+
- `base_record.rb:37` `io.respond_to?(:rewind)` — IO check (String has no rewind)
|
|
17
|
+
|
|
18
|
+
## Approach
|
|
19
|
+
|
|
20
|
+
### padding.rb
|
|
21
|
+
- Change the signature: accept Integer only. Callers that have a
|
|
22
|
+
String compute `.bytesize` before calling.
|
|
23
|
+
|
|
24
|
+
### base_record.rb
|
|
25
|
+
- Convert String input to StringIO at the boundary (in `self.read`).
|
|
26
|
+
After conversion, `io` is always a StringIO/IO and responds to
|
|
27
|
+
`rewind`/`empty?` natively. Drop the respond_to? guards.
|
|
28
|
+
|
|
29
|
+
## Acceptance criteria
|
|
30
|
+
- 0 `respond_to?` in `lib/fontisan/utilities/` and `lib/fontisan/binary/`
|
|
31
|
+
- All padding and base_record specs pass
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# 24 — Validator dynamic field_key
|
|
2
|
+
|
|
3
|
+
## Priority
|
|
4
|
+
P3
|
|
5
|
+
|
|
6
|
+
## Problem
|
|
7
|
+
`lib/fontisan/validators/validator.rb:294` uses `table.respond_to?(field_key)`
|
|
8
|
+
to dynamically check whether a table has a named field. This is a
|
|
9
|
+
meta-programming pattern for running field-by-field validation rules.
|
|
10
|
+
|
|
11
|
+
## Site
|
|
12
|
+
- :294 `value = if table.respond_to?(field_key)`
|
|
13
|
+
|
|
14
|
+
## Approach
|
|
15
|
+
Replace the dynamic field lookup with BinData's `snapshot` hash.
|
|
16
|
+
BinData records expose all declared fields via `snapshot`, which
|
|
17
|
+
returns a hash of field name → value. Use `snapshot.key?(field_key)`
|
|
18
|
+
instead of `respond_to?`.
|
|
19
|
+
|
|
20
|
+
Alternatively, declare a typed `FieldValueAccessor` on each table
|
|
21
|
+
model that exposes declared fields as a hash.
|
|
22
|
+
|
|
23
|
+
## Acceptance criteria
|
|
24
|
+
- 0 `respond_to?` in `lib/fontisan/validators/validator.rb`
|
|
25
|
+
- All validator specs pass
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# 25 — Serialization migration to lutaml-model
|
|
2
|
+
|
|
3
|
+
## Priority
|
|
4
|
+
P2
|
|
5
|
+
|
|
6
|
+
## Problem
|
|
7
|
+
6 sites hand-roll `to_h` / `to_hash` / `to_json` on model classes,
|
|
8
|
+
violating the absolute rule against hand-rolled serialization.
|
|
9
|
+
|
|
10
|
+
## Sites
|
|
11
|
+
- `lib/fontisan/tables/hmtx.rb:54` `MetricRecord#to_h` — BinData inner record
|
|
12
|
+
- `lib/fontisan/tables/cff/dict.rb:112` `Dict#to_h` — internal hash accessor
|
|
13
|
+
- `lib/fontisan/type1/generator.rb:167` `Generator#to_hash` — option snapshot
|
|
14
|
+
- `lib/fontisan/type1/conversion_options.rb:105` `ConversionOptions#to_hash` — option snapshot
|
|
15
|
+
- `lib/fontisan/ufo/point.rb:32` `Point#to_h` — GLIF XML output
|
|
16
|
+
- `lib/fontisan/export/exporter.rb:65` `Result#to_json` — export payload
|
|
17
|
+
|
|
18
|
+
## Approach (per site)
|
|
19
|
+
|
|
20
|
+
### Hmtx::MetricRecord#to_h
|
|
21
|
+
BinData records expose `snapshot` returning a hash. Remove `to_h`,
|
|
22
|
+
update callers (in stitcher/, type1/) to use `metric.snapshot` or
|
|
23
|
+
extract `[:advance_width]` / `[:lsb]` directly.
|
|
24
|
+
|
|
25
|
+
### Cff::Dict#to_h
|
|
26
|
+
`Dict` wraps an internal `@dict` hash. `to_h` returns `@dict.dup`.
|
|
27
|
+
Rename to `#raw_hash` (or `#pairs`) to make clear it's an accessor,
|
|
28
|
+
not serialization. Update callers in `cff/table_builder.rb`,
|
|
29
|
+
`cff/private_dict_writer.rb`.
|
|
30
|
+
|
|
31
|
+
### Type1::Generator#to_hash and Type1::ConversionOptions#to_hash
|
|
32
|
+
These are option snapshots, not wire serialization. Rename to
|
|
33
|
+
`#to_options_hash` to clarify intent. Migrate `ConversionOptions`
|
|
34
|
+
to a `Lutaml::Model::Serializable` for declarative attribute
|
|
35
|
+
management.
|
|
36
|
+
|
|
37
|
+
### Ufo::Point#to_h
|
|
38
|
+
Used for GLIF XML output. Migrate `Ufo::Point` to inherit from
|
|
39
|
+
`Lutaml::Model::Serializable` with `:x`, `:y`, `:type`, `:smooth`
|
|
40
|
+
attributes and a `key_value` mapping.
|
|
41
|
+
|
|
42
|
+
### Export::Result#to_json
|
|
43
|
+
Used for export payload. Migrate to a `Models::ExportResult`
|
|
44
|
+
lutaml-model with JSON mapping.
|
|
45
|
+
|
|
46
|
+
## Acceptance criteria
|
|
47
|
+
- 0 `def to_h` / `def to_hash` / `def to_json` in `lib/fontisan/`
|
|
48
|
+
- All serialization goes through lutaml-model or BinData snapshot
|
|
49
|
+
- All affected specs pass
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# 26 — Variation preserver spec migration
|
|
2
|
+
|
|
3
|
+
## Priority
|
|
4
|
+
P3
|
|
5
|
+
|
|
6
|
+
## Problem
|
|
7
|
+
`lib/fontisan/variation/variation_preserver.rb:153` still uses
|
|
8
|
+
`respond_to?(:has_table?) && respond_to?(:table_data)` because the
|
|
9
|
+
spec uses `instance_double(TrueTypeFont)` with extensive per-test
|
|
10
|
+
stubs. Replacing with `is_a?(SfntSource)` requires migrating the
|
|
11
|
+
spec to use `SpecHelpers::FakeFont`.
|
|
12
|
+
|
|
13
|
+
## Site
|
|
14
|
+
- `variation_preserver.rb:151-154` (with TODO comment)
|
|
15
|
+
- `spec/fontisan/variation/variation_preserver_spec.rb` (entire file)
|
|
16
|
+
|
|
17
|
+
## Approach
|
|
18
|
+
1. Update spec to use `SpecHelpers::FakeFont` instead of `instance_double`.
|
|
19
|
+
2. For per-test variations, mutate `font.tables_hash` instead of
|
|
20
|
+
stubbing `has_table?`/`table_data`.
|
|
21
|
+
3. Replace `respond_to?` check in production with `is_a?(SfntSource)`.
|
|
22
|
+
|
|
23
|
+
## Acceptance criteria
|
|
24
|
+
- 0 `respond_to?` in `lib/fontisan/variation/variation_preserver.rb`
|
|
25
|
+
- All variation_preserver specs pass
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# 27 — Table class registry (OCP: eliminate case/when tag dispatch)
|
|
2
|
+
|
|
3
|
+
## Priority
|
|
4
|
+
P2
|
|
5
|
+
|
|
6
|
+
## Problem
|
|
7
|
+
The codebase has 8+ `case tag` dispatches that map a string tag like
|
|
8
|
+
`"HVAR"` to a Ruby class like `Tables::Hvar`. Each new table requires
|
|
9
|
+
updating every dispatch site. This violates OCP and DRY.
|
|
10
|
+
|
|
11
|
+
## Sites
|
|
12
|
+
- `lib/fontisan/variable/delta_applicator.rb:269` — case tag → table class
|
|
13
|
+
- `lib/fontisan/variable/static_font_builder.rb:91` — case tag → update method
|
|
14
|
+
- `lib/fontisan/variable/static_font_builder.rb:185` — case tag → table class
|
|
15
|
+
- `lib/fontisan/woff2/table_transformer.rb:36` — case tag → transform strategy
|
|
16
|
+
- `lib/fontisan/woff2/table_transformer.rb:62` — case tag → inverse transform
|
|
17
|
+
- `lib/fontisan/export/ttx_generator.rb:100` — case tag → transformer
|
|
18
|
+
- `lib/fontisan/variation/metrics_adjuster.rb:221` — case tag → metric
|
|
19
|
+
- `lib/fontisan/variation/instance_writer.rb:259` — case tag → writer
|
|
20
|
+
|
|
21
|
+
## Approach
|
|
22
|
+
Create `Tables::Registry` as a single source of truth for tag → class.
|
|
23
|
+
Each table file registers itself via a `register_tag` call:
|
|
24
|
+
|
|
25
|
+
```ruby
|
|
26
|
+
# lib/fontisan/tables/hvar.rb
|
|
27
|
+
module Fontisan
|
|
28
|
+
module Tables
|
|
29
|
+
class Hvar < Binary::BaseRecord
|
|
30
|
+
register_tag "HVAR"
|
|
31
|
+
...
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
`Tables::Registry.for(tag)` returns the class. Dispatch sites become:
|
|
38
|
+
|
|
39
|
+
```ruby
|
|
40
|
+
table_class = Tables::Registry.for(tag)
|
|
41
|
+
return nil unless table_class
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
This is OCP-compliant: adding a new table means adding `register_tag`
|
|
45
|
+
in the table's file, not modifying dispatch sites.
|
|
46
|
+
|
|
47
|
+
## Acceptance criteria
|
|
48
|
+
- 0 `case tag` dispatches in `lib/fontisan/`
|
|
49
|
+
- All callers use `Tables::Registry.for(tag)` instead
|
|
50
|
+
- All existing specs pass
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# 28 — Spec doubles cleanup
|
|
2
|
+
|
|
3
|
+
## Priority
|
|
4
|
+
P3
|
|
5
|
+
|
|
6
|
+
## Problem
|
|
7
|
+
**343 `double()` / `instance_double()` calls remain in specs** despite
|
|
8
|
+
the absolute rule "NEVER use `double()` in specs". Per file:
|
|
9
|
+
|
|
10
|
+
| File | Count |
|
|
11
|
+
|------|-------|
|
|
12
|
+
| spec/fontisan/converters/type1_converter_spec.rb | 58 |
|
|
13
|
+
| spec/fontisan/converters/format_converter_spec.rb | 33 |
|
|
14
|
+
| spec/fontisan/converters/type1_property_spec.rb | 28 |
|
|
15
|
+
| spec/fontisan/tables/cff2/table_builder_spec.rb | 25 |
|
|
16
|
+
| spec/fontisan/variation/validator_spec.rb | 24 |
|
|
17
|
+
| spec/fontisan/variation/subsetter_spec.rb | 17 |
|
|
18
|
+
| spec/fontisan/variation/metrics_adjuster_spec.rb | 15 |
|
|
19
|
+
| spec/fontisan/variation/converter_spec.rb | 14 |
|
|
20
|
+
| spec/fontisan/collection/variable_font_builder_spec.rb | 12 |
|
|
21
|
+
| spec/fontisan/converters/woff2_encoder_spec.rb | 11 |
|
|
22
|
+
| spec/fontisan/collection/table_deduplicator_spec.rb | 9 |
|
|
23
|
+
| spec/fontisan/collection/table_analyzer_spec.rb | 7 |
|
|
24
|
+
| spec/fontisan/tables/cff/cff_glyph_spec.rb | 6 |
|
|
25
|
+
| spec/fontisan/hints/truetype_hint_extractor_spec.rb | 6 |
|
|
26
|
+
| spec/fontisan/commands/unpack_command_spec.rb | 6 |
|
|
27
|
+
| (other files, 5 or fewer each) | ~74 |
|
|
28
|
+
|
|
29
|
+
## Approach
|
|
30
|
+
Each spec migration replaces `double("Foo", attr: value)` with either:
|
|
31
|
+
1. A real instance of the doubled class, OR
|
|
32
|
+
2. A `Struct`-based fake in a uniquely-named module (e.g., `XxxFakes::Foo`).
|
|
33
|
+
3. The shared `SpecHelpers::FakeFont` where the double is font-shaped.
|
|
34
|
+
|
|
35
|
+
PR #135/#136/#137 migrated ~10 spec files this way. The pattern is
|
|
36
|
+
established; remaining files are mechanical work.
|
|
37
|
+
|
|
38
|
+
## Acceptance criteria
|
|
39
|
+
- 0 `double()` / `instance_double()` in `spec/fontisan/`
|
|
40
|
+
- All specs pass
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# 29 — Strategy registries for per-tag dispatch (OCP completion)
|
|
2
|
+
|
|
3
|
+
## Priority
|
|
4
|
+
P2
|
|
5
|
+
|
|
6
|
+
## Problem
|
|
7
|
+
6 remaining `case tag` dispatches map a table tag to per-table
|
|
8
|
+
behavior (update, transform, emit, etc.). These are OCP violations:
|
|
9
|
+
adding a new table's behavior requires editing every dispatch site.
|
|
10
|
+
|
|
11
|
+
## Sites
|
|
12
|
+
- `export/ttx_generator.rb:100` — 13-way case → generate_X_table
|
|
13
|
+
- `variable/static_font_builder.rb:91` — 4-way case → update_X_table
|
|
14
|
+
- `variation/instance_writer.rb:259` — 5-way case → table class parse
|
|
15
|
+
- `variation/metrics_adjuster.rb:221` — 5-way case → MVAR metric
|
|
16
|
+
- `woff2/table_transformer.rb:36` — 3-way case → transform_X
|
|
17
|
+
- `woff2/table_transformer.rb:62` — 3-way case → transform version
|
|
18
|
+
|
|
19
|
+
## Approach
|
|
20
|
+
Each case/when becomes a class-level dispatch hash mapping tag →
|
|
21
|
+
method name. The dispatch site reads from the hash. Adding a new
|
|
22
|
+
table means adding one line to the hash in the same file.
|
|
23
|
+
|
|
24
|
+
For dispatches that use `Tables::Registry.for(tag)` to look up a
|
|
25
|
+
class (like instance_writer), extend the Registry to also know how
|
|
26
|
+
to construct from raw data.
|
|
27
|
+
|
|
28
|
+
## Acceptance criteria
|
|
29
|
+
- 0 `case tag` dispatches in `lib/fontisan/`
|
|
30
|
+
- All specs pass
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# 30 — Eliminate .send(:private_method) calls in specs
|
|
2
|
+
|
|
3
|
+
## Priority
|
|
4
|
+
P1
|
|
5
|
+
|
|
6
|
+
## Problem
|
|
7
|
+
288 `.send(:method_name, ...)` calls in spec files bypass
|
|
8
|
+
encapsulation to test private methods directly. This violates the
|
|
9
|
+
"never use private send methods" rule.
|
|
10
|
+
|
|
11
|
+
## Approach
|
|
12
|
+
For each method tested via `.send()`:
|
|
13
|
+
1. Make it public (move above `private` keyword)
|
|
14
|
+
2. Replace `.send(:method, args)` with `.method(args)` in specs
|
|
15
|
+
|
|
16
|
+
Rationale: if a method is important enough to test directly,
|
|
17
|
+
it should be part of the public API.
|
|
18
|
+
|
|
19
|
+
## Top files by send count
|
|
20
|
+
- type1_converter_spec.rb (66)
|
|
21
|
+
- cff2/table_builder_spec.rb (34)
|
|
22
|
+
- format_converter_spec.rb (17)
|
|
23
|
+
- type1_property_spec.rb (13)
|
|
24
|
+
- outline_converter_spec.rb (11)
|
|
25
|
+
- conversion_options_spec.rb (10)
|
|
26
|
+
- info_command_spec.rb (10)
|
|
27
|
+
- base_command_spec.rb (10)
|
|
28
|
+
- pattern_analyzer_spec.rb (10)
|
|
29
|
+
- variation/converter_spec.rb (10)
|
|
30
|
+
- woff2_font_spec.rb (10)
|
|
31
|
+
- Plus ~15 more files
|
|
32
|
+
|
|
33
|
+
## Acceptance criteria
|
|
34
|
+
- 0 `.send(:` calls in spec/
|
|
35
|
+
- All tested methods are public
|
|
36
|
+
- All specs pass
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Fontisan Bug Fix Backlog
|
|
2
|
+
|
|
3
|
+
Tracks correctness gaps discovered during codebase investigation.
|
|
4
|
+
Each file is `NN-short-name.md` where `NN` is the priority order.
|
|
5
|
+
|
|
6
|
+
## Priorities
|
|
7
|
+
|
|
8
|
+
### P0 — Correctness bugs (wrong data for specific font types)
|
|
9
|
+
- [x] ~~[01 — CFF Expert charset placeholder](01-cff-expert-charsets.md)~~ ✓ Done (v0.4.40)
|
|
10
|
+
- [x] ~~[02 — CFF2 subroutine call stubs](02-cff2-subroutine-stubs.md)~~ ✓ Done (v0.4.40)
|
|
11
|
+
- [x] ~~[09 — Type 1 → CFF seac expansion](09-type1-cff-seac-expansion.md)~~ ✓ Done
|
|
12
|
+
|
|
13
|
+
### P1 — Feature gaps (non-functional code paths)
|
|
14
|
+
- [x] ~~[03 — Variation subsetter placeholders](03-variation-subsetter-placeholders.md)~~ ✓ Done (v0.4.40)
|
|
15
|
+
- [x] ~~[04 — UFO image compile round-trip](04-ufo-image-compile-roundtrip.md)~~ ✓ Done (v0.4.40)
|
|
16
|
+
- [x] ~~[06 — Variable font instance WOFF2 output](06-instance-woff2-output.md)~~ ✓ Done (v0.4.41)
|
|
17
|
+
- [x] ~~[10 — TTF → Type 1 composite glyph handling](10-ttf-type1-composite-glyphs.md)~~ ✓ Done
|
|
18
|
+
|
|
19
|
+
### P2 — Documentation cleanup
|
|
20
|
+
- [x] ~~[05 — Stale CFF comment](05-stale-cff-comment.md)~~ ✓ Done (v0.4.40)
|
|
21
|
+
|
|
22
|
+
### P3 — Code quality violations
|
|
23
|
+
- [x] ~~[07 — Encapsulation violations (instance_variable_get/set, send to private)](07-encapsulation-violations.md)~~ ✓ Done (v0.4.42)
|
|
24
|
+
- [x] ~~[08 — respond_to? duck typing violations](08-respond-to-violations.md)~~ ✓ Done (v0.4.42)
|
|
25
|
+
- [x] ~~[11 — Remaining respond_to? violations](11-remaining-respond-to.md)~~ ✓ Done
|
|
26
|
+
|
|
27
|
+
### P3 — Encapsulation and architecture cleanup (post-#135 audit)
|
|
28
|
+
- [x] ~~[12 — Type 1 generators duck-typing](12-type1-generators-duck-typing.md)~~ ✓ Done (#136)
|
|
29
|
+
- [x] ~~[13 — Hint extractor duck-typing](13-hint-extractor-duck-typing.md)~~ ✓ Done (#136)
|
|
30
|
+
- [x] ~~[14 — Font interface type checks](14-font-interface-type-checks.md)~~ ✓ Done (#136)
|
|
31
|
+
- [x] ~~[15 — Glyph type checks + SimpleGlyph#points bug](15-glyph-type-checks-and-simple-glyph-points-bug.md)~~ ✓ Done (#136)
|
|
32
|
+
- [x] ~~[16 — Variation table checks](16-variation-table-checks.md)~~ ✓ Done (#137)
|
|
33
|
+
- [x] ~~[17 — UFO and Stitcher cleanup](17-ufo-and-stitcher-cleanup.md)~~ ✓ Done (#136)
|
|
34
|
+
- [x] ~~[18 — Generic value and IO checks](18-generic-value-and-io-checks.md)~~ ✓ Done (#137)
|
|
35
|
+
- [x] ~~[19 — Hand-rolled serialization migration to lutaml-model](19-serialization-migration.md)~~ ✓ Done (#137)
|
|
36
|
+
|
|
37
|
+
### P3 — Final encapsulation cleanup (post-#136 audit)
|
|
38
|
+
- [x] ~~[20 — Variation validator type checks](20-variation-validator-type-checks.md)~~ ✓ Done (#137)
|
|
39
|
+
- [x] ~~[21 — XML builder send() → tag!](21-xml-builder-send.md)~~ ✓ Done (#137)
|
|
40
|
+
- [x] ~~[22 — Type1Converter font_info fields](22-type1-converter-font-info.md)~~ ✓ Done (#137)
|
|
41
|
+
- [x] ~~[23 — Boundary type checks (padding, base_record)](23-boundary-type-checks.md)~~ ✓ Done (#137)
|
|
42
|
+
- [x] ~~[24 — Validator dynamic field_key](24-validator-dynamic-field-key.md)~~ ✓ Done (#137)
|
|
43
|
+
- [x] ~~[25 — Serialization migration to lutaml-model](25-serialization-migration.md)~~ ✓ Done (#137)
|
|
44
|
+
- [x] ~~[26 — Variation preserver spec migration](26-variation-preserver-spec-migration.md)~~ ✓ Done (#137)
|
|
45
|
+
|
|
46
|
+
### P3 — Architecture polish (post-#137 audit)
|
|
47
|
+
- [x] ~~[27 — Table class registry (OCP: eliminate case/when tag dispatch)](27-table-class-registry.md)~~ ✓ Done (#138)
|
|
48
|
+
- [x] ~~[28 — Spec doubles cleanup](28-spec-doubles-cleanup.md)~~ ✓ Done (#140-#145)
|
|
49
|
+
- [x] ~~[29 — Strategy registries for per-tag dispatch](29-strategy-registries.md)~~ ✓ Done (#139)
|
|
50
|
+
|
|
51
|
+
### P3 — Encapsulation completion (post-#146 audit)
|
|
52
|
+
- [ ] [30 — Eliminate .send(:private_method) calls in specs](30-eliminate-send-in-specs.md)
|