fontist 3.0.6 → 3.0.7

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: 901ef91ebd6bdc2f41e97ecad10c4fe2e752f9b5dff6faa2d75a8d9065bea478
4
- data.tar.gz: b793fbea7abd2f98fb8334682238b7e8f34168b69509a3641196799bf1b171b0
3
+ metadata.gz: 473f97386abfc5612b2386ef09c7166f57577346e1fa1576f10b89cde776a82a
4
+ data.tar.gz: 496fe338410ab4a2fca8d03f51de0030ed831e365e3dd310f9a26f92bb441d16
5
5
  SHA512:
6
- metadata.gz: a3e4427e15dd34aecfb531bc1a25e980351c24d32515f58723b731ff0fa11467d450c3ef24feaf1661b23d5035147758d9cead9828c2a468e23ecc2230afa0bc
7
- data.tar.gz: 8e0e6912a1bf8c3cd07d0c4f7c2699450c0e5b324c65f82392a74e5c5d60147f764996eb18caf079fea5707bac10cc66398f32e510405ee2d531127d17be14f3
6
+ metadata.gz: 3df014b751d95d4e5c9b1ca536e51b8209a0edc85d35fa5e5f277016ef8b1a4a605b2592057afd74b466537446cd3594ea294f3c820530b393c078ce785e1e86
7
+ data.tar.gz: cedd3d33a01cd1ceba826848c09ffb40dda37080bd5a1a4aa4db68dfd95a25869b9080ea4b8b1ba82eb01ebfae45602e35439fe6861730cba4ce5f16a9b8913d
@@ -41,14 +41,21 @@ module Fontist
41
41
  # Get the collection, initializing it lazily if nil
42
42
  #
43
43
  # Uses lazy initialization so that the collection is created with fresh
44
- # font_paths each time it's accessed after reset_cache
44
+ # font_paths each time it's accessed after reset_cache.
45
+ #
46
+ # On cold start (no on-disk index file), eagerly build the index once
47
+ # so that `fonts` reflects an authoritative scan. This lets callers in
48
+ # read-only mode trust the cached `fonts` without re-running `build` on
49
+ # every lookup.
45
50
  #
46
51
  # @return [SystemIndexFontCollection] The collection object
47
52
  def collection
48
53
  @collection ||= SystemIndexFontCollection.from_file(
49
54
  path: index_path,
50
55
  paths_loader: -> { font_paths },
51
- )
56
+ ).tap do |coll|
57
+ coll.build unless File.exist?(index_path)
58
+ end
52
59
  end
53
60
 
54
61
  # Enable read-only mode for operations that don't need index rebuilding
@@ -229,11 +229,7 @@ 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 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?
232
+ if @read_only_mode && !fonts.nil?
237
233
  return fonts
238
234
  end
239
235
 
@@ -1,3 +1,3 @@
1
1
  module Fontist
2
- VERSION = "3.0.6".freeze
2
+ VERSION = "3.0.7".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.6
4
+ version: 3.0.7
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-18 00:00:00.000000000 Z
11
+ date: 2026-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: down