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,110 @@
1
+ ---
2
+ title: dump-table
3
+ ---
4
+
5
+ # dump-table
6
+
7
+ Extract raw table data from a font.
8
+
9
+ ## Quick Reference
10
+
11
+ ```bash
12
+ fontisan dump-table <font> <table-tag> [options]
13
+ ```
14
+
15
+ ## Options
16
+
17
+ | Option | Description |
18
+ |--------|-------------|
19
+ | `--output FILE` | Output file (default: stdout) |
20
+ | `--hex` | Output as hexadecimal |
21
+ | `--json` | Parse and output as JSON |
22
+
23
+ ## Output
24
+
25
+ Outputs raw binary table data, or parsed data if `--json` is specified.
26
+
27
+ ## Examples
28
+
29
+ ### Raw Binary Output
30
+
31
+ ```bash
32
+ # Dump head table to file
33
+ fontisan dump-table font.ttf head --output head.bin
34
+
35
+ # Dump cmap table
36
+ fontisan dump-table font.ttf cmap --output cmap.bin
37
+ ```
38
+
39
+ ### Hexadecimal Output
40
+
41
+ ```bash
42
+ # View as hex
43
+ fontisan dump-table font.ttf head --hex
44
+ ```
45
+
46
+ ### Parsed JSON Output
47
+
48
+ ```bash
49
+ # Get parsed table data
50
+ fontisan dump-table font.ttf head --json
51
+
52
+ # Extract specific values
53
+ fontisan dump-table font.ttf head --json | jq '.unitsPerEm'
54
+ ```
55
+
56
+ ## Common Tables to Dump
57
+
58
+ | Table | Contains |
59
+ |-------|----------|
60
+ | `head` | Font header, units per em, bbox |
61
+ | `name` | All naming strings |
62
+ | `cmap` | Character to glyph mapping |
63
+ | `glyf` | Glyph outlines (TrueType) |
64
+ | `CFF ` | Compact font format data |
65
+ | `maxp` | Maximum profile |
66
+ | `hhea` | Horizontal header |
67
+ | `OS/2` | OS/2 metrics |
68
+ | `post` | PostScript names |
69
+ | `GPOS` | Glyph positioning |
70
+ | `GSUB` | Glyph substitution |
71
+ | `fvar` | Variation axes |
72
+ | `STAT` | Style attributes |
73
+
74
+ ## Use Cases
75
+
76
+ ### Debug Font Issues
77
+
78
+ ```bash
79
+ # Check head table values
80
+ fontisan dump-table font.ttf head --json
81
+ ```
82
+
83
+ ### Extract Naming Data
84
+
85
+ ```bash
86
+ # Get all name strings
87
+ fontisan dump-table font.ttf name --json > names.json
88
+ ```
89
+
90
+ ### Compare Tables Between Fonts
91
+
92
+ ```bash
93
+ # Compare head tables
94
+ diff <(fontisan dump-table font1.ttf head --hex) \
95
+ <(fontisan dump-table font2.ttf head --hex)
96
+ ```
97
+
98
+ ### Backup Table Data
99
+
100
+ ```bash
101
+ # Backup critical tables
102
+ fontisan dump-table font.ttf head --output backup/head.bin
103
+ fontisan dump-table font.ttf name --output backup/name.bin
104
+ fontisan dump-table font.ttf cmap --output backup/cmap.bin
105
+ ```
106
+
107
+ ## Related Commands
108
+
109
+ - [tables](/cli/tables) — List all tables
110
+ - [export](/cli/export) — Export to TTX, SVG, etc.
@@ -0,0 +1,176 @@
1
+ ---
2
+ title: export
3
+ ---
4
+
5
+ # export
6
+
7
+ Export font data to various formats for analysis, debugging, or conversion.
8
+
9
+ ## Quick Reference
10
+
11
+ ```bash
12
+ fontisan export <font> --format <format> [options]
13
+ ```
14
+
15
+ ## Export Formats
16
+
17
+ | Format | Description | Use Case |
18
+ |--------|-------------|----------|
19
+ | `ttx` | XML-based TTX format | Debugging, inspection |
20
+ | `svg` | SVG font | Web graphics |
21
+ | `json` | JSON representation | Data processing |
22
+ | `yaml` | YAML representation | Human-readable output |
23
+
24
+ ## Options
25
+
26
+ | Option | Description |
27
+ |--------|-------------|
28
+ | `--format FORMAT` | Export format (ttx, svg, json, yaml) |
29
+ | `--output FILE` | Output file path |
30
+ | `--tables LIST` | Export specific tables only (comma-separated) |
31
+ | `--pretty` | Pretty-print output (JSON, YAML) |
32
+ | `--glyphs` | Include glyph outlines (SVG) |
33
+
34
+ ## Examples
35
+
36
+ ### Export to TTX
37
+
38
+ TTX is an XML representation of font tables, useful for debugging and inspection.
39
+
40
+ ```bash
41
+ # Export entire font
42
+ fontisan export font.ttf --format ttx --output font.ttx
43
+
44
+ # Export specific tables
45
+ fontisan export font.ttf --format ttx --tables head,name,cmap --output partial.ttx
46
+
47
+ # Export single table
48
+ fontisan export font.ttf --format ttx --tables glyf --output glyf.ttx
49
+ ```
50
+
51
+ ### Export to SVG
52
+
53
+ ```bash
54
+ # Export as SVG font
55
+ fontisan export font.ttf --format svg --output font.svg
56
+
57
+ # Include all glyphs
58
+ fontisan export font.ttf --format svg --glyphs --output font-glyphs.svg
59
+ ```
60
+
61
+ ### Export to JSON/YAML
62
+
63
+ ```bash
64
+ # JSON output
65
+ fontisan export font.ttf --format json --output font.json
66
+
67
+ # Pretty-printed JSON
68
+ fontisan export font.ttf --format json --pretty --output font-pretty.json
69
+
70
+ # YAML output
71
+ fontisan export font.ttf --format yaml --output font.yaml
72
+ ```
73
+
74
+ ## TTX Format
75
+
76
+ TTX is Adobe's XML format for font tables. It's human-readable and diffable.
77
+
78
+ ### Sample TTX Output
79
+
80
+ ```xml
81
+ <?xml version="1.0" encoding="UTF-8"?>
82
+ <ttFont sfntVersion="OTTO" ttLibVersion="4.0">
83
+ <head>
84
+ <tableVersion value="1.0"/>
85
+ <fontRevision value="3.046"/>
86
+ <checkSumAdjustment value="0"/>
87
+ <unitsPerEm value="1000"/>
88
+ ...
89
+ </head>
90
+ <name>
91
+ <namerecord nameID="1" platformID="3" platEncID="1" langID="0x409">
92
+ Source Sans 3
93
+ </namerecord>
94
+ ...
95
+ </name>
96
+ </ttFont>
97
+ ```
98
+
99
+ ## SVG Font Format
100
+
101
+ SVG fonts define glyphs as SVG paths, usable in web contexts.
102
+
103
+ ### Sample SVG Output
104
+
105
+ ```xml
106
+ <?xml version="1.0" encoding="UTF-8"?>
107
+ <svg xmlns="http://www.w3.org/2000/svg">
108
+ <font id="MyFont" horiz-adv-x="500">
109
+ <font-face font-family="My Font" units-per-em="1000"/>
110
+ <glyph unicode="A" d="M100 0 L200 700 L300 0 Z"/>
111
+ ...
112
+ </font>
113
+ </svg>
114
+ ```
115
+
116
+ ## JSON/YAML Output
117
+
118
+ Structured output for programmatic access.
119
+
120
+ ### Sample JSON Output
121
+
122
+ ```json
123
+ {
124
+ "format": "OpenType",
125
+ "family": "Source Sans 3",
126
+ "style": "Regular",
127
+ "version": "3.046",
128
+ "glyphs": 1024,
129
+ "tables": {
130
+ "head": { "unitsPerEm": 1000, ... },
131
+ "name": { "records": [...] },
132
+ ...
133
+ }
134
+ }
135
+ ```
136
+
137
+ ## Use Cases
138
+
139
+ ### Debug Font Issues
140
+
141
+ ```bash
142
+ # Export and search for issues
143
+ fontisan export font.ttf --format ttx --output debug.ttx
144
+ grep -i "error\|warning" debug.ttx
145
+ ```
146
+
147
+ ### Compare Fonts
148
+
149
+ ```bash
150
+ # Export both fonts
151
+ fontisan export font1.ttf --format ttx --output font1.ttx
152
+ fontisan export font2.ttf --format ttx --output font2.ttx
153
+
154
+ # Compare
155
+ diff font1.ttx font2.ttx
156
+ ```
157
+
158
+ ### Extract Font Data
159
+
160
+ ```bash
161
+ # Get font metadata as JSON
162
+ fontisan export font.ttf --format json | jq '.family, .style, .version'
163
+ ```
164
+
165
+ ### Create SVG Glyphs
166
+
167
+ ```bash
168
+ # Export individual glyphs for web use
169
+ fontisan export font.ttf --format svg --glyphs --output glyphs.svg
170
+ ```
171
+
172
+ ## Related Commands
173
+
174
+ - [tables](/cli/tables) — List font tables
175
+ - [dump-table](/cli/dump-table) — Extract raw table data
176
+ - [convert](/cli/convert) — Convert font formats
@@ -0,0 +1,124 @@
1
+ ---
2
+ title: features
3
+ ---
4
+
5
+ # features
6
+
7
+ List OpenType features in a font.
8
+
9
+ ## Quick Reference
10
+
11
+ ```bash
12
+ fontisan features <font> [options]
13
+ ```
14
+
15
+ ## Options
16
+
17
+ | Option | Description |
18
+ |--------|-------------|
19
+ | `--format FORMAT` | Output format (text, yaml, json) |
20
+ | `--script TAG` | Filter by script |
21
+ | `--language TAG` | Filter by language |
22
+ | `--detail` | Show feature details |
23
+
24
+ ## Output
25
+
26
+ Shows:
27
+ - Feature tags
28
+ - Feature names/descriptions
29
+ - Scripts that use each feature
30
+ - Lookup count
31
+
32
+ ## Examples
33
+
34
+ ```bash
35
+ # List all features
36
+ fontisan features font.ttf
37
+
38
+ # Features for specific script
39
+ fontisan features font.ttf --script latn
40
+
41
+ # With details
42
+ fontisan features font.ttf --detail
43
+
44
+ # JSON output
45
+ fontisan features font.ttf --format json
46
+ ```
47
+
48
+ ## Sample Output
49
+
50
+ ```
51
+ OpenType Features
52
+ =================
53
+
54
+ Tag Name Scripts Lookups
55
+ ------ ---------------------- --------- -------
56
+ liga Standard Ligatures latn,cyrl 12
57
+ dlig Discretionary Ligatures latn 4
58
+ kern Kerning all 156
59
+ mark Mark Positioning all 48
60
+ mkmk Mark to Mark all 24
61
+ onum Oldstyle Figures latn 1
62
+ pnum Proportional Figures latn 1
63
+ tnum Tabular Figures latn 1
64
+ zero Slashed Zero latn 1
65
+
66
+ Total: 9 features
67
+ ```
68
+
69
+ ## Common Feature Tags
70
+
71
+ ### GSUB (Substitution) Features
72
+
73
+ | Tag | Name | Description |
74
+ |-----|------|-------------|
75
+ | `liga` | Standard Ligatures | fi, fl, etc. |
76
+ | `dlig` | Discretionary Ligatures | Optional ligatures |
77
+ | `hlig` | Historical Ligatures | Archaic forms |
78
+ | `calt` | Contextual Alternates | Context-based |
79
+ | `salt` | Stylistic Alternates | Alternate glyphs |
80
+ | `ss01`-`ss20` | Stylistic Sets | Grouped alternates |
81
+ | `smcp` | Small Capitals | Lowercase to small caps |
82
+ | `c2sc` | Caps to Small Caps | Uppercase to small caps |
83
+ | `onum` | Oldstyle Figures | Varying height |
84
+ | `lnum` | Lining Figures | Uniform height |
85
+ | `pnum` | Proportional Figures | Varying width |
86
+ | `tnum` | Tabular Figures | Uniform width |
87
+ | `zero` | Slashed Zero | Distinguish 0/O |
88
+ | `case` | Case-Sensitive Forms | Uppercase adjustment |
89
+
90
+ ### GPOS (Positioning) Features
91
+
92
+ | Tag | Name | Description |
93
+ |-----|------|-------------|
94
+ | `kern` | Kerning | Pair adjustments |
95
+ | `mark` | Mark Positioning | Diacritics |
96
+ | `mkmk` | Mark to Mark | Stacked diacritics |
97
+ | `dist` | Distances | Spacing |
98
+ | `abvm` | Above Marks | Positioning above |
99
+ | `blwm` | Below Marks | Positioning below |
100
+
101
+ ## Use Cases
102
+
103
+ ### Check for Ligatures
104
+
105
+ ```bash
106
+ fontisan features font.ttf | grep liga
107
+ ```
108
+
109
+ ### Check for Small Caps
110
+
111
+ ```bash
112
+ fontisan features font.ttf | grep -E "smcp|c2sc"
113
+ ```
114
+
115
+ ### Compare Feature Sets
116
+
117
+ ```bash
118
+ diff <(fontisan features font1.ttf) <(fontisan features font2.ttf)
119
+ ```
120
+
121
+ ## Related Commands
122
+
123
+ - [scripts](/cli/scripts) — List supported scripts
124
+ - [info](/cli/info) — Get comprehensive font info
@@ -0,0 +1,90 @@
1
+ ---
2
+ title: glyphs
3
+ ---
4
+
5
+ # glyphs
6
+
7
+ List and inspect glyphs in a font.
8
+
9
+ ## Quick Reference
10
+
11
+ ```bash
12
+ fontisan glyphs <font> [options]
13
+ ```
14
+
15
+ ## Options
16
+
17
+ | Option | Description |
18
+ |--------|-------------|
19
+ | `--format FORMAT` | Output format (text, yaml, json) |
20
+ | `--with-unicode` | Include Unicode codepoints |
21
+ | `--with-bbox` | Include bounding boxes |
22
+ | `--filter PATTERN` | Filter by glyph name pattern |
23
+
24
+ ## Output
25
+
26
+ Lists all glyphs with:
27
+ - Glyph ID (GID)
28
+ - Glyph name
29
+ - Unicode codepoint (if mapped)
30
+ - Bounding box (optional)
31
+
32
+ ## Examples
33
+
34
+ ```bash
35
+ # List all glyphs
36
+ fontisan glyphs font.ttf
37
+
38
+ # With Unicode codepoints
39
+ fontisan glyphs font.ttf --with-unicode
40
+
41
+ # With bounding boxes
42
+ fontisan glyphs font.ttf --with-bbox
43
+
44
+ # Filter by name pattern
45
+ fontisan glyphs font.ttf --filter "uni*"
46
+
47
+ # JSON output for processing
48
+ fontisan glyphs font.ttf --format json > glyphs.json
49
+ ```
50
+
51
+ ## Sample Output
52
+
53
+ ```
54
+ GID Name Unicode Bounding Box
55
+ ---- ---------------- --------- ---------------
56
+ 0 .notdef - (0, 0, 500, 700)
57
+ 1 space U+0020 (0, 0, 0, 0)
58
+ 2 exclam U+0021 (100, 0, 200, 700)
59
+ 3 quotedbl U+0022 (80, 450, 420, 700)
60
+ 4 numbersign U+0023 (30, 0, 470, 700)
61
+ ...
62
+ ```
63
+
64
+ ## Use Cases
65
+
66
+ ### Count Glyphs
67
+
68
+ ```bash
69
+ fontisan glyphs font.ttf | wc -l
70
+ ```
71
+
72
+ ### Find Specific Glyphs
73
+
74
+ ```bash
75
+ # Find ligatures
76
+ fontisan glyphs font.ttf | grep "_"
77
+
78
+ # Find small caps
79
+ fontisan glyphs font.ttf | grep "\.sc"
80
+ ```
81
+
82
+ ### Export Glyph List
83
+
84
+ ```bash
85
+ fontisan glyphs font.ttf --format json --with-unicode > glyph-map.json
86
+ ```
87
+
88
+ ## Detailed Documentation
89
+
90
+ For glyph access via the Ruby API, see the [GlyphAccessor API](/api/models/glyph-accessor).
data/docs/cli/index.md ADDED
@@ -0,0 +1,208 @@
1
+ ---
2
+ title: CLI Reference
3
+ ---
4
+
5
+ # CLI Reference
6
+
7
+ Fontisan provides a comprehensive command-line interface for font processing tasks.
8
+
9
+ ::: warning Font License Considerations
10
+ Commercial fonts often come with restrictive licenses that may prohibit:
11
+
12
+ - **Subsetting** — Reducing the character set
13
+ - **Format conversion** — Converting between TTF, OTF, WOFF, etc.
14
+ - **Variable font instancing** — Generating static instances
15
+ - **Glyph modification** — Altering or extracting individual glyphs
16
+ - **Redistribution** — Sharing converted or modified fonts
17
+
18
+ Always check your font's End User License Agreement (EULA) before processing. Many foundries require additional licenses for web embedding, subsetting, or format conversion. Fontisan provides the tools — you are responsible for ensuring you have the rights to use them.
19
+ :::
20
+
21
+ ## Quick Reference
22
+
23
+ ### Font Information Commands
24
+
25
+ | Command | Description | Example |
26
+ |---------|-------------|---------|
27
+ | `info` | Get comprehensive font information | `fontisan info font.ttf` |
28
+ | `ls` | List fonts in a collection | `fontisan ls fonts.ttc` |
29
+ | `tables` | Show font table information | `fontisan tables font.ttf` |
30
+ | `glyphs` | List glyphs with names and IDs | `fontisan glyphs font.ttf` |
31
+ | `unicode` | Show Unicode coverage | `fontisan unicode font.ttf` |
32
+ | `scripts` | List supported scripts | `fontisan scripts font.ttf` |
33
+ | `features` | List OpenType features | `fontisan features font.ttf` |
34
+ | `variable` | Show variable font axes | `fontisan variable font.ttf` |
35
+ | `optical-size` | Show optical size info | `fontisan optical-size font.ttf` |
36
+
37
+ ### Font Operations
38
+
39
+ | Command | Description | Example |
40
+ |---------|-------------|---------|
41
+ | `convert` | Convert between formats | `fontisan convert input.ttf --to otf` |
42
+ | `subset` | Subset fonts | `fontisan subset font.ttf --chars "ABC"` |
43
+ | `validate` | Validate fonts | `fontisan validate font.ttf` |
44
+ | `instance` | Generate variable font instances | `fontisan instance var.ttf --wght 700` |
45
+ | `dump-table` | Extract raw table data | `fontisan dump-table font.ttf head` |
46
+
47
+ ### Collection Operations
48
+
49
+ | Command | Description | Example |
50
+ |---------|-------------|---------|
51
+ | `pack` | Create font collections | `fontisan pack *.ttf -o fonts.ttc` |
52
+ | `unpack` | Extract from collections | `fontisan unpack fonts.ttc -d ./out` |
53
+
54
+ ### Export Operations
55
+
56
+ | Command | Description | Example |
57
+ |---------|-------------|---------|
58
+ | `export` | Export to TTX, SVG, JSON | `fontisan export font.ttf --format ttx` |
59
+
60
+ ## Global Options
61
+
62
+ ```bash
63
+ fontisan [options] <command>
64
+
65
+ Options:
66
+ --format FORMAT Output format (text, yaml, json)
67
+ --verbose Verbose output
68
+ --quiet Suppress non-error output
69
+ --help Show help
70
+ --version Show version
71
+ ```
72
+
73
+ ## Getting Help
74
+
75
+ ```bash
76
+ # General help
77
+ fontisan --help
78
+
79
+ # Command-specific help
80
+ fontisan convert --help
81
+ fontisan validate --help
82
+ fontisan instance --help
83
+ ```
84
+
85
+ ## Output Formats
86
+
87
+ Most commands support multiple output formats:
88
+
89
+ ```bash
90
+ # Text (default)
91
+ fontisan info font.ttf
92
+
93
+ # YAML
94
+ fontisan info font.ttf --format yaml
95
+
96
+ # JSON
97
+ fontisan info font.ttf --format json
98
+ ```
99
+
100
+ ## Common Workflows
101
+
102
+ ### Inspect a Font
103
+
104
+ ```bash
105
+ # Basic information
106
+ fontisan info font.ttf
107
+
108
+ # Detailed table listing
109
+ fontisan tables font.ttf
110
+
111
+ # See all glyphs
112
+ fontisan glyphs font.ttf
113
+
114
+ # Check Unicode coverage
115
+ fontisan unicode font.ttf
116
+ ```
117
+
118
+ ### Convert for Web
119
+
120
+ ```bash
121
+ # Convert single font to WOFF2
122
+ fontisan convert font.ttf --to woff2 --output font.woff2
123
+ ```
124
+
125
+ ### Work with Variable Fonts
126
+
127
+ ```bash
128
+ # Inspect variable font axes
129
+ fontisan variable VariableFont.ttf
130
+
131
+ # Generate a specific instance
132
+ fontisan instance VariableFont.ttf --wght 700 --output Bold.ttf
133
+
134
+ # Generate multiple instances
135
+ fontisan instance VariableFont.ttf --wght 400 --output Regular.ttf
136
+ fontisan instance VariableFont.ttf --wght 700 --output Bold.ttf
137
+ ```
138
+
139
+ ### Work with Collections
140
+
141
+ ```bash
142
+ # List fonts in collection
143
+ fontisan ls fonts.ttc
144
+
145
+ # Extract all fonts
146
+ fontisan unpack fonts.ttc --output-dir ./extracted
147
+
148
+ # Extract and convert to web formats
149
+ fontisan unpack fonts.ttc --output-dir ./web --format woff2
150
+
151
+ # Create a collection
152
+ fontisan pack Regular.ttf Bold.ttf --output Family.ttc
153
+ ```
154
+
155
+ ### Validate Fonts
156
+
157
+ ```bash
158
+ # Quick validation
159
+ fontisan validate font.ttf
160
+
161
+ # Validate for Google Fonts
162
+ fontisan validate font.ttf --profile google_fonts
163
+
164
+ # Strict validation
165
+ fontisan validate font.ttf --profile production
166
+ ```
167
+
168
+ ### Export Font Data
169
+
170
+ ```bash
171
+ # Export to TTX (XML format)
172
+ fontisan export font.ttf --format ttx --output font.ttx
173
+
174
+ # Export to JSON
175
+ fontisan export font.ttf --format json --output font.json
176
+
177
+ # Export specific tables
178
+ fontisan export font.ttf --format ttx --tables head,name,cmap
179
+ ```
180
+
181
+ ## Command Documentation
182
+
183
+ Detailed documentation for each command:
184
+
185
+ ### Font Information
186
+ - [info](/cli/info) — Extract font metadata and properties (includes brief mode)
187
+ - [ls](/cli/ls) — List fonts in collections
188
+ - [tables](/cli/tables) — Show OpenType table directory
189
+ - [glyphs](/cli/glyphs) — List glyph names and indices
190
+ - [unicode](/cli/unicode) — Show Unicode character mappings
191
+ - [scripts](/cli/scripts) — List supported writing scripts
192
+ - [features](/cli/features) — List OpenType layout features
193
+ - [variable](/cli/variable) — Show variable font axes and instances
194
+ - [optical-size](/cli/optical-size) — Display optical size information
195
+
196
+ ### Font Operations
197
+ - [convert](/cli/convert) — Format conversion (TTF, OTF, WOFF, WOFF2)
198
+ - [subset](/cli/subset) — Create character subsets
199
+ - [validate](/cli/validate) — Validate fonts against profiles
200
+ - [instance](/cli/instance) — Generate static instances from variable fonts
201
+ - [export](/cli/export) — Export to TTX, YAML, JSON
202
+ - [dump-table](/cli/dump-table) — Extract raw binary table data
203
+
204
+ ### Collection Operations
205
+ - [pack](/cli/pack) — Create and extract font collections (TTC/OTC)
206
+
207
+ ### Utilities
208
+ - [version](/cli/version) — Show Fontisan version