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
@@ -0,0 +1,111 @@
1
+ ---
2
+ title: FontLoader
3
+ ---
4
+
5
+ # FontLoader
6
+
7
+ Unified font loading with automatic format detection.
8
+
9
+ ## Overview
10
+
11
+ `Fontisan::FontLoader` provides a unified interface for loading fonts in any supported format.
12
+
13
+ ## Class Methods
14
+
15
+ ### load(source)
16
+
17
+ Load a font from file path or IO.
18
+
19
+ ```ruby
20
+ # From file path
21
+ font = Fontisan::FontLoader.load('font.ttf')
22
+ font = Fontisan::FontLoader.load('font.otf')
23
+ font = Fontisan::FontLoader.load('font.pfb')
24
+ font = Fontisan::FontLoader.load('font.woff2')
25
+
26
+ # From IO
27
+ font = Fontisan::FontLoader.load(File.open('font.ttf'))
28
+
29
+ # From string
30
+ font = Fontisan::FontLoader.load(File.read('font.ttf', mode: 'rb'))
31
+ ```
32
+
33
+ **Parameters:**
34
+
35
+ | Name | Type | Description |
36
+ |------|------|-------------|
37
+ | source | String, IO | File path, IO object, or binary data |
38
+
39
+ **Returns:** SfntFont, Type1Font, or Collection
40
+
41
+ **Raises:** Fontisan::FormatError if format is unsupported
42
+
43
+ ### detect_format(source)
44
+
45
+ Detect font format without loading.
46
+
47
+ ```ruby
48
+ format = Fontisan::FontLoader.detect_format('font.ttf')
49
+ # => :ttf
50
+
51
+ format = Fontisan::FontLoader.detect_format('font.otf')
52
+ # => :otf
53
+
54
+ format = Fontisan::FontLoader.detect_format('font.pfb')
55
+ # => :type1
56
+ ```
57
+
58
+ **Returns:** Symbol or nil
59
+
60
+ ## Supported Formats
61
+
62
+ | Format | Detection | Notes |
63
+ |--------|-----------|-------|
64
+ | TTF | Magic number | TrueType |
65
+ | OTF | Magic number | OpenType/CFF |
66
+ | TTC | Magic number | TrueType Collection |
67
+ | OTC | Magic number | OpenType Collection |
68
+ | WOFF | Magic number | Web Open Font Format |
69
+ | WOFF2 | Magic number | Web Open Font Format 2 |
70
+ | PFB | Marker byte | Adobe Type 1 Binary |
71
+ | PFA | Text | Adobe Type 1 ASCII |
72
+ | dfont | Magic number | Apple Data Fork |
73
+
74
+ ## Examples
75
+
76
+ ### Load with Error Handling
77
+
78
+ ```ruby
79
+ begin
80
+ font = Fontisan::FontLoader.load(path)
81
+ puts "Loaded: #{font.family_name}"
82
+ rescue Fontisan::FormatError => e
83
+ puts "Unsupported format: #{e.message}"
84
+ rescue Errno::ENOENT => e
85
+ puts "File not found: #{path}"
86
+ end
87
+ ```
88
+
89
+ ### Batch Loading
90
+
91
+ ```ruby
92
+ fonts = Dir.glob('fonts/*.ttf').map do |path|
93
+ Fontisan::FontLoader.load(path)
94
+ end
95
+
96
+ puts "Loaded #{fonts.length} fonts"
97
+ ```
98
+
99
+ ### Detect and Load
100
+
101
+ ```ruby
102
+ path = 'unknown.dat'
103
+
104
+ format = Fontisan::FontLoader.detect_format(path)
105
+ if format
106
+ puts "Detected format: #{format}"
107
+ font = Fontisan::FontLoader.load(path)
108
+ else
109
+ puts "Unknown format"
110
+ end
111
+ ```
@@ -0,0 +1,103 @@
1
+ ---
2
+ title: FontWriter
3
+ ---
4
+
5
+ # FontWriter
6
+
7
+ Write fonts to various formats.
8
+
9
+ ## Overview
10
+
11
+ `Fontisan::FontWriter` handles saving fonts to files in various formats.
12
+
13
+ ## Class Methods
14
+
15
+ ### write(font, path, options: {})
16
+
17
+ Write a font to a file.
18
+
19
+ ```ruby
20
+ font = Fontisan::FontLoader.load('input.ttf')
21
+
22
+ # Write as TTF
23
+ Fontisan::FontWriter.write(font, 'output.ttf')
24
+
25
+ # Write as OTF
26
+ Fontisan::FontWriter.write(font, 'output.otf')
27
+
28
+ # Write as WOFF2
29
+ Fontisan::FontWriter.write(font, 'output.woff2')
30
+
31
+ # With options
32
+ options = Fontisan::ConversionOptions.new(
33
+ generating: { optimize_tables: true }
34
+ )
35
+ Fontisan::FontWriter.write(font, 'output.ttf', options: options)
36
+ ```
37
+
38
+ **Parameters:**
39
+
40
+ | Name | Type | Description |
41
+ |------|------|-------------|
42
+ | font | SfntFont, Type1Font | Font object |
43
+ | path | String | Output file path |
44
+ | options | ConversionOptions | Optional settings |
45
+
46
+ **Returns:** Boolean
47
+
48
+ ### write_to_file(data, path, sfnt_version: nil)
49
+
50
+ Write raw font data to a file.
51
+
52
+ ```ruby
53
+ # Write raw table data
54
+ Fontisan::FontWriter.write_to_file(
55
+ font.table_data,
56
+ 'output.ttf',
57
+ sfnt_version: 0x00010000
58
+ )
59
+ ```
60
+
61
+ ## Output Formats
62
+
63
+ | Format | Extension | Notes |
64
+ |--------|-----------|-------|
65
+ | TTF | .ttf | TrueType |
66
+ | OTF | .otf | OpenType/CFF |
67
+ | WOFF | .woff | Web Open Font Format |
68
+ | WOFF2 | .woff2 | Web Open Font Format 2 |
69
+ | PFB | .pfb | Adobe Type 1 |
70
+ | SVG | .svg | SVG Font |
71
+
72
+ ## Examples
73
+
74
+ ### Convert and Write
75
+
76
+ ```ruby
77
+ # Load TTF
78
+ font = Fontisan::FontLoader.load('input.ttf')
79
+
80
+ # Convert to OTF
81
+ options = Fontisan::ConversionOptions.recommended(from: :ttf, to: :otf)
82
+ converter = Fontisan::Converters::OutlineConverter.new
83
+ otf_tables = converter.convert(font, options: options)
84
+
85
+ # Write OTF
86
+ Fontisan::FontWriter.write(otf_tables, 'output.otf')
87
+ ```
88
+
89
+ ### Batch Writing
90
+
91
+ ```ruby
92
+ fonts.each_with_index do |font, i|
93
+ Fontisan::FontWriter.write(font, "output-#{i}.ttf")
94
+ end
95
+ ```
96
+
97
+ ### Web Optimization
98
+
99
+ ```ruby
100
+ font = Fontisan::FontLoader.load('input.otf')
101
+ options = Fontisan::ConversionOptions.from_preset(:web_optimized)
102
+ Fontisan::FontWriter.write(font, 'output.woff2', options: options)
103
+ ```
data/docs/api/index.md ADDED
@@ -0,0 +1,79 @@
1
+ ---
2
+ title: API Reference
3
+ ---
4
+
5
+ # API Reference
6
+
7
+ This section provides detailed API documentation for Fontisan's core classes, converters, validators, and models.
8
+
9
+ ## Core Classes
10
+
11
+ - [FontLoader](/api/font-loader) — Unified font loading with automatic format detection
12
+ - [FontWriter](/api/font-writer) — Write fonts to various formats
13
+ - [ConversionOptions](/api/conversion-options) — Type-safe conversion configuration
14
+ - [SfntFont](/api/sfnt-font) — Base class for TrueType/OpenType fonts
15
+ - [Type1Font](/api/type1-font) — Adobe Type 1 font handler
16
+
17
+ ## Converters
18
+
19
+ - [OutlineConverter](/api/converters/outline-converter) — TTF ↔ OTF outline conversion
20
+ - [CurveConverter](/api/converters/curve-converter) — Quadratic ↔ Cubic curve conversion
21
+ - [HintConverter](/api/converters/hint-converter) — TrueType ↔ PostScript hint conversion
22
+
23
+ ## Validators
24
+
25
+ - [FontValidator](/api/validators/font-validator) — Main validation entry point
26
+ - [ValidationProfile](/api/validators/profile) — Validation profile definitions
27
+ - [ValidationHelper](/api/validators/helper) — Individual validation helpers
28
+
29
+ ## Models
30
+
31
+ - [Glyph](/api/models/glyph) — Font glyph representation
32
+ - [GlyphAccessor](/api/models/glyph-accessor) — Unified glyph access with caching
33
+ - [TableAnalyzer](/api/models/table-analyzer) — Font table analysis
34
+
35
+ ## Using the API
36
+
37
+ ### Loading Fonts
38
+
39
+ ```ruby
40
+ require 'fontisan'
41
+
42
+ # Automatic format detection
43
+ font = Fontisan::FontLoader.load('font.ttf')
44
+ font = Fontisan::FontLoader.load('font.otf')
45
+ font = Fontisan::FontLoader.load('font.pfb')
46
+
47
+ # Load from IO
48
+ font = Fontisan::FontLoader.load(io)
49
+ ```
50
+
51
+ ### Converting Fonts
52
+
53
+ ```ruby
54
+ # Get recommended options
55
+ options = Fontisan::ConversionOptions.recommended(from: :ttf, to: :otf)
56
+
57
+ # Convert with options
58
+ converter = Fontisan::Converters::OutlineConverter.new
59
+ tables = converter.convert(font, options: options)
60
+
61
+ # Write the result
62
+ Fontisan::FontWriter.write(font, 'output.otf')
63
+ ```
64
+
65
+ ### Validating Fonts
66
+
67
+ ```ruby
68
+ # Validate with a profile
69
+ result = Fontisan::FontValidator.validate('font.ttf', profile: :google_fonts)
70
+
71
+ # Check results
72
+ if result.passed?
73
+ puts "Font is valid!"
74
+ else
75
+ result.errors.each do |error|
76
+ puts "#{error.code}: #{error.message}"
77
+ end
78
+ end
79
+ ```
@@ -0,0 +1,43 @@
1
+ ---
2
+ title: GlyphAccessor
3
+ ---
4
+
5
+ # GlyphAccessor
6
+
7
+ Unified glyph access with caching.
8
+
9
+ ## Overview
10
+
11
+ `Fontisan::GlyphAccessor` provides efficient glyph access.
12
+
13
+ ## Methods
14
+
15
+ ### at(id) / get(id)
16
+
17
+ Access glyph by ID.
18
+
19
+ ```ruby
20
+ glyph = font.glyphs[42]
21
+ ```
22
+
23
+ ### each
24
+
25
+ Iterate over all glyphs.
26
+
27
+ ```ruby
28
+ font.glyphs.each do |glyph|
29
+ puts glyph.name
30
+ end
31
+ ```
32
+
33
+ ### count
34
+
35
+ Get glyph count.
36
+
37
+ ```ruby
38
+ count = font.glyphs.count
39
+ ```
40
+
41
+ ## See Also
42
+
43
+ - [Glyph](/api/models/glyph)
@@ -0,0 +1,40 @@
1
+ ---
2
+ title: Glyph
3
+ ---
4
+
5
+ # Glyph
6
+
7
+ Font glyph representation.
8
+
9
+ ## Overview
10
+
11
+ `Fontisan::Glyph` represents a single glyph.
12
+
13
+ ## Properties
14
+
15
+ | Property | Type | Description |
16
+ |----------|------|-------------|
17
+ | `id` | Integer | Glyph ID |
18
+ | `name` | String | Glyph name |
19
+ | `unicode` | Integer | Unicode codepoint |
20
+ | `bounds` | Hash | Bounding box |
21
+ | `contours` | Array | Outline contours |
22
+
23
+ ## Methods
24
+
25
+ ### outline
26
+
27
+ Get glyph outline.
28
+
29
+ ```ruby
30
+ outline = glyph.outline
31
+ outline.contours.each do |contour|
32
+ contour.points.each do |point|
33
+ puts "(#{point.x}, #{point.y})"
34
+ end
35
+ end
36
+ ```
37
+
38
+ ## See Also
39
+
40
+ - [GlyphAccessor](/api/models/glyph-accessor)
@@ -0,0 +1,35 @@
1
+ ---
2
+ title: TableAnalyzer
3
+ ---
4
+
5
+ # TableAnalyzer
6
+
7
+ Font table analysis.
8
+
9
+ ## Overview
10
+
11
+ `Fontisan::TableAnalyzer` analyzes font tables.
12
+
13
+ ## Methods
14
+
15
+ ### analyze(fonts, parallel: false)
16
+
17
+ Analyze fonts for table sharing.
18
+
19
+ ```ruby
20
+ analyzer = Fontisan::TableAnalyzer.new(fonts, parallel: true)
21
+ stats = analyzer.analyze
22
+ puts "Shared tables: #{stats.shared_count}"
23
+ ```
24
+
25
+ ### checksum(table)
26
+
27
+ Calculate table checksum.
28
+
29
+ ```ruby
30
+ checksum = analyzer.checksum(font.tables['head'])
31
+ ```
32
+
33
+ ## See Also
34
+
35
+ - [Collections Guide](/guide/formats/collections)
@@ -0,0 +1,53 @@
1
+ ---
2
+ title: SfntFont
3
+ ---
4
+
5
+ # SfntFont
6
+
7
+ Base class for TrueType and OpenType fonts.
8
+
9
+ ## Overview
10
+
11
+ `Fontisan::SfntFont` is the base class for sfnt-based fonts (TTF, OTF, WOFF, WOFF2).
12
+
13
+ ## Properties
14
+
15
+ | Property | Type | Description |
16
+ |----------|------|-------------|
17
+ | `tables` | Hash | Font tables by tag |
18
+ | `glyphs` | GlyphAccessor | Glyph access object |
19
+ | `family_name` | String | Font family name |
20
+ | `style` | String | Font style |
21
+ | `version` | String | Font version |
22
+
23
+ ## Methods
24
+
25
+ ### table(tag)
26
+
27
+ Access a specific table.
28
+
29
+ ```ruby
30
+ head = font.table('head')
31
+ name = font.table('name')
32
+ ```
33
+
34
+ ### glyph_name(id)
35
+
36
+ Get glyph name by ID.
37
+
38
+ ```ruby
39
+ name = font.glyph_name(42)
40
+ ```
41
+
42
+ ### glyph_count
43
+
44
+ Get total glyph count.
45
+
46
+ ```ruby
47
+ count = font.glyph_count
48
+ ```
49
+
50
+ ## See Also
51
+
52
+ - [FontLoader](/api/font-loader)
53
+ - [Type1Font](/api/type1-font)
@@ -0,0 +1,43 @@
1
+ ---
2
+ title: Type1Font
3
+ ---
4
+
5
+ # Type1Font
6
+
7
+ Adobe Type 1 font handler.
8
+
9
+ ## Overview
10
+
11
+ `Fontisan::Type1Font` handles Adobe Type 1 fonts (PFB/PFA).
12
+
13
+ ## Properties
14
+
15
+ | Property | Type | Description |
16
+ |----------|------|-------------|
17
+ | `font_name` | String | Font name |
18
+ | `family_name` | String | Family name |
19
+ | `charstrings` | Hash | Glyph outlines |
20
+ | `private_dict` | Hash | Private dictionary |
21
+
22
+ ## Methods
23
+
24
+ ### glyph_count
25
+
26
+ Get total glyph count.
27
+
28
+ ```ruby
29
+ count = font.glyph_count
30
+ ```
31
+
32
+ ### charstring(glyph_name)
33
+
34
+ Get CharString for a glyph.
35
+
36
+ ```ruby
37
+ cs = font.charstring('A')
38
+ ```
39
+
40
+ ## See Also
41
+
42
+ - [FontLoader](/api/font-loader)
43
+ - [SfntFont](/api/sfnt-font)
@@ -0,0 +1,31 @@
1
+ ---
2
+ title: FontValidator
3
+ ---
4
+
5
+ # FontValidator
6
+
7
+ Main validation entry point.
8
+
9
+ ## Overview
10
+
11
+ `Fontisan::Validators::FontValidator` validates fonts against profiles.
12
+
13
+ ## Class Methods
14
+
15
+ ### validate(path, profile: :production)
16
+
17
+ Validate a font file.
18
+
19
+ ```ruby
20
+ result = Fontisan::Validators::FontValidator.validate('font.ttf', profile: :web)
21
+ if result.valid?
22
+ puts "Font is valid"
23
+ else
24
+ puts "Errors: #{result.errors.length}"
25
+ end
26
+ ```
27
+
28
+ ## See Also
29
+
30
+ - [Validation Guide](/guide/validation/)
31
+ - [ValidationProfile](/api/validators/profile)
@@ -0,0 +1,36 @@
1
+ ---
2
+ title: ValidationHelper
3
+ ---
4
+
5
+ # ValidationHelper
6
+
7
+ Individual validation helpers.
8
+
9
+ ## Overview
10
+
11
+ Validation helpers perform specific checks.
12
+
13
+ ## Categories
14
+
15
+ | Category | Helpers | Focus |
16
+ |----------|---------|-------|
17
+ | Table | 12 | Table structure |
18
+ | Name | 8 | Name records |
19
+ | Head | 6 | Header validation |
20
+ | Metrics | 10 | Font metrics |
21
+ | Glyph | 8 | Glyph data |
22
+ | CMAP | 6 | Character mapping |
23
+ | Layout | 6 | GSUB/GPOS |
24
+
25
+ ## Using Helpers
26
+
27
+ ```ruby
28
+ validator = Fontisan::Validators::FontValidator.new(font)
29
+ result = validator.check_required_tables
30
+ puts result.valid?
31
+ ```
32
+
33
+ ## See Also
34
+
35
+ - [FontValidator](/api/validators/font-validator)
36
+ - [Validation Helpers Guide](/guide/validation/helpers)
@@ -0,0 +1,39 @@
1
+ ---
2
+ title: ValidationProfile
3
+ ---
4
+
5
+ # ValidationProfile
6
+
7
+ Validation profile definitions.
8
+
9
+ ## Overview
10
+
11
+ `Fontisan::Validators::ValidationProfile` defines validation profiles.
12
+
13
+ ## Built-in Profiles
14
+
15
+ | Profile | Checks | Use Case |
16
+ |---------|--------|----------|
17
+ | `indexability` | 8 | Font discovery |
18
+ | `usability` | 26 | Installation |
19
+ | `production` | 37 | Quality assurance |
20
+ | `web` | 18 | Web deployment |
21
+ | `spec_compliance` | Full | Spec audit |
22
+
23
+ ## Methods
24
+
25
+ ### checks
26
+
27
+ Get list of checks in profile.
28
+
29
+ ```ruby
30
+ profile = Fontisan::Validators::ValidationProfile[:production]
31
+ profile.checks.each do |check|
32
+ puts check.id
33
+ end
34
+ ```
35
+
36
+ ## See Also
37
+
38
+ - [FontValidator](/api/validators/font-validator)
39
+ - [Validation Helpers](/guide/validation/helpers)
@@ -0,0 +1,87 @@
1
+ ---
2
+ title: convert
3
+ ---
4
+
5
+ # convert
6
+
7
+ Convert individual fonts between different formats.
8
+
9
+ ::: tip For Collection Formats
10
+ Use [pack/unpack](/cli/pack) to work with TTC, OTC, and dfont collections. The convert command is for individual font files only.
11
+ :::
12
+
13
+ ## Quick Reference
14
+
15
+ ```bash
16
+ fontisan convert <input> --to <format> [options]
17
+ ```
18
+
19
+ ## Supported Formats
20
+
21
+ These are individual font formats that can be converted:
22
+
23
+ | Format | Read | Write | Description |
24
+ |--------|:----:|:-----:|-------------|
25
+ | TTF | ✅ | ✅ | TrueType (glyf outlines) |
26
+ | OTF | ✅ | ✅ | OpenType (CFF outlines) |
27
+ | WOFF | ✅ | ✅ | Web Open Font Format |
28
+ | WOFF2 | ✅ | ✅ | Web Open Font Format 2 |
29
+ | PFB/PFA | ✅ | — | Adobe Type 1 (read for conversion) |
30
+
31
+ ## Options
32
+
33
+ | Option | Description |
34
+ |--------|-------------|
35
+ | `--to FORMAT` | Target format (ttf, otf, woff, woff2) |
36
+ | `--output FILE` | Output file path |
37
+ | `--optimize` | Enable outline optimization |
38
+ | `--flatten` | Flatten composite glyphs |
39
+
40
+ ## Common Workflows
41
+
42
+ ### Convert for Web
43
+
44
+ ```bash
45
+ # TTF to WOFF2 (recommended for modern browsers)
46
+ fontisan convert font.ttf --to woff2 --output font.woff2
47
+
48
+ # OTF to WOFF (broader compatibility)
49
+ fontisan convert font.otf --to woff --output font.woff
50
+ ```
51
+
52
+ ### Convert Between Outline Formats
53
+
54
+ ```bash
55
+ # TrueType to OpenType (glyf → CFF)
56
+ fontisan convert font.ttf --to otf --output font.otf
57
+
58
+ # OpenType to TrueType (CFF → glyf)
59
+ fontisan convert font.otf --to ttf --output font.ttf
60
+ ```
61
+
62
+ ### Convert Legacy Type 1 Fonts
63
+
64
+ ```bash
65
+ # Type 1 to OpenType
66
+ fontisan convert font.pfb --to otf --output font.otf
67
+ ```
68
+
69
+ ## Working with Collections
70
+
71
+ Collection formats (TTC, OTC, dfont) contain multiple fonts. To convert fonts from a collection:
72
+
73
+ ```bash
74
+ # Step 1: Extract fonts from collection
75
+ fontisan unpack family.ttc --output-dir ./extracted
76
+
77
+ # Step 2: Convert each font
78
+ fontisan convert ./extracted/Font-Regular.ttf --to woff2 --output Font-Regular.woff2
79
+ fontisan convert ./extracted/Font-Bold.ttf --to woff2 --output Font-Bold.woff2
80
+
81
+ # Or extract and convert in one step:
82
+ fontisan unpack family.ttc --output-dir ./web --format woff2
83
+ ```
84
+
85
+ ## Detailed Documentation
86
+
87
+ For comprehensive documentation including curve conversion, hint handling, and advanced options, see the [convert command guide](/guide/cli/convert).