mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-01 02:35:37 +01:00
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 <noreply@anthropic.com>
This commit is contained in:
1 parent
22f5ca3cbf
commit
979ae2dc1b
1 file changed
+6
@@ -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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user