fontist 3.0.3 → 3.0.5

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: ef31ff4d5c017fd86187db92ab8eb9c428e694731d9bb7eb9be4dadbcb7ac210
4
- data.tar.gz: 87f038f05b151bb64f31fc0592d2b2b6e883414852623232c23e2cff12d37df3
3
+ metadata.gz: b0403ccfbfdac1ce2d3b3be90872600c857101d498017d0849903a0e0231b2af
4
+ data.tar.gz: d16c6f71f7182a054f7600beb77e58c41bf726e813d6b893e3f605a33bb462d1
5
5
  SHA512:
6
- metadata.gz: bad74c88e0eeb2d2cd12fb8e7c0f9e09663c9fc98ddbebdf0ab54b8f3eb90895414fa7fc5fb699356ff590f7f1ea1cb66cce11917415ecbe9d70112bc5f312e0
7
- data.tar.gz: 4c843a8d911ce97ff680fb3ac85d440e80f617982a77c82e6bc8cc6c40b32a050ff2daf50a109c73b174c7ec851e0999f4a6df77148546b9f44838b80205e83d
6
+ metadata.gz: 48d21df850f6e0f4f6fb1a89536ae78d392f9421e2e95593b73636448a67b106055ad9c5aefc0152659a8460f5a9a4be4fdecd12acdce869cc30e56211115246
7
+ data.tar.gz: 667f24398403d0e295c188f4bc200dc42a6b6da419cc39c9e4e621a766dc230e450764b1b7836bae1eb13ce50cd25c298b3e89084f2ae3a83d4c9a9b5820078a
@@ -60,6 +60,14 @@ module Fontist
60
60
  self
61
61
  end
62
62
 
63
+ # Disable read-only mode, restoring normal index_changed? checks.
64
+ #
65
+ # @return [self] Returns self for chaining
66
+ def disable_read_only_mode
67
+ collection.disable_read_only_mode
68
+ self
69
+ end
70
+
63
71
  # Returns all fonts in the index
64
72
  #
65
73
  # @return [Array<SystemIndexFont>] All indexed fonts
@@ -183,7 +183,11 @@ module Fontist
183
183
 
184
184
  yield
185
185
  ensure
186
- # Always disable caching after the operation
186
+ # Always restore normal mode after the operation so the read-only flag
187
+ # does not leak across calls and turn the singletons effectively stale.
188
+ Fontist::Indexes::FontistIndex.instance.disable_read_only_mode
189
+ Fontist::Indexes::UserIndex.instance.disable_read_only_mode
190
+ Fontist::Indexes::SystemIndex.instance.disable_read_only_mode
187
191
  Fontist::SystemFont.disable_find_styles_cache
188
192
  end
189
193
 
@@ -229,11 +229,12 @@ module Fontist
229
229
  end
230
230
 
231
231
  def index
232
- # Fast path: if read_only mode is set, skip index_changed? check entirely
233
- # But we still need to build if fonts is nil (first time access)
234
- if @read_only_mode && !fonts.nil?
232
+ # Fast path: if read_only mode is set, skip index_changed? check entirely.
233
+ # But we still need to build on first access treat an empty fonts list
234
+ # the same as nil, since Lutaml initializes `instances :fonts` to `[]`
235
+ # rather than nil when the on-disk index file is absent.
236
+ if @read_only_mode && !fonts.nil? && !fonts.empty?
235
237
  return fonts
236
- # Fall through to build the index on first access
237
238
  end
238
239
 
239
240
  return fonts unless index_changed?
@@ -257,6 +258,14 @@ module Fontist
257
258
  self
258
259
  end
259
260
 
261
+ # Disable read-only mode so future `index` calls go through
262
+ # `index_changed?` again. Paired with `read_only_mode` to scope the
263
+ # optimization to a single block (see Manifest.with_performance_optimizations).
264
+ def disable_read_only_mode
265
+ @read_only_mode = false
266
+ self
267
+ end
268
+
260
269
  def index_changed?
261
270
  return true if fonts.nil? || fonts.empty?
262
271
  return false if @index_check_done # Skip if already verified in this session
data/lib/fontist/utils.rb CHANGED
@@ -71,7 +71,7 @@ module Fontist
71
71
 
72
72
  # On case-insensitive filesystems (Windows, macOS), use simple patterns
73
73
  # On case-sensitive filesystems (Linux), use character class patterns
74
- if %i[windows macosx].include?(Fontist::Utils::System.user_os)
74
+ if %i[windows macos].include?(Fontist::Utils::System.user_os)
75
75
  # Case-insensitive filesystem - simple patterns work fine
76
76
  extensions.map { |ext| File.join(prefix, "*.#{ext}") }
77
77
  else
@@ -1,3 +1,3 @@
1
1
  module Fontist
2
- VERSION = "3.0.3".freeze
2
+ VERSION = "3.0.5".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.3
4
+ version: 3.0.5
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-05-05 00:00:00.000000000 Z
11
+ date: 2026-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: down