Type: a document replaced in the back measures its type when it is replaced

Session::replace_document on a tab other than the current one cleared
the bounds of type set in a font named like a composite font and left
that type with estimated bounds until the document came to the front.

- The replacement's type without bounds is measured at once, in the
  document's own composite fonts, lent for the measuring. The front
  document stays the one whose composite fonts are registered.
- When the document then comes to the front unchanged, its type in its
  own composite fonts is not measured again. Type set in a composite
  font only another document defines is still measured again, as
  missing, and so is type set in a composite font name that another
  thread's loan held with a different definition.
This commit is contained in:
dotCooCoo
2026-11-13 14:29:46 -08:00
parent 4558196e16
commit a8833442dd
4 changed files with 124 additions and 17 deletions
+6
View File
@@ -125,6 +125,11 @@ pub struct DocState {
empty_artboards: std::cell::RefCell<EmptyArtboards>,
/// What [`DocState::any_art_to_fit`] last measured. Not saved.
art_to_fit: std::cell::RefCell<Option<ArtToFit>>,
/// The document as [`crate::Session::replace_document`] left it in a tab in the back, with its
/// type measured in its own composite fonts, and the lowercased names of those fonts. When the
/// same document comes to the front, its type set in them is not measured again. While this
/// reference lasts, its allocation holds no other document. Not saved.
pub(crate) measured_in_own: Option<(std::sync::Weak<Document>, std::collections::HashSet<String>)>,
}
/// Whether a document has an artboard for Delete Empty Artboards to delete, with the document that
@@ -341,6 +346,7 @@ impl DocState {
empty_artboards: Default::default(),
plugin_effects: Default::default(),
art_to_fit: Default::default(),
measured_in_own: None,
}
}
/// `measure`'s answer for the document now. `measure` runs once for each version of the document,