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/cli/info.md ADDED
@@ -0,0 +1,254 @@
1
+ ---
2
+ title: info
3
+ ---
4
+
5
+ # info
6
+
7
+ Get comprehensive font information.
8
+
9
+ ## Quick Reference
10
+
11
+ ```bash
12
+ fontisan info <font> [options]
13
+ ```
14
+
15
+ ## Options
16
+
17
+ | Option | Description |
18
+ |--------|-------------|
19
+ | `--format FORMAT` | Output format (text, yaml, json) |
20
+ | `--brief` | Fast mode - essential metadata only (5x faster) |
21
+ | `--verbose` | Show all available information |
22
+ | `--tables` | Include table listing |
23
+ | `--features` | Include OpenType features |
24
+
25
+ ## Brief Mode
26
+
27
+ For font indexing systems that need to scan thousands of fonts quickly, use the `--brief` flag to get essential metadata only.
28
+
29
+ ### Performance Benefits
30
+
31
+ - **5x faster** than full mode by using metadata-only loading
32
+ - **Loads only 6 tables** instead of 15-20 (name, head, hhea, maxp, OS/2, post)
33
+ - **Lower memory usage** through reduced table loading
34
+ - **Optimized for batch processing** of many fonts
35
+
36
+ ### Brief Mode Attributes
37
+
38
+ Brief mode populates only the following 13 essential attributes:
39
+
40
+ **Font Identification:**
41
+ - `font_format` - Font format (truetype, cff)
42
+ - `is_variable` - Whether font is variable
43
+
44
+ **Essential Names:**
45
+ - `family_name` - Font family name
46
+ - `subfamily_name` - Font subfamily/style
47
+ - `full_name` - Full font name
48
+ - `postscript_name` - PostScript name
49
+
50
+ **Version Info:**
51
+ - `version` - Version string
52
+
53
+ **Metrics:**
54
+ - `font_revision` - Font revision number
55
+ - `units_per_em` - Units per em
56
+
57
+ **Vendor:**
58
+ - `vendor_id` - Vendor/foundry ID
59
+
60
+ ### Brief Mode Examples
61
+
62
+ ```bash
63
+ # Fast font indexing
64
+ fontisan info font.ttf --brief
65
+
66
+ # Brief mode with JSON output
67
+ fontisan info font.ttf --brief --format json
68
+
69
+ # Process many fonts quickly
70
+ for font in *.ttf; do
71
+ fontisan info "$font" --brief --format json >> fonts.jsonl
72
+ done
73
+ ```
74
+
75
+ ### Brief Mode Sample Output
76
+
77
+ ```
78
+ Font type: TrueType (Variable)
79
+ Family: Mona Sans ExtraLight
80
+ Subfamily: Regular
81
+ Full name: Mona Sans ExtraLight
82
+ PostScript name: MonaSans-ExtraLight
83
+ Version: Version 2.001
84
+ Vendor ID: GTHB
85
+ Font revision: 2.00101
86
+ Units per em: 1000
87
+ ```
88
+
89
+ ### Brief Mode JSON Output
90
+
91
+ ```json
92
+ {
93
+ "font_format": "truetype",
94
+ "is_variable": true,
95
+ "family_name": "Mona Sans ExtraLight",
96
+ "subfamily_name": "Regular",
97
+ "full_name": "Mona Sans ExtraLight",
98
+ "postscript_name": "MonaSans-ExtraLight",
99
+ "version": "Version 2.001",
100
+ "font_revision": 2.00101,
101
+ "vendor_id": "GTHB",
102
+ "units_per_em": 1000
103
+ }
104
+ ```
105
+
106
+ ## Full Mode
107
+
108
+ Full mode populates additional attributes (remain `nil` in brief mode):
109
+
110
+ - `postscript_cid_name`, `preferred_family`, `preferred_subfamily`, `mac_font_menu_name`
111
+ - `unique_id`, `description`, `designer`, `designer_url`
112
+ - `manufacturer`, `vendor_url`, `trademark`, `copyright`
113
+ - `license_description`, `license_url`, `sample_text`, `permissions`
114
+
115
+ ## Output
116
+
117
+ Shows comprehensive font metadata:
118
+ - Family and style names
119
+ - Version and copyright
120
+ - PostScript name
121
+ - Format (TrueType, OpenType, etc.)
122
+ - Glyph count
123
+ - Table count
124
+ - Unicode ranges
125
+ - Variable font axes (if applicable)
126
+
127
+ ## Examples
128
+
129
+ ```bash
130
+ # Basic info
131
+ fontisan info font.ttf
132
+
133
+ # Brief mode for fast indexing
134
+ fontisan info font.ttf --brief
135
+
136
+ # Verbose output
137
+ fontisan info font.ttf --verbose
138
+
139
+ # Include tables
140
+ fontisan info font.ttf --tables
141
+
142
+ # JSON output
143
+ fontisan info font.ttf --format json
144
+ ```
145
+
146
+ ## Sample Output
147
+
148
+ ```
149
+ Font: SourceSans3-Regular.otf
150
+ Format: OpenType (CFF)
151
+ Family: Source Sans 3
152
+ Style: Regular
153
+ PostScript: SourceSans3-Regular
154
+ Version: 3.046
155
+ Copyright: Copyright 2023 Adobe
156
+
157
+ Glyphs: 1,024
158
+ Tables: 18
159
+ Characters: 892
160
+
161
+ Unicode Ranges:
162
+ Basic Latin (95)
163
+ Latin-1 Supplement (96)
164
+ Latin Extended-A (128)
165
+ Greek and Coptic (72)
166
+
167
+ Features: 24
168
+ liga, dlig, kern, mark, mkmk, ...
169
+ ```
170
+
171
+ ## Use Cases
172
+
173
+ ### Get Family Name
174
+
175
+ ```bash
176
+ fontisan info font.ttf --format json | jq '.family_name'
177
+ ```
178
+
179
+ ### Check Font Format
180
+
181
+ ```bash
182
+ fontisan info font.ttf --format json | jq '.format'
183
+ ```
184
+
185
+ ### Compare Fonts
186
+
187
+ ```bash
188
+ diff <(fontisan info font1.ttf) <(fontisan info font2.ttf)
189
+ ```
190
+
191
+ ### Batch Process Fonts (Fast)
192
+
193
+ ```bash
194
+ # Use brief mode for fast batch processing
195
+ for font in *.ttf; do
196
+ echo "=== $font ==="
197
+ fontisan info "$font" --brief
198
+ done
199
+ ```
200
+
201
+ ### Build Font Index
202
+
203
+ ```bash
204
+ # Create JSON index of all fonts
205
+ echo '[' > fonts.json
206
+ first=true
207
+ for font in **/*.ttf; do
208
+ if $first; then first=false; else echo ',' >> fonts.json; fi
209
+ fontisan info "$font" --brief --format json >> fonts.json
210
+ done
211
+ echo ']' >> fonts.json
212
+ ```
213
+
214
+ ## Ruby API
215
+
216
+ ### Brief Mode
217
+
218
+ ```ruby
219
+ require 'fontisan'
220
+
221
+ # Fast metadata-only loading
222
+ info = Fontisan.info("font.ttf", brief: true)
223
+
224
+ # Access populated fields
225
+ puts info.family_name # "Open Sans"
226
+ puts info.postscript_name # "OpenSans-Regular"
227
+ puts info.is_variable # false
228
+
229
+ # Non-essential fields are nil
230
+ puts info.copyright # nil (not populated)
231
+ puts info.designer # nil (not populated)
232
+
233
+ # Serialize to YAML/JSON
234
+ puts info.to_yaml
235
+ puts info.to_json
236
+ ```
237
+
238
+ ### Brief Mode for Collections
239
+
240
+ ```ruby
241
+ require 'fontisan'
242
+
243
+ # Specify font index for TTC/OTC files
244
+ info = Fontisan.info("/path/to/fonts.ttc", brief: true, font_index: 0)
245
+ puts info.family_name
246
+ ```
247
+
248
+ ## Related Commands
249
+
250
+ - [tables](/cli/tables) — Detailed table information
251
+ - [glyphs](/cli/glyphs) — List all glyphs
252
+ - [features](/cli/features) — List OpenType features
253
+ - [variable](/cli/variable) — Variable font details
254
+ - [version](/cli/version) — Show Fontisan version
@@ -0,0 +1,122 @@
1
+ ---
2
+ title: instance
3
+ ---
4
+
5
+ # instance
6
+
7
+ Generate static font instances from variable fonts.
8
+
9
+ ::: warning License Consideration
10
+ Many commercial variable fonts require a special license to generate static instances. Check your font's EULA before using this command.
11
+ :::
12
+
13
+ ## Quick Reference
14
+
15
+ ```bash
16
+ fontisan instance <variable-font> [options]
17
+ ```
18
+
19
+ ## What are Variable Font Instances?
20
+
21
+ Variable fonts contain multiple variations along design axes (weight, width, slant, etc.). The `instance` command extracts a specific variation as a standalone static font.
22
+
23
+ For example, a variable font with a `wght` (weight) axis from 100-900 can generate instances like:
24
+ - Light (wght: 300)
25
+ - Regular (wght: 400)
26
+ - Medium (wght: 500)
27
+ - Bold (wght: 700)
28
+
29
+ ## Options
30
+
31
+ | Option | Description |
32
+ |--------|-------------|
33
+ | `--output FILE` | Output file path |
34
+ | `--wght VALUE` | Weight axis value (e.g., 400, 700) |
35
+ | `--wdth VALUE` | Width axis value |
36
+ | `--slnt VALUE` | Slant axis value |
37
+ | `--ital VALUE` | Italic axis value |
38
+ | `--opsz VALUE` | Optical size axis value |
39
+ | `--named INSTANCE` | Use named instance (e.g., "Bold") |
40
+ | `--format FORMAT` | Output format (ttf, otf, woff, woff2) |
41
+
42
+ ## Examples
43
+
44
+ ### Generate by Axis Values
45
+
46
+ ```bash
47
+ # Generate Regular weight
48
+ fontisan instance VariableFont.ttf --wght 400 --output Regular.ttf
49
+
50
+ # Generate Bold weight
51
+ fontisan instance VariableFont.ttf --wght 700 --output Bold.ttf
52
+
53
+ # Generate with multiple axes
54
+ fontisan instance VariableFont.ttf --wght 500 --wdth 75 --output MediumCondensed.ttf
55
+
56
+ # Generate with optical size
57
+ fontisan instance VariableFont.ttf --wght 400 --opsz 12 --output Text-12pt.ttf
58
+ ```
59
+
60
+ ### Generate by Named Instance
61
+
62
+ ```bash
63
+ # Use a named instance from the font
64
+ fontisan instance VariableFont.ttf --named "Bold" --output Bold.ttf
65
+
66
+ # List available named instances first
67
+ fontisan variable VariableFont.ttf
68
+ ```
69
+
70
+ ### Generate for Web
71
+
72
+ ```bash
73
+ # Generate and convert to WOFF2 in one step
74
+ fontisan instance VariableFont.ttf --wght 400 --format woff2 --output Regular.woff2
75
+ fontisan instance VariableFont.ttf --wght 700 --format woff2 --output Bold.woff2
76
+ ```
77
+
78
+ ### Batch Generation
79
+
80
+ ```bash
81
+ # Generate common weights
82
+ for wght in 300 400 500 600 700; do
83
+ fontisan instance VariableFont.ttf --wght $wght --output Font-$wght.ttf
84
+ done
85
+ ```
86
+
87
+ ## Common Axes
88
+
89
+ | Axis Tag | Name | Typical Range |
90
+ |----------|------|---------------|
91
+ | `wght` | Weight | 1-999 (100-900 common) |
92
+ | `wdth` | Width | 0-200 (% of normal) |
93
+ | `slnt` | Slant | -90 to +90 (degrees) |
94
+ | `ital` | Italic | 0-1 |
95
+ | `opsz` | Optical Size | 8-144 (point size) |
96
+ | `GRAD` | Grade | -1 to 1 |
97
+ | `XTRA` | X-height | Various |
98
+ | `XOPQ` | X opaque | Various |
99
+ | `YOPQ` | Y opaque | Various |
100
+
101
+ ## Discovering Axes
102
+
103
+ Use the `variable` command to see what axes a font has:
104
+
105
+ ```bash
106
+ fontisan variable VariableFont.ttf
107
+ ```
108
+
109
+ Output shows:
110
+ - Available axes with their ranges
111
+ - Named instances defined in the font
112
+ - Default values
113
+
114
+ ## Detailed Documentation
115
+
116
+ For comprehensive documentation including:
117
+ - How variable fonts work
118
+ - Instance generation algorithms
119
+ - Handling complex axes
120
+ - Format conversion options
121
+
122
+ See the [Variable Fonts Guide](/guide/variable-fonts/).
data/docs/cli/ls.md ADDED
@@ -0,0 +1,95 @@
1
+ ---
2
+ title: ls
3
+ ---
4
+
5
+ # ls
6
+
7
+ List fonts in a collection.
8
+
9
+ ## Quick Reference
10
+
11
+ ```bash
12
+ fontisan ls <collection> [options]
13
+ ```
14
+
15
+ ## Options
16
+
17
+ | Option | Description |
18
+ |--------|-------------|
19
+ | `--format FORMAT` | Output format (text, yaml, json) |
20
+ | `--verbose` | Show detailed information |
21
+
22
+ ## Supported Collections
23
+
24
+ - TTC (TrueType Collection)
25
+ - OTC (OpenType Collection)
26
+ - dfont (Apple Data Fork Font)
27
+
28
+ ## Examples
29
+
30
+ ```bash
31
+ # List fonts in a TTC
32
+ fontisan ls fonts.ttc
33
+
34
+ # List fonts in a dfont
35
+ fontisan ls fonts.dfont
36
+
37
+ # JSON output
38
+ fontisan ls fonts.ttc --format json
39
+
40
+ # Verbose output
41
+ fontisan ls fonts.ttc --verbose
42
+ ```
43
+
44
+ ## Sample Output
45
+
46
+ ```
47
+ Collection: fonts.ttc
48
+ Fonts: 4
49
+
50
+ 0. Noto Serif CJK JP
51
+ PostScript: NotoSerifCJKJP-Regular
52
+ Format: OpenType
53
+ Glyphs: 65,535
54
+
55
+ 1. Noto Serif CJK KR
56
+ PostScript: NotoSerifCJKKR-Regular
57
+ Format: OpenType
58
+ Glyphs: 65,535
59
+
60
+ 2. Noto Serif CJK SC
61
+ PostScript: NotoSerifCJKSC-Regular
62
+ Format: OpenType
63
+ Glyphs: 65,535
64
+
65
+ 3. Noto Serif CJK TC
66
+ PostScript: NotoSerifCJKTC-Regular
67
+ Format: OpenType
68
+ Glyphs: 65,535
69
+ ```
70
+
71
+ ## Use Cases
72
+
73
+ ### Count Fonts in Collection
74
+
75
+ ```bash
76
+ fontisan ls fonts.ttc | grep -c "PostScript"
77
+ ```
78
+
79
+ ### Get Font Index for Extraction
80
+
81
+ ```bash
82
+ # Find the index of a specific font
83
+ fontisan ls fonts.ttc | grep -n "Bold"
84
+ ```
85
+
86
+ ### Extract Collection Info to JSON
87
+
88
+ ```bash
89
+ fontisan ls fonts.ttc --format json > collection-info.json
90
+ ```
91
+
92
+ ## Related Commands
93
+
94
+ - [pack/unpack](/cli/pack) — Create and extract collections
95
+ - [info](/cli/info) — Get detailed font information
@@ -0,0 +1,94 @@
1
+ ---
2
+ title: optical-size
3
+ ---
4
+
5
+ # optical-size
6
+
7
+ Show optical size information for a font.
8
+
9
+ ## Quick Reference
10
+
11
+ ```bash
12
+ fontisan optical-size <font> [options]
13
+ ```
14
+
15
+ ## Options
16
+
17
+ | Option | Description |
18
+ |--------|-------------|
19
+ | `--format FORMAT` | Output format (text, yaml, json) |
20
+
21
+ ## What is Optical Size?
22
+
23
+ Optical sizing is a typographic technique where glyphs are designed differently for different point sizes. Small sizes need more open shapes and spacing, while large sizes can have more detail and tighter spacing.
24
+
25
+ Variable fonts can use the `opsz` axis for continuous optical sizing, while static fonts may have separate fonts for different size ranges (Caption, Text, Display, etc.).
26
+
27
+ ## Output
28
+
29
+ Shows:
30
+ - Optical size axis (if variable)
31
+ - Size range recommendations
32
+ - Design size metadata
33
+ - Named instances for sizes
34
+
35
+ ## Examples
36
+
37
+ ```bash
38
+ # Show optical size info
39
+ fontisan optical-size font.ttf
40
+
41
+ # JSON output
42
+ fontisan optical-size font.ttf --format json
43
+ ```
44
+
45
+ ## Sample Output
46
+
47
+ ### Variable Font with opsiz Axis
48
+
49
+ ```
50
+ Optical Size: VariableFont.ttf
51
+ ===============================
52
+
53
+ Axis: opsz (Optical Size)
54
+ Range: 8pt - 144pt
55
+ Default: 12pt
56
+
57
+ Size Recommendations:
58
+ Caption (6-8pt): opsz: 8
59
+ Small Text (9-11pt): opsz: 10
60
+ Text (12-14pt): opsz: 12
61
+ Subhead (14-24pt): opsz: 18
62
+ Display (24-72pt): opsz: 48
63
+ Poster (72pt+): opsz: 72
64
+ ```
65
+
66
+ ### Static Font with Size Range
67
+
68
+ ```
69
+ Optical Size: FontText-Regular.ttf
70
+ ==================================
71
+
72
+ Design Size: 12pt (Text)
73
+ Size Range: 11-13pt
74
+ Style: Text
75
+
76
+ Recommended for body text usage.
77
+ ```
78
+
79
+ ## Size Categories
80
+
81
+ | Category | Point Range | Use Case |
82
+ |----------|-------------|----------|
83
+ | Caption | 6-8 | Footnotes, captions |
84
+ | Small Text | 9-11 | Legal text, fine print |
85
+ | Text | 12-14 | Body copy |
86
+ | Subhead | 14-24 | Subheadings |
87
+ | Title | 24-36 | Headings |
88
+ | Display | 36-72 | Large headlines |
89
+ | Poster | 72+ | Very large text |
90
+
91
+ ## Related Commands
92
+
93
+ - [variable](/cli/variable) — Full variable font info
94
+ - [info](/cli/info) — General font information
data/docs/cli/pack.md ADDED
@@ -0,0 +1,125 @@
1
+ ---
2
+ title: pack/unpack
3
+ ---
4
+
5
+ # pack/unpack
6
+
7
+ Work with font collections — TTC, OTC, and dfont formats that contain multiple fonts in a single file.
8
+
9
+ ## What are Font Collections?
10
+
11
+ Font collections bundle multiple related fonts together:
12
+
13
+ | Format | Description | Extension |
14
+ |--------|-------------|-----------|
15
+ | TTC | TrueType Collection | `.ttc` |
16
+ | OTC | OpenType Collection (CFF) | `.otc` or `.ttc` |
17
+ | dfont | Apple Data Fork Font | `.dfont` |
18
+
19
+ Collections save space by sharing common tables (like glyph outlines) across fonts. They're commonly used for font families.
20
+
21
+ ## pack
22
+
23
+ Create a font collection from multiple individual fonts.
24
+
25
+ ```bash
26
+ fontisan pack <fonts...> --output <collection>
27
+ ```
28
+
29
+ ### Options
30
+
31
+ | Option | Description |
32
+ |--------|-------------|
33
+ | `--output FILE` | Output collection file (.ttc or .otc) |
34
+ | `--deduplicate` | Share common tables to reduce size |
35
+ | `--format TYPE` | Collection type (ttc or otc) |
36
+
37
+ ### Examples
38
+
39
+ ```bash
40
+ # Create a collection from a font family
41
+ fontisan pack Regular.ttf Bold.ttf Italic.ttf --output Family.ttc
42
+
43
+ # Create with table deduplication (smaller file)
44
+ fontisan pack *.ttf --output fonts.ttc --deduplicate
45
+
46
+ # Create an OpenType collection (CFF fonts)
47
+ fontisan pack Regular.otf Bold.otf --output fonts.otc
48
+ ```
49
+
50
+ ## unpack
51
+
52
+ Extract individual fonts from a collection.
53
+
54
+ ```bash
55
+ fontisan unpack <collection> [options]
56
+ ```
57
+
58
+ ### Options
59
+
60
+ | Option | Description |
61
+ |--------|-------------|
62
+ | `--output-dir DIR` | Output directory for extracted fonts |
63
+ | `--format FORMAT` | Convert to format (ttf, otf, woff, woff2) |
64
+ | `--index N` | Extract only the font at index N |
65
+ | `--font-index N` | Alias for --index |
66
+
67
+ ### Examples
68
+
69
+ ```bash
70
+ # List and extract all fonts
71
+ fontisan unpack fonts.ttc --output-dir ./extracted
72
+
73
+ # Extract and convert to web formats in one step
74
+ fontisan unpack fonts.ttc --output-dir ./web --format woff2
75
+
76
+ # Extract a specific font by index
77
+ fontisan unpack fonts.ttc --index 0 --output Regular.ttf
78
+
79
+ # Extract from Apple dfont
80
+ fontisan unpack fonts.dfont --output-dir ./extracted
81
+ ```
82
+
83
+ ## Common Workflows
84
+
85
+ ### Extract Collection for Web Use
86
+
87
+ ```bash
88
+ # Extract and convert to WOFF2 in one command
89
+ fontisan unpack family.ttc --output-dir ./web-fonts --format woff2
90
+ ```
91
+
92
+ ### Extract, Modify, and Repack
93
+
94
+ ```bash
95
+ # 1. Extract all fonts
96
+ fontisan unpack family.ttc --output-dir ./working
97
+
98
+ # 2. Modify fonts (e.g., subset, convert)
99
+ fontisan subset ./working/Regular.ttf --chars "ABC..." --output Regular-subset.ttf
100
+
101
+ # 3. Repack into new collection
102
+ fontisan pack *-subset.ttf --output family-subset.ttc --deduplicate
103
+ ```
104
+
105
+ ### Convert Collection Format
106
+
107
+ ```bash
108
+ # Extract from dfont, repack as TTC
109
+ fontisan unpack fonts.dfont --output-dir ./temp
110
+ fontisan pack ./temp/*.ttf --output fonts.ttc
111
+ ```
112
+
113
+ ### View Collection Contents
114
+
115
+ ```bash
116
+ # List fonts in a collection
117
+ fontisan ls fonts.ttc
118
+
119
+ # Get detailed info
120
+ fontisan info fonts.ttc
121
+ ```
122
+
123
+ ## Detailed Documentation
124
+
125
+ For comprehensive documentation including table sharing analysis and advanced options, see the [pack/unpack command guide](/guide/cli/pack).