layout: Implement support for font fallback (#31254)

This adds an initial implementation of font fallback, on part with the
one used in legacy layout. There are still issues. For instance, font
matching is done per unicode character rather than based on graphemes or
the shape first approach of Chrome. The idea is that these changes can
be made later.
This commit is contained in:
Martin Robinson 2024-02-11 11:08:49 +01:00 committed by GitHub
parent 410ead20b0
commit cdc3c369f0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 525 additions and 211 deletions

View file

@ -148,12 +148,13 @@ where
.into_par_iter()
.map(|job| match job {
FlexLevelJob::TextRuns(runs) => ArcRefCell::new(FlexLevelBox::FlexItem({
let runs = runs.into_iter().map(|run| crate::flow::text_run::TextRun {
base_fragment_info: (&run.info).into(),
text: run.text.into(),
parent_style: run.info.style,
has_uncollapsible_content: false,
shaped_text: None,
let runs = runs.into_iter().map(|run| {
crate::flow::text_run::TextRun::new(
(&run.info).into(),
run.info.style,
run.text.into(),
false, /* has_uncollapsible_content */
)
});
let bfc = BlockFormattingContext::construct_for_text_runs(
runs,