fontist 3.0.38 → 3.0.39

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3ec4754ec2eb25b7e106ecd9254296d72900bf8df94b59d1707099f1585333c6
4
- data.tar.gz: f41467d946e5513fb8f297d52984c792ffceb6ee20f4400b238ac786c844960f
3
+ metadata.gz: e03c9358f15f7d26cf72315b563b764abe153d5c298829dcebdc8747718f2091
4
+ data.tar.gz: dd8324d23bf57a9be39f0e6f9d56c2ffac617ecf54547e8f2cc809b6a0c8a187
5
5
  SHA512:
6
- metadata.gz: 4a89a610ffd86cf8c4eaef413cb58e4837496b3eb637cb218ba9ba043f61c9f72e4b6e637c34d03c50acc539006fbefd02db5be870a35627758e789b3b583977
7
- data.tar.gz: 1070a5850da3b68d883b9c578718d072ccad5c249df5f580e1510a9a2019313f76f645f063f6b39186a45deb9391d4c9a6cd501135ac54698da579ffbf5f68cb
6
+ metadata.gz: 8ff07d8998d064496efb6802911f38d0ab579e4ddbaf30edb2ad5a57824db866ca9089b3f5962ef61d6ae77f7ee415730fcd9f26b5aa4813b7b2d85b8423525d
7
+ data.tar.gz: 1b1996c3d76481ac58f4ce7de3d1da760e3d148f4e5a077148fb7bf8160fd2f7e7a8aa820ba231ba75ebdb69be5a34ed668ad7beaff12d6bfb256ad6ef278e56
@@ -23,6 +23,7 @@ jobs:
23
23
  contents: write
24
24
  packages: write
25
25
  id-token: write
26
+ pull-requests: write
26
27
  uses: fontist/support/.github/workflows/release.yml@main
27
28
  with:
28
29
  next_version: ${{ github.event.inputs.next_version }}
data/README.adoc CHANGED
@@ -371,6 +371,12 @@ Supported options:
371
371
  `-u, [--update-fontconfig]`:: Update Fontconfig
372
372
  `--collection-index=N`, `--format=FORMAT`, `--fallback-to-original`,
373
373
  `--subset-unicodes=LIST`, `--subset-text=TEXT`:: See <<Font operations>>
374
+ `--static`:: Install static fonts instead of variable fonts (the default
375
+ when a formula offers both variants)
376
+ `--variable`:: Install variable fonts instead of static fonts
377
+ `--both`:: Install both the static and the variable variants in one call
378
+ `--variable-axes=LIST`, `--prefer-variable`, `--prefer-format=FORMAT`,
379
+ `--instance=AXES`:: See <<Variable-font instancing>>
374
380
 
375
381
 
376
382
  NOTE: The `install` command is similar to the `Font.install` library call.
@@ -449,6 +455,42 @@ Fontist::Font.install("Lato", format: "woff2", subset_text: "Hello")
449
455
 
450
456
  ==== Variable-font instancing
451
457
 
458
+ ===== Static vs variable fonts
459
+
460
+ Google Fonts formulas carry two sources: per-weight **static** files served
461
+ by the Google Fonts API, and the genuine **variable** files published in the
462
+ google/fonts repository. Every style records which resource its file lives
463
+ in (`source_resource`), and fontist downloads each requested style from its
464
+ own resource. By default fontist installs the static files; pass `--variable`
465
+ to install the variable files instead, `--both` to install both kinds, or
466
+ `--instance "wght=300"` to cut a static instance from a variable font at
467
+ specific axis values.
468
+
469
+ [source,sh]
470
+ ----
471
+ fontist install "Work Sans Black" # static files
472
+ fontist install "Work Sans" --variable # variable files
473
+ fontist install "Work Sans" --both # both kinds
474
+ ----
475
+
476
+ [source,ruby]
477
+ ----
478
+ Fontist::Font.install("Work Sans Black", static: true)
479
+ Fontist::Font.install("Work Sans", variable: true)
480
+ Fontist::Font.install("Work Sans", both: true)
481
+ ----
482
+
483
+ Manifests support the same choice per font (`variable: false` or
484
+ `all_variants: true` next to `styles:`) or for all fonts at once
485
+ (`fontist manifest install --static` / `--both`):
486
+
487
+ [source,yaml]
488
+ ----
489
+ Work Sans Black:
490
+ styles: [Regular, Italic]
491
+ variable: false
492
+ ----
493
+
452
494
  `--instance` installs a static instance of a variable font at the given axis
453
495
  values. Tags and ranges are checked against the font's `fvar` table; an
454
496
  unknown axis, an out-of-range value or a non-variable font is an error.
data/lib/fontist/cli.rb CHANGED
@@ -139,6 +139,12 @@ module Fontist
139
139
  option :prefer_format,
140
140
  type: :string,
141
141
  desc: "Preferred format when multiple available"
142
+ option :static, type: :boolean,
143
+ desc: "Install static fonts instead of variable fonts"
144
+ option :variable, type: :boolean,
145
+ desc: "Install variable fonts instead of static fonts"
146
+ option :both, type: :boolean,
147
+ desc: "Install both the static and the variable variants"
142
148
  option :transcode_path,
143
149
  type: :string,
144
150
  desc: "Directory to save transcoded fonts (default: same as install location)"
@@ -171,6 +177,9 @@ module Fontist
171
177
  STATUS_UNKNOWN_ERROR)
172
178
  end
173
179
 
180
+ selection_error = validate_variant_selection(options)
181
+ return selection_error if selection_error
182
+
174
183
  # For backward compatibility, use original behavior for single font
175
184
  if fonts.size == 1
176
185
  confirmation = options[:accept_all_licenses] ? "yes" : "no"
@@ -539,6 +548,17 @@ module Fontist
539
548
  status
540
549
  end
541
550
 
551
+ def validate_variant_selection(options)
552
+ if options[:static] && options[:instance]
553
+ error("--static cannot be combined with --instance: " \
554
+ "instancing already produces a static font from a " \
555
+ "variable font.", STATUS_UNKNOWN_ERROR)
556
+ elsif options[:both] && (options[:static] || options[:variable])
557
+ error("--both cannot be combined with --static or --variable: " \
558
+ "--both already installs both variants.", STATUS_UNKNOWN_ERROR)
559
+ end
560
+ end
561
+
542
562
  def format_bytes(bytes)
543
563
  if bytes < 1024
544
564
  "#{bytes} B"
@@ -76,50 +76,84 @@ module Fontist
76
76
  Fontist.ui.say(%(Installing from formula "#{@formula.key}".))
77
77
 
78
78
  Array.new.tap do |fonts_paths|
79
- resource.files(source_files) do |path|
80
- if font_file?(path)
81
- installed_path = install_font_file(path)
82
- fonts_paths << installed_path if installed_path
83
- end
79
+ style_resource_groups.each do |resource, styles|
80
+ install_style_group(resource, styles, fonts_paths)
84
81
  end
85
82
  end
86
83
  end
87
84
 
88
- def resource
89
- resource_class = if @formula.source == "google"
90
- Resources::GoogleResource
91
- elsif @formula.source == "apple_cdn"
92
- Resources::AppleCDNResource
93
- elsif @formula.source == "windows_fod"
94
- Resources::WindowsFodResource
95
- else
96
- Resources::ArchiveResource
97
- end
85
+ # Groups the selected styles by the resource each one's file lives in.
86
+ def style_resource_groups
87
+ selected_styles.group_by { |style| resource_for_style(style) }
88
+ end
98
89
 
99
- resource_class.new(resource_options, no_progress: @no_progress)
90
+ def selected_styles
91
+ styles = filtered_styles
92
+ styles = styles_in_requested_format(styles) if @formula.v5?
93
+ prefer_static_styles(styles)
100
94
  end
101
95
 
102
- def resource_options
103
- @resource_options ||= if @formula.resources.size == 1 || !@formula.v5?
104
- @formula.resources.first
105
- elsif @format_spec&.has_constraints?
106
- matcher = FormatMatcher.new(@format_spec)
107
- matcher.select_preferred_resource(@formula.resources)
108
- else
109
- find_desktop_resource || @formula.resources.first
110
- end
96
+ # With no explicit static/variable request, styles of a font that
97
+ # offers both variants collapse to the static ones. An explicit
98
+ # variable request was already filtered by the matcher; --both keeps
99
+ # all variants.
100
+ def prefer_static_styles(styles)
101
+ return styles if @format_spec&.variable == true
102
+ return styles if @format_spec&.all_variants
103
+ return styles unless @formula.v5?
104
+
105
+ by_font = styles.group_by(&:family_name)
106
+ styles.reject do |style|
107
+ siblings = by_font[style.family_name]
108
+ siblings.any? { |s| !s.variable_font? } && style.variable_font?
109
+ end
111
110
  end
112
111
 
113
- def find_desktop_resource
114
- @formula.resources.find { |r| r.format && FormatMatcher::DESKTOP_FORMATS.include?(r.format) }
112
+ def install_style_group(resource, styles, fonts_paths)
113
+ expected = styles.map { |s| s.source_font || s.font }
114
+ seen = []
115
+
116
+ resource_for(resource).files(expected) do |path|
117
+ basename = File.basename(path)
118
+ seen << basename
119
+ next unless expected.include?(basename) && font_directory?(path)
120
+
121
+ installed_path = install_font_file(path)
122
+ fonts_paths << installed_path if installed_path
123
+ end
124
+
125
+ (expected - seen).each do |name|
126
+ Fontist.ui.warn("Font file not found in #{resource.name}: #{name}")
127
+ end
115
128
  end
116
129
 
117
- def font_file?(path)
118
- source_file?(path) && font_directory?(path)
130
+ # Resolution order: named by the style, then by file membership, then
131
+ # by the requested format (conversion path), then the first resource.
132
+ def resource_for_style(style)
133
+ named = style.source_resource &&
134
+ @formula.resources.find { |r| r.name == style.source_resource }
135
+ return named if named
136
+
137
+ source_name = style.source_font || style.font
138
+ by_file = @formula.resources.find do |r|
139
+ Array(r.files).any? { |f| File.basename(f) == source_name }
140
+ end
141
+ return by_file if by_file
142
+
143
+ by_format = @formula.resources.find do |r|
144
+ @format_spec&.format && r.format == @format_spec.format
145
+ end
146
+ by_format || @formula.resources.first
119
147
  end
120
148
 
121
- def source_file?(path)
122
- source_files.include?(File.basename(path))
149
+ def resource_for(resource)
150
+ klass = case resource.source
151
+ when "google" then Resources::GoogleResource
152
+ when "apple_cdn" then Resources::AppleCDNResource
153
+ when "windows_fod" then Resources::WindowsFodResource
154
+ else Resources::ArchiveResource
155
+ end
156
+ klass.new(resource, no_progress: @no_progress)
123
157
  end
124
158
 
125
159
  # Styles already in the requested format. When none is, a plain format
@@ -133,27 +167,6 @@ module Fontist
133
167
  @format_spec.format ? styles : matching
134
168
  end
135
169
 
136
- def source_files
137
- @source_files ||= begin
138
- styles = filtered_styles
139
-
140
- styles = styles_in_requested_format(styles) if @formula.v5?
141
-
142
- file_names = styles.map { |s| s.source_font || s.font }
143
-
144
- if @formula.v5? && resource_options&.source == "google" && file_names.any?
145
- resource_basenames = Array(resource_options.files).map do |f|
146
- File.basename(f)
147
- end
148
- unless file_names.any? { |f| resource_basenames.include?(f) }
149
- return resource_basenames
150
- end
151
- end
152
-
153
- file_names
154
- end
155
- end
156
-
157
170
  def filtered_styles
158
171
  fonts.flat_map(&:styles)
159
172
  end
@@ -27,7 +27,9 @@ module Fontist
27
27
  return false
28
28
  end
29
29
 
30
- if @spec.variable_requested?
30
+ if @spec.static_requested?
31
+ return false if resource.variable_font?
32
+ elsif @spec.variable_requested?
31
33
  return false unless resource.variable_font?
32
34
  return axes_match?(resource.variable_axes) if @spec.axes.any?
33
35
  end
@@ -45,10 +47,10 @@ module Fontist
45
47
  return false
46
48
  end
47
49
 
48
- if @spec.variable_requested?
49
- # Check if style is variable
50
- is_variable = style.variable_font?
51
- return false unless is_variable
50
+ if @spec.static_requested?
51
+ return false if style.variable_font?
52
+ elsif @spec.variable_requested?
53
+ return false unless style.variable_font?
52
54
 
53
55
  return axes_match?(style.variable_axes) if @spec.axes.any?
54
56
  end
@@ -61,7 +63,9 @@ module Fontist
61
63
  return true unless @spec.has_constraints?
62
64
  return false if @spec.format && indexed_font.format != @spec.format
63
65
 
64
- if @spec.variable_requested?
66
+ if @spec.static_requested?
67
+ return false if indexed_font.variable_font
68
+ elsif @spec.variable_requested?
65
69
  return false unless indexed_font.variable_font
66
70
 
67
71
  return axes_match?(indexed_font.variable_axes) if @spec.axes.any?
@@ -88,7 +92,6 @@ module Fontist
88
92
  # Select best resource based on preferences
89
93
  def select_preferred_resource(resources)
90
94
  return resources.first if resources.empty?
91
- return resources.first unless @spec.has_constraints?
92
95
 
93
96
  # Match exact format first (e.g. format: "ttf" selects the ttf resource)
94
97
  exact = find_exact_format(resources)
@@ -97,6 +100,9 @@ module Fontist
97
100
  preferred = find_preferred_format(resources)
98
101
  return preferred if preferred
99
102
 
103
+ static = find_static_resource(resources)
104
+ return static if static && !@spec.variable_requested?
105
+
100
106
  variable = find_variable_resource(resources)
101
107
  return variable if variable
102
108
 
@@ -163,9 +169,15 @@ module Fontist
163
169
  end
164
170
 
165
171
  def find_variable_resource(resources)
166
- return nil unless @spec.prefer_variable
172
+ return nil unless @spec.variable_requested?
173
+
174
+ resources.find do |r|
175
+ r.variable_font? && (@spec.axes.empty? || axes_match?(r.variable_axes))
176
+ end
177
+ end
167
178
 
168
- resources.find(&:variable_font?)
179
+ def find_static_resource(resources)
180
+ resources.reject(&:variable_font?).first
169
181
  end
170
182
 
171
183
  def axes_match?(available_axes)
@@ -20,6 +20,13 @@ module Fontist
20
20
  attribute :variable_axes, :string, collection: true
21
21
  attribute :prefer_variable, :boolean, default: false
22
22
 
23
+ # Static/variable selection: nil = any, true = variable only,
24
+ # false = static only
25
+ attribute :variable, :boolean
26
+
27
+ # Install both static and variable variants in one call (--both)
28
+ attribute :all_variants, :boolean, default: false
29
+
23
30
  # Format preferences
24
31
  attribute :prefer_format, :string
25
32
 
@@ -42,10 +49,14 @@ module Fontist
42
49
 
43
50
  # Convenience constructor for CLI
44
51
  def self.from_options(options = {})
52
+ preference = parse_variable_preference(options)
45
53
  new(
46
54
  format: options[:format],
47
55
  variable_axes: parse_variable_axes(options[:variable_axes]),
48
- prefer_variable: options[:prefer_variable] || false,
56
+ prefer_variable: preference.nil? &&
57
+ (options[:prefer_variable] || false),
58
+ variable: preference,
59
+ all_variants: options[:both] || false,
49
60
  prefer_format: options[:prefer_format],
50
61
  transcode_path: options[:transcode_path],
51
62
  keep_original: options.fetch(:keep_original, true),
@@ -54,6 +65,14 @@ module Fontist
54
65
  )
55
66
  end
56
67
 
68
+ # Explicit --static/--variable flags win over legacy prefer_variable.
69
+ def self.parse_variable_preference(options)
70
+ return true if options[:variable]
71
+ return false if options[:static]
72
+
73
+ nil
74
+ end
75
+
57
76
  def self.operation_options(options)
58
77
  {
59
78
  subset_unicodes: options[:subset_unicodes],
@@ -72,12 +91,18 @@ module Fontist
72
91
 
73
92
  # Check if any format constraints are specified
74
93
  def has_constraints?
75
- !!(format || variable_axes&.any? || prefer_variable || prefer_format)
94
+ !!(format || variable_axes&.any? || prefer_variable ||
95
+ !variable.nil? || all_variants || prefer_format)
76
96
  end
77
97
 
78
98
  # Check if variable font is requested
79
99
  def variable_requested?
80
- !!(variable_axes&.any? || prefer_variable)
100
+ !!(variable == true || variable_axes&.any? || prefer_variable)
101
+ end
102
+
103
+ # Check if a static font is requested
104
+ def static_requested?
105
+ variable == false
81
106
  end
82
107
 
83
108
  # Get axes as array (never nil)
@@ -296,6 +296,7 @@ github_data: nil, version: 4, source_path: nil)
296
296
  return nil unless commit
297
297
 
298
298
  Fontist::GoogleImportSource.new(
299
+ type: "google",
299
300
  commit_id: commit,
300
301
  api_version: "v1",
301
302
  last_modified: last_modified_for(family),
@@ -128,7 +128,12 @@ module Fontist
128
128
  end
129
129
 
130
130
  def group_fonts_by_subfamily(fonts)
131
- fonts_by_subfamily = fonts.group_by { |f| f[:family_name] }
131
+ # Static styles arrive with symbol keys (build_style_data) while
132
+ # variable styles arrive with string keys (VariableFontSource);
133
+ # group on either so both land in the family's group.
134
+ fonts_by_subfamily = fonts.group_by do |font|
135
+ font[:family_name] || font["family_name"]
136
+ end
132
137
 
133
138
  fonts_by_subfamily.map do |subfamily_name, styles|
134
139
  {
@@ -133,6 +133,8 @@ module Fontist
133
133
  filename = url.split("/").last
134
134
 
135
135
  style_data = build_style_data(metadata, filename)
136
+ style_data[:source_font] = filename
137
+ style_data[:font] = static_install_name(metadata, filename)
136
138
 
137
139
  # Add v5-specific attributes
138
140
  add_v5_style_attributes(style_data, metadata, variant)
@@ -149,6 +151,16 @@ module Fontist
149
151
  group_fonts_by_subfamily(parsed_fonts)
150
152
  end
151
153
 
154
+ # Install name for a static instance: PostScript name + the URL's
155
+ # extension. Falls back to the URL basename when the font's name
156
+ # table lacks a PostScript name.
157
+ def static_install_name(metadata, filename)
158
+ ps_name = metadata.postscript_name.to_s.strip
159
+ return filename if ps_name.empty?
160
+
161
+ "#{ps_name}#{File.extname(filename)}"
162
+ end
163
+
152
164
  def add_v5_style_attributes(style, _metadata = nil, variant = nil)
153
165
  # Add formats available for this style
154
166
  style["formats"] = determine_formats_for_style(variant)
@@ -349,6 +349,7 @@ module Fontist
349
349
  return nil unless version
350
350
 
351
351
  Fontist::SilImportSource.new(
352
+ type: "sil",
352
353
  version: version,
353
354
  release_date: Time.now.utc.iso8601,
354
355
  )
@@ -1,4 +1,5 @@
1
1
  require "lutaml/model"
2
+ require_relative "format_matcher"
2
3
  require_relative "format_spec"
3
4
 
4
5
  module Fontist
@@ -10,6 +11,8 @@ module Fontist
10
11
  attribute :format, :string
11
12
  attribute :variable_axes, :string, collection: true
12
13
  attribute :prefer_variable, :boolean, default: false
14
+ attribute :variable, :boolean
15
+ attribute :all_variants, :boolean, default: false
13
16
 
14
17
  # Transcoding options
15
18
  attribute :transcode_path, :string
@@ -30,6 +33,8 @@ module Fontist
30
33
  format: format,
31
34
  variable_axes: variable_axes,
32
35
  prefer_variable: prefer_variable,
36
+ variable: variable,
37
+ all_variants: all_variants,
33
38
  transcode_path: transcode_path,
34
39
  keep_original: keep_original,
35
40
  collection_index: collection_index,
@@ -63,6 +68,16 @@ module Fontist
63
68
  Fontist::SystemFont.find_styles(font, style)
64
69
  end
65
70
 
71
+ # True when every located file fails the font's static/variant spec —
72
+ # e.g. only a variable font's named instance resolves a variable: false
73
+ # request — so installation must fetch files that actually match.
74
+ def unsatisfied_by_spec?
75
+ return false unless format_spec.has_constraints?
76
+
77
+ matcher = FormatMatcher.new(format_spec)
78
+ style_paths.all? { |indexed| !matcher.matches_indexed_font?(indexed) }
79
+ end
80
+
66
81
  def install(confirmation: "no", hide_licenses: false, no_progress: false,
67
82
  location: nil)
68
83
  validate_location_parameter!(location)
@@ -146,7 +161,8 @@ module Fontist
146
161
  # format: woff2
147
162
  #
148
163
  # The plain form `Roboto: [Regular, Bold]` stays valid.
149
- FONT_OPTIONS = %w[format variable_axes prefer_variable transcode_path
164
+ FONT_OPTIONS = %w[format variable_axes prefer_variable variable
165
+ all_variants transcode_path
150
166
  keep_original collection_index subset_unicodes
151
167
  subset_text fallback_to_original instance].freeze
152
168
 
@@ -193,29 +209,39 @@ module Fontist
193
209
  def self.from_file(path, locations: false)
194
210
  Fontist.ui.debug("Manifest: #{path}")
195
211
 
196
- unless File.exist?(path)
197
- raise Fontist::Errors::ManifestCouldNotBeFoundError,
198
- "Manifest file not found: #{path}"
199
- end
200
-
201
- file_content = File.read(path).strip
212
+ manifest_model = model_from_file(path)
202
213
 
203
- if file_content.empty?
204
- raise Fontist::Errors::ManifestCouldNotBeReadError,
205
- "Manifest file is empty: #{path}"
214
+ # Use performance optimizations for faster manifest compilation
215
+ with_performance_optimizations do
216
+ manifest_model.to_response(locations: locations)
206
217
  end
218
+ end
219
+
220
+ # The parsed manifest model with per-font options intact — from_file
221
+ # collapses resolved fonts into a response whose entries have lost
222
+ # them, so install flows that honor variable:/all_variants: must
223
+ # start here instead.
224
+ def self.model_from_file(path)
225
+ validate_manifest_path!(path)
207
226
 
208
- manifest_model = begin
209
- from_yaml(file_content)
227
+ begin
228
+ from_yaml(File.read(path).strip)
210
229
  rescue StandardError => e
211
230
  raise Fontist::Errors::ManifestCouldNotBeReadError,
212
231
  "Manifest file could not be read: #{e.message}"
213
232
  end
233
+ end
214
234
 
215
- # Use performance optimizations for faster manifest compilation
216
- with_performance_optimizations do
217
- manifest_model.to_response(locations: locations)
235
+ def self.validate_manifest_path!(path)
236
+ unless File.exist?(path)
237
+ raise Fontist::Errors::ManifestCouldNotBeFoundError,
238
+ "Manifest file not found: #{path}"
218
239
  end
240
+
241
+ return unless File.read(path).strip.empty?
242
+
243
+ raise Fontist::Errors::ManifestCouldNotBeReadError,
244
+ "Manifest file is empty: #{path}"
219
245
  end
220
246
 
221
247
  def self.from_hash(data, options = {})
@@ -270,7 +296,7 @@ location: nil)
270
296
  fonts_casted.each do |font|
271
297
  paths = font.group_paths
272
298
 
273
- if paths.empty?
299
+ if paths.empty? || font.unsatisfied_by_spec?
274
300
  font.install(confirmation: confirmation,
275
301
  hide_licenses: hide_licenses,
276
302
  no_progress: no_progress,
@@ -13,9 +13,27 @@ module Fontist
13
13
  type: :string, aliases: :l,
14
14
  enum: ["fontist", "user", "system"],
15
15
  desc: "Install location: fontist (default), user, system"
16
+ option :static, type: :boolean,
17
+ desc: "Install static fonts for entries that do not " \
18
+ "set variable: themselves"
19
+ option :both, type: :boolean,
20
+ desc: "Install both variants for entries that do not " \
21
+ "set all_variants: themselves"
16
22
  def install(manifest)
17
23
  handle_class_options(options)
18
- instance = Fontist::Manifest.from_file(manifest)
24
+ instance = Fontist::Manifest.model_from_file(manifest)
25
+
26
+ if options[:static]
27
+ instance.fonts.each do |font|
28
+ font.variable = false if font.variable.nil?
29
+ end
30
+ end
31
+ if options[:both]
32
+ instance.fonts.each do |font|
33
+ font.all_variants = true unless font.all_variants
34
+ end
35
+ end
36
+
19
37
  paths = instance.install(
20
38
  confirmation: options[:accept_all_licenses] ? "yes" : "no",
21
39
  hide_licenses: options[:hide_licenses],
@@ -190,6 +190,22 @@ module Fontist
190
190
  map_instances to: :fonts
191
191
  end
192
192
 
193
+ # Older fontist versions serialized the entries under a `fonts:` key
194
+ # together with inline scan metadata. Accept that shape so an index
195
+ # written by a released gem parses as its entry list instead of a
196
+ # single blank entry (which check_index reports as corruption).
197
+ def self.from_yaml(content, options = {})
198
+ legacy = legacy_font_entries(content)
199
+ super(legacy ? Array(legacy).to_yaml : content, options)
200
+ end
201
+
202
+ def self.legacy_font_entries(content)
203
+ data = YAML.safe_load(content, aliases: true)
204
+ data.is_a?(Hash) ? data["fonts"] : nil
205
+ rescue StandardError
206
+ nil
207
+ end
208
+
193
209
  # Don't rebuild index more frequently than this (in seconds)
194
210
  INDEX_REBUILD_THRESHOLD = 30 * 60 # 30 minutes
195
211
 
@@ -1,3 +1,3 @@
1
1
  module Fontist
2
- VERSION = "3.0.38".freeze
2
+ VERSION = "3.0.39".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fontist
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.38
4
+ version: 3.0.39
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-11-13 00:00:00.000000000 Z
11
+ date: 2026-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: down