From 979ae2dc1bd848dbfe63e84228ca75f0eb5a0ae2 Mon Sep 17 00:00:00 2001 From: ruchirguitar Date: Sat, 28 Nov 2026 00:19:55 +0530 Subject: [PATCH] Language packs: measure back documents in their own composite fonts When the packs change, poll_language_packs measures the type of every open document again. A document in the back now has its own composite fonts lent while it is measured, as measure_back_document does, so type set in a composite font of the same name as one of the front document's is not measured in the front document's definition. Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/store.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/engine/src/store.rs b/crates/engine/src/store.rs index 428b88d51c..4a547d6513 100644 --- a/crates/engine/src/store.rs +++ b/crates/engine/src/store.rs @@ -988,9 +988,15 @@ impl Session { if now != self.packs_seen { self.packs_seen = now; for index in 0..self.docs.len() { + // A document in the back is measured in its own composite fonts, lent for the + // measuring, as `measure_back_document` does: the front document's are the + // ones registered, and one of the same name may differ. + let back_fonts = (self.active != Some(index)).then(|| self.docs.get(index).map(|st| st.doc.composite_fonts.clone())).flatten(); + let lent = back_fonts.as_ref().map(|fonts| vectorcraft_text::FontDb::global().lend_document_composite_fonts(fonts)); // Type in a language of its own may break its lines elsewhere now: it is // measured again (not an edit), so its selection box and hits follow. self.refresh_document_text_bounds(index, |t| t.runs.iter().any(|r| r.style.language.is_some())); + drop(lent); if let Some(st) = self.docs.get_mut(index) { st.revision += 1; }