fontist 3.0.39 → 3.0.40

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: e03c9358f15f7d26cf72315b563b764abe153d5c298829dcebdc8747718f2091
4
- data.tar.gz: dd8324d23bf57a9be39f0e6f9d56c2ffac617ecf54547e8f2cc809b6a0c8a187
3
+ metadata.gz: ce7d7174490910823059c7abf1a6b7d910ad2e383594606df92bad8f8ddb5cad
4
+ data.tar.gz: cfdca82ec87b74d49260146aaaeb5143a8a85008b96dc12a0a54d20a170e8900
5
5
  SHA512:
6
- metadata.gz: 8ff07d8998d064496efb6802911f38d0ab579e4ddbaf30edb2ad5a57824db866ca9089b3f5962ef61d6ae77f7ee415730fcd9f26b5aa4813b7b2d85b8423525d
7
- data.tar.gz: 1b1996c3d76481ac58f4ce7de3d1da760e3d148f4e5a077148fb7bf8160fd2f7e7a8aa820ba231ba75ebdb69be5a34ed668ad7beaff12d6bfb256ad6ef278e56
6
+ metadata.gz: 5ecae7158189d128ad7ed41bf1cffe119f3656222da9f1eb43fe46bae233bb18f5a9a8e99c2eedc120306d7fc6b9b224de56367d6feb6e5ec1c04394beb22817
7
+ data.tar.gz: 66766185068d24636922d1feb67345a3fb01e7faf53a5e1146389ac2c1db52999e8f7049b47c9bb1eb7babb3ff067fced1744488a21b46d1a0d7aa32eb49a6f4
@@ -64,8 +64,6 @@ jobs:
64
64
  bundler: ${{ env.BUNDLER_VER }}
65
65
  bundler-cache: true
66
66
 
67
- - uses: metanorma/ci/inkscape-setup-action@main
68
-
69
67
  - name: Configure Git credentials
70
68
  env:
71
69
  GIT_TOKEN: ${{ secrets.FONTIST_CI_PAT_TOKEN }}
data/lib/fontist/font.rb CHANGED
@@ -69,7 +69,7 @@ module Fontist
69
69
  def install
70
70
  return install_formula if @by_formula
71
71
 
72
- (find_system_font unless @force) || download_font || manual_font ||
72
+ (find_installable_font unless @force) || download_font || manual_font ||
73
73
  raise_non_supported_font
74
74
  end
75
75
 
@@ -118,6 +118,38 @@ module Fontist
118
118
  paths # Return paths after printing
119
119
  end
120
120
 
121
+ # Install-time lookup under the static default: a variable font already
122
+ # on disk does not satisfy a plain request when the formula offers
123
+ # static files, so stale variable installs from older fontist versions
124
+ # cannot shadow the statics forever (fontist/fontist#556).
125
+ def find_installable_font
126
+ paths = Fontist::SystemFont.find(name)
127
+ unless paths
128
+ Fontist.ui.say(%(Font "#{name}" not found locally.))
129
+ return
130
+ end
131
+ return if static_variant_shadowed_locally?
132
+
133
+ print_paths(paths)
134
+ paths
135
+ end
136
+
137
+ def static_variant_shadowed_locally?
138
+ return false if @format_spec&.variable_requested?
139
+ return false if @format_spec&.all_variants
140
+ return false unless static_variant_locally?
141
+
142
+ Formula.offers_static_variant?(name)
143
+ end
144
+
145
+ def static_variant_locally?
146
+ located = Fontist::SystemFont.find_styles(name)
147
+ return false if located.nil? || located.empty?
148
+
149
+ located.any?(&:variable_font) &&
150
+ located.none? { |style| !style.variable_font }
151
+ end
152
+
121
153
  def print_paths(paths)
122
154
  Fontist.ui.say("Fonts found at:")
123
155
  paths.each do |path|
@@ -135,6 +135,21 @@ module Fontist
135
135
  Indexes::FontIndex.lookup_index.load_formulas(font_name)
136
136
  end
137
137
 
138
+ # Whether any formula answering to this font name offers a static
139
+ # (non-variable) file. With the static default (fontist/fontist#556),
140
+ # callers use this to decide whether variable files on disk may satisfy
141
+ # a plain request: when statics exist, they must be preferred even if a
142
+ # stale variable install from an older fontist version is present.
143
+ def offers_static_variant?(font_name)
144
+ find_many(font_name).compact.any? do |formula|
145
+ formula.all_fonts.flat_map(&:styles).any? do |style|
146
+ !style.variable_font?
147
+ end
148
+ end
149
+ rescue Errors::FormulaNotFoundError, Errors::FontIndexCorrupted
150
+ false
151
+ end
152
+
138
153
  def find_fonts(font_name)
139
154
  formulas = Indexes::FontIndex.lookup_index.load_formulas(font_name)
140
155
 
@@ -71,11 +71,29 @@ module Fontist
71
71
  # True when every located file fails the font's static/variant spec —
72
72
  # e.g. only a variable font's named instance resolves a variable: false
73
73
  # request — so installation must fetch files that actually match.
74
+ # With the static default, variable files on disk also do not satisfy a
75
+ # plain request when the formula offers static files: stale variable
76
+ # installs from older fontist versions would otherwise shadow the
77
+ # statics forever.
74
78
  def unsatisfied_by_spec?
79
+ located = style_paths
80
+ return true if located.empty?
81
+
82
+ return true if static_default_shadowed_by_variable?(located)
83
+
75
84
  return false unless format_spec.has_constraints?
76
85
 
77
86
  matcher = FormatMatcher.new(format_spec)
78
- style_paths.all? { |indexed| !matcher.matches_indexed_font?(indexed) }
87
+ located.all? { |indexed| !matcher.matches_indexed_font?(indexed) }
88
+ end
89
+
90
+ def static_default_shadowed_by_variable?(located)
91
+ return false if format_spec.variable_requested?
92
+ return false if format_spec.all_variants
93
+
94
+ located.all? { |indexed| indexed.variable_font } &&
95
+ located.any? { |indexed| indexed.variable_font } &&
96
+ Fontist::Formula.offers_static_variant?(name)
79
97
  end
80
98
 
81
99
  def install(confirmation: "no", hide_licenses: false, no_progress: false,
@@ -6,7 +6,12 @@ module Fontist
6
6
  RATE_LIMITED_HTTP_STATUS = 429
7
7
  BACKOFF = {
8
8
  rate_limited: [10, 20, 40, 60, 90].freeze,
9
- transient: [2, 4].freeze,
9
+ # Two quick retries give snappy hosts a second chance, and the
10
+ # slower tail absorbs large shared archives: web.archive.org and
11
+ # similar mirror hosts routinely fail single requests with
12
+ # timeouts or reset connections and recover within seconds
13
+ # (metanorma S-201 builds hit this on EUupdate.EXE).
14
+ transient: [2, 4, 8, 15].freeze,
10
15
  }.freeze
11
16
  MAX_RETRY_AFTER = 120
12
17
  JITTER_RATIO = 0.25
@@ -35,8 +35,13 @@ module Fontist
35
35
  new.say(message, :green) if log_levels.include?(:info)
36
36
  end
37
37
 
38
+ # Errors go to stderr so that callers who redirect stdout — pipelines
39
+ # that capture fontist YAML output into a file — never receive error
40
+ # prose in place of data (metanorma/mn2pdf#466).
38
41
  def self.error(message)
39
- new.say(message, :red) if log_levels.include?(:warn)
42
+ return unless log_levels.include?(:warn)
43
+
44
+ $stderr.puts new.set_color(message, :red)
40
45
  end
41
46
 
42
47
  def self.warn(message)
@@ -1,3 +1,3 @@
1
1
  module Fontist
2
- VERSION = "3.0.39".freeze
2
+ VERSION = "3.0.40".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.39
4
+ version: 3.0.40
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-23 00:00:00.000000000 Z
11
+ date: 2026-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: down