A rescan keeps the loaded faces of files the catalog lists as versions of a face; the rescan test counts the newer file as a version, not a face of its own

This commit is contained in:
bflatastic
2026-11-23 06:56:48 +07:00
parent 80b20b6f7c
commit 08207b8bed
2 changed files with 4 additions and 3 deletions
+3 -2
View File
@@ -368,8 +368,9 @@ impl FontDb {
// Files may have been installed since: other versions are looked for again, in the catalog
// the rescan published. A version lookup made during the scan read the previous one.
self.version_scanned.write().unwrap_or_else(|e| e.into_inner()).clear();
let installed: std::collections::HashSet<PathBuf> = self.catalog.faces().iter().filter_map(|f| f.path.clone()).collect();
// Faces loaded from a file this scan did not catalog (the font was removed, or its folder
let installed: std::collections::HashSet<PathBuf> =
self.catalog.faces().iter().flat_map(|f| self.catalog.versions(f)).filter_map(|f| f.path).collect();
// Faces loaded from a file this scan did not catalog, as a face or a version of one (the font was removed, or its folder
// is no longer read) are dropped with their outlines. A family with no face left and no
// cataloged file leaves the lists, and type set in it resolves to the fallback font. A face
// without a file (bundled, or added as bytes) stays.
+1 -1
View File
@@ -163,7 +163,7 @@ fn a_version_looked_up_during_a_rescan_is_found_after_it() {
assert_eq!(waits, Some(true), "the rescan waits for the guard before it publishes");
assert_eq!(versions(&db), [TWIN_VERSIONS[0]], "before the rescan publishes, only the older file is cataloged");
drop(steady);
assert_eq!(rescanning.join().unwrap(), 2);
assert_eq!(rescanning.join().unwrap(), 1, "the newer file is cataloged as a version of the face, not as a face of its own");
});
assert_eq!(versions(&db), TWIN_VERSIONS, "the version the rescan found is loaded");
std::fs::remove_dir_all(dir).unwrap();