fonts: Store web fonts in the per-Layout FontContext (#32303)

This moves mangement of web fonts to the per-Layout `FontContext`,
preventing web fonts from being available in different Documents.

Fixes #12920.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
This commit is contained in:
Martin Robinson 2024-05-20 16:13:03 +02:00 committed by GitHub
parent 8d2d955bbb
commit be5b527ea3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 1010 additions and 558 deletions

View file

@ -486,7 +486,10 @@ where
None => StyleFontStyle::NORMAL,
};
let descriptor = FontTemplateDescriptor::new(weight, stretch, style);
callback(FontTemplate::new_local(local_font_identifier, descriptor));
callback(FontTemplate::new_for_local_font(
local_font_identifier,
descriptor,
));
};
if let Some(family) = FONT_LIST.find_family(family_name) {

View file

@ -152,7 +152,10 @@ where
};
let descriptor = FontTemplateDescriptor::new(weight, stretch, style);
callback(FontTemplate::new_local(local_font_identifier, descriptor))
callback(FontTemplate::new_for_local_font(
local_font_identifier,
descriptor,
))
}
FcFontSetDestroy(matches);

View file

@ -158,7 +158,10 @@ where
stretch,
style,
};
callback(FontTemplate::new_local(local_font_identifier, descriptor));
callback(FontTemplate::new_for_local_font(
local_font_identifier,
descriptor,
));
};
if let Some(family) = FONT_LIST.find_family(family_name) {

View file

@ -81,7 +81,7 @@ where
postscript_name: Atom::from(family_descriptor.font_name()),
path: Atom::from(path),
};
callback(FontTemplate::new_local(identifier, descriptor));
callback(FontTemplate::new_for_local_font(identifier, descriptor));
}
}
}

View file

@ -81,7 +81,7 @@ where
let local_font_identifier = LocalFontIdentifier {
font_descriptor: Arc::new(font.to_descriptor()),
};
callback(FontTemplate::new_local(
callback(FontTemplate::new_for_local_font(
local_font_identifier,
template_descriptor,
))