fontisan 0.2.13 → 0.2.16

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 (145) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +56 -196
  3. data/Gemfile +1 -1
  4. data/docs/.gitignore +17 -0
  5. data/docs/.vitepress/config.ts +317 -0
  6. data/docs/.vitepress/theme/components/ApiMethod.vue +127 -0
  7. data/docs/.vitepress/theme/components/Badge.vue +51 -0
  8. data/docs/.vitepress/theme/components/FeatureComparison.vue +87 -0
  9. data/docs/.vitepress/theme/components/HeroCodeBlock.vue +98 -0
  10. data/docs/.vitepress/theme/components/WithinHero.vue +30 -0
  11. data/docs/.vitepress/theme/index.ts +22 -0
  12. data/docs/.vitepress/theme/style.css +330 -0
  13. data/docs/api/conversion-options.md +141 -0
  14. data/docs/api/converters/curve-converter.md +34 -0
  15. data/docs/api/converters/hint-converter.md +34 -0
  16. data/docs/api/converters/outline-converter.md +27 -0
  17. data/docs/api/font-loader.md +111 -0
  18. data/docs/api/font-writer.md +103 -0
  19. data/docs/api/index.md +79 -0
  20. data/docs/api/models/glyph-accessor.md +43 -0
  21. data/docs/api/models/glyph.md +40 -0
  22. data/docs/api/models/table-analyzer.md +35 -0
  23. data/docs/api/sfnt-font.md +53 -0
  24. data/docs/api/type1-font.md +43 -0
  25. data/docs/api/validators/font-validator.md +31 -0
  26. data/docs/api/validators/helper.md +36 -0
  27. data/docs/api/validators/profile.md +39 -0
  28. data/docs/cli/convert.md +87 -0
  29. data/docs/cli/dump-table.md +110 -0
  30. data/docs/cli/export.md +176 -0
  31. data/docs/cli/features.md +124 -0
  32. data/docs/cli/glyphs.md +90 -0
  33. data/docs/cli/index.md +208 -0
  34. data/docs/cli/info.md +254 -0
  35. data/docs/cli/instance.md +122 -0
  36. data/docs/cli/ls.md +95 -0
  37. data/docs/cli/optical-size.md +94 -0
  38. data/docs/cli/pack.md +125 -0
  39. data/docs/cli/scripts.md +105 -0
  40. data/docs/cli/subset.md +39 -0
  41. data/docs/cli/tables.md +84 -0
  42. data/docs/cli/unicode.md +101 -0
  43. data/docs/cli/validate.md +48 -0
  44. data/docs/cli/variable.md +126 -0
  45. data/docs/cli/version.md +46 -0
  46. data/docs/guide/cli/convert.md +108 -0
  47. data/docs/guide/cli/export.md +138 -0
  48. data/docs/guide/cli/index.md +99 -0
  49. data/docs/guide/cli/info.md +144 -0
  50. data/docs/guide/cli/pack.md +155 -0
  51. data/docs/guide/cli/subset.md +118 -0
  52. data/docs/guide/cli/validate.md +139 -0
  53. data/docs/guide/color-fonts/bitmaps.md +177 -0
  54. data/docs/guide/color-fonts/colr-cpal.md +175 -0
  55. data/docs/guide/color-fonts/index.md +140 -0
  56. data/docs/guide/color-fonts/svg.md +154 -0
  57. data/docs/guide/color.md +51 -0
  58. data/docs/guide/comparisons/font-validator.md +222 -0
  59. data/docs/guide/comparisons/fonttools.md +200 -0
  60. data/docs/guide/comparisons/index.md +83 -0
  61. data/docs/guide/comparisons/lcdf-typetools.md +205 -0
  62. data/docs/guide/contributing.md +279 -0
  63. data/docs/guide/conversion/collections.md +251 -0
  64. data/docs/guide/conversion/curves.md +246 -0
  65. data/docs/guide/conversion/index.md +157 -0
  66. data/docs/guide/conversion/options.md +251 -0
  67. data/docs/guide/conversion/ttf-otf.md +184 -0
  68. data/docs/guide/conversion/type1.md +208 -0
  69. data/docs/guide/conversion/web.md +240 -0
  70. data/docs/guide/conversion.md +39 -0
  71. data/docs/guide/formats/collections.md +147 -0
  72. data/docs/guide/formats/dfont.md +99 -0
  73. data/docs/guide/formats/index.md +65 -0
  74. data/docs/guide/formats/otf.md +103 -0
  75. data/docs/guide/formats/svg.md +97 -0
  76. data/docs/guide/formats/ttf.md +105 -0
  77. data/docs/guide/formats/type1.md +118 -0
  78. data/docs/guide/formats/woff.md +115 -0
  79. data/docs/guide/hinting/autohint.md +141 -0
  80. data/docs/guide/hinting/conversion.md +161 -0
  81. data/docs/guide/hinting/index.md +86 -0
  82. data/docs/guide/hinting/postscript.md +149 -0
  83. data/docs/guide/hinting/truetype.md +135 -0
  84. data/docs/guide/hinting.md +44 -0
  85. data/docs/guide/index.md +152 -0
  86. data/docs/guide/installation.md +116 -0
  87. data/docs/guide/migrations/extract-ttc.md +549 -0
  88. data/docs/guide/migrations/font-validator.md +260 -0
  89. data/docs/guide/migrations/fonttools.md +208 -0
  90. data/docs/guide/migrations/index.md +64 -0
  91. data/docs/guide/migrations/otfinfo.md +197 -0
  92. data/docs/guide/quick-start.md +204 -0
  93. data/docs/guide/type1.md +58 -0
  94. data/docs/guide/universal-outline.md +151 -0
  95. data/docs/guide/validation/custom.md +195 -0
  96. data/docs/guide/validation/helpers.md +188 -0
  97. data/docs/guide/validation/index.md +132 -0
  98. data/docs/guide/validation/profiles.md +156 -0
  99. data/docs/guide/validation.md +47 -0
  100. data/docs/guide/variable-fonts/advanced.md +231 -0
  101. data/docs/guide/variable-fonts/axes.md +209 -0
  102. data/docs/guide/variable-fonts/conversion.md +197 -0
  103. data/docs/guide/variable-fonts/index.md +84 -0
  104. data/docs/guide/variable-fonts/instances.md +187 -0
  105. data/docs/guide/variable-fonts/named-instances.md +194 -0
  106. data/docs/guide/variable-fonts/static.md +168 -0
  107. data/docs/guide/variable.md +58 -0
  108. data/docs/guide/woff.md +59 -0
  109. data/docs/index.md +136 -0
  110. data/docs/lychee.toml +37 -0
  111. data/docs/package-lock.json +2560 -0
  112. data/docs/package.json +15 -0
  113. data/docs/public/apple-touch-icon.png +0 -0
  114. data/docs/public/favicon-96x96.png +0 -0
  115. data/docs/public/favicon.ico +0 -0
  116. data/docs/public/favicon.svg +1 -0
  117. data/docs/public/logo-full.svg +1 -0
  118. data/docs/public/logo.svg +1 -0
  119. data/docs/public/site.webmanifest +21 -0
  120. data/docs/public/web-app-manifest-192x192.png +0 -0
  121. data/docs/public/web-app-manifest-512x512.png +0 -0
  122. data/fontisan.gemspec +1 -1
  123. data/lib/fontisan/commands/features_command.rb +0 -1
  124. data/lib/fontisan/commands/info_command.rb +5 -5
  125. data/lib/fontisan/commands/scripts_command.rb +0 -1
  126. data/lib/fontisan/converters/format_converter.rb +2 -1
  127. data/lib/fontisan/converters/type1_converter.rb +65 -60
  128. data/lib/fontisan/hints/hint_converter.rb +2 -1
  129. data/lib/fontisan/loading_modes.rb +0 -2
  130. data/lib/fontisan/open_type_font.rb +0 -40
  131. data/lib/fontisan/sfnt_font.rb +41 -22
  132. data/lib/fontisan/tables/glyf/compound_glyph.rb +0 -1
  133. data/lib/fontisan/true_type_collection.rb +8 -8
  134. data/lib/fontisan/true_type_font.rb +1 -59
  135. data/lib/fontisan/type1/afm_parser.rb +2 -1
  136. data/lib/fontisan/type1/cff_to_type1_converter.rb +24 -19
  137. data/lib/fontisan/type1/private_dict.rb +28 -7
  138. data/lib/fontisan/type1/seac_expander.rb +22 -17
  139. data/lib/fontisan/variable/delta_applicator.rb +3 -3
  140. data/lib/fontisan/variation/optimizer.rb +0 -1
  141. data/lib/fontisan/version.rb +1 -1
  142. data/lib/fontisan/woff2_font.rb +2 -2
  143. data/lib/fontisan/woff_font.rb +3 -3
  144. data/lib/fontisan.rb +3 -2
  145. metadata +122 -4
data/docs/index.md ADDED
@@ -0,0 +1,136 @@
1
+ ---
2
+ layout: home
3
+ pageClass: my-index-page
4
+
5
+ hero:
6
+ name: "Fontisan"
7
+ text: "Universal font processing library for Ruby"
8
+ tagline: The most comprehensive font library — 100% Pure Ruby, no Python, no C++, no C# dependencies.
9
+ actions:
10
+ - theme: brand
11
+ text: Get Started
12
+ link: /guide/
13
+ - theme: alt
14
+ text: View on GitHub
15
+ link: https://github.com/fontist/fontisan
16
+ - theme: alt
17
+ text: Migrate from fonttools
18
+ link: /guide/migrations/fonttools
19
+
20
+ features:
21
+ - title: "🔄 Font Conversion"
22
+ details: Convert between TTF, OTF, WOFF, WOFF2, Type 1 (PFB/PFA), and SVG formats with curve conversion and optimization.
23
+ - title: "✅ Font Validation"
24
+ details: Comprehensive validation with 5 profiles (OpenType, Google Fonts, Microsoft, Adobe, Production), 56 helpers, and custom DSL.
25
+ - title: "🎨 Color Fonts"
26
+ details: Full support for COLR/CPAL layered color fonts, sbix bitmap fonts, and SVG-based color fonts.
27
+ - title: "⚡ Variable Fonts"
28
+ details: Process OpenType variable fonts with instance generation, format conversion, and named instance support.
29
+ - title: "🔧 Font Hinting"
30
+ details: Bidirectional hint conversion between TrueType and PostScript formats — a unique Fontisan capability.
31
+ - title: "📦 Type 1 Support"
32
+ details: Adobe Type 1 fonts (PFB/PFA) with eexec decryption, CharString parsing, and conversion to modern formats.
33
+ - title: "📚 Collections"
34
+ details: TTC/OTC/dfont collection support with pack, unpack, table deduplication, and format conversion.
35
+ - title: "💎 Pure Ruby"
36
+ details: Zero external dependencies. No Python, no C++, no C# required. Works anywhere Ruby runs.
37
+ ---
38
+
39
+ <WithinHero>
40
+ <HeroCodeBlock title="fontisan"><div class="line"><span class="comment"># Get detailed font information</span></div><div class="line"><span class="prompt">$</span> <span class="cmd">fontisan</span> info OpenSans-Regular.ttf</div><div class="line">Family: Open Sans Style: Regular Format: TTF</div><div class="line"><span class="comment"># Convert between formats</span></div><div class="line"><span class="prompt">$</span> <span class="cmd">fontisan</span> convert font.ttf --to woff2</div><div class="line"><span class="success">✓</span> font.woff2 created (45% smaller)</div><div class="line"><span class="comment"># Validate with Google Fonts profile</span></div><div class="line"><span class="prompt">$</span> <span class="cmd">fontisan</span> validate font.ttf -p google_fonts</div><div class="line"><span class="success">✓</span> All 56 checks passed</div></HeroCodeBlock>
41
+ </WithinHero>
42
+
43
+ <style>
44
+ .pure-ruby-hero {
45
+ display: inline-flex;
46
+ align-items: center;
47
+ gap: 0.5rem;
48
+ padding: 0.25rem 0.75rem;
49
+ background: linear-gradient(135deg, #bf4e6a, #d4718a);
50
+ color: white;
51
+ border-radius: 9999px;
52
+ font-size: 0.85rem;
53
+ font-weight: 700;
54
+ text-transform: uppercase;
55
+ letter-spacing: 0.05em;
56
+ margin-top: 1rem;
57
+ }
58
+ </style>
59
+
60
+ <div class="pure-ruby-hero">
61
+ 💎 100% Pure Ruby
62
+ </div>
63
+
64
+ ## Why Fontisan?
65
+
66
+ Fontisan is the **most comprehensive font processing library in pure Ruby**, combining the capabilities of:
67
+
68
+ - **fonttools** (Python) — 100+ OpenType tables, variable fonts, subsetting
69
+ - **lcdf-typetools** (C++) — otfinfo, cfftot1, Type 1 validation
70
+ - **Font-Validator** (C#) — Comprehensive validation with coverage reports
71
+
72
+ **The key differentiator**: Fontisan is 100% pure Ruby. No Python, no C++, no C# dependencies. Install and run anywhere Ruby runs.
73
+
74
+ ## Feature Comparison
75
+
76
+ | Feature | fonttools | lcdf-typetools | Font-Validator | **Fontisan** |
77
+ |---------|-----------|----------------|----------------|--------------|
78
+ | Pure Ruby | ❌ | ❌ | ❌ | ✅ |
79
+ | Python-free | ❌ | ✅ | ✅ | ✅ |
80
+ | Font conversion | ✅ | ✅ | ❌ | ✅ |
81
+ | Validation | ❌ | ❌ | ✅ | ✅ |
82
+ | Bidirectional hints | ❌ | Partial | ❌ | ✅ |
83
+ | Variable fonts | ✅ | ❌ | ❌ | ✅ |
84
+ | Type 1 support | Partial | ✅ | ❌ | ✅ |
85
+
86
+ [See full comparison →](/guide/comparisons/)
87
+
88
+ ## CLI Usage
89
+
90
+ ```bash
91
+ # Get font information
92
+ fontisan info font.ttf
93
+
94
+ # Convert fonts
95
+ fontisan convert input.ttf --to otf --output output.otf
96
+
97
+ # Validate fonts
98
+ fontisan validate font.ttf --profile google_fonts
99
+
100
+ # Work with collections
101
+ fontisan unpack fonts.ttc --output-dir ./extracted
102
+ ```
103
+
104
+ ## Ruby API
105
+
106
+ ```ruby
107
+ require 'fontisan'
108
+
109
+ # Load any font format
110
+ font = Fontisan::FontLoader.load('font.ttf')
111
+
112
+ # Get font information
113
+ info = Fontisan::Commands::InfoCommand.new(font: font).run
114
+ puts info.family_name
115
+ puts info.style
116
+
117
+ # Convert between formats
118
+ Fontisan::FontWriter.write(font, 'output.woff2')
119
+
120
+ # Validate a font
121
+ result = Fontisan::FontValidator.validate('font.otf', profile: :google_fonts)
122
+ puts result.passed?
123
+ ```
124
+
125
+ ## Migration Guides
126
+
127
+ Coming from another tool? We have migration guides:
128
+
129
+ - [From fonttools (Python)](/guide/migrations/fonttools) — Comprehensive Python to Ruby migration
130
+ - [From extract_ttc](/guide/migrations/extract-ttc) — Already fully compatible
131
+ - [From otfinfo](/guide/migrations/otfinfo) — Command equivalents for lcdf-typetools
132
+ - [From Font-Validator](/guide/migrations/font-validator) — Validation profile mapping
133
+
134
+ ## License
135
+
136
+ Fontisan is open source and available under the [MIT License](https://github.com/fontist/fontisan/blob/main/LICENSE).
data/docs/lychee.toml ADDED
@@ -0,0 +1,37 @@
1
+ # Lychee Link Checker Configuration
2
+ # https://github.com/lycheeverse/lychee
3
+
4
+ ############################# Cache ###############################
5
+ cache = true
6
+ max_cache_age = "1d"
7
+
8
+ ############################# Runtime #############################
9
+ max_redirects = 10
10
+ max_retries = 3
11
+ max_concurrency = 8
12
+ timeout = 20
13
+
14
+ ############################# Requests ############################
15
+ accept = ["200..=299", "429"]
16
+ user_agent = "lychee/fontisan-docs"
17
+ scheme = ["https", "http", "file"]
18
+ require_https = false
19
+ include_mail = false
20
+ include_verbatim = true
21
+
22
+ ############################# Exclusions ##########################
23
+ # Exclude URLs (regex patterns)
24
+ exclude = [
25
+ 'github\.com/fontist/fontisan/issues',
26
+ 'github\.com/fontist/extract_ttc',
27
+ ]
28
+
29
+ # Exclude paths from checking (regex patterns)
30
+ exclude_path = [
31
+ "node_modules",
32
+ ]
33
+
34
+ ############################# Other ###############################
35
+ verbose = "info"
36
+ index_files = ["index.html"]
37
+ fallback_extensions = ["html"]