Use supported codepoints instead of scripts in Monospace fallback

This should/could improve fallback order.

 This could also probably be utilized for non-Monospace fallback too.
 But I didn't want to touch that code to avoid accidentally breaking
 anything.

Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
This commit is contained in:
Mohammad AlSaleh 2024-01-18 23:00:54 +03:00 committed by Jeremy Soller
parent 845a66ceff
commit db1530c4ec
3 changed files with 45 additions and 37 deletions

View file

@ -219,7 +219,13 @@ fn shape_run(
let fonts = font_system.get_font_matches(attrs);
let default_families = [&attrs.family];
let mut font_iter = FontFallbackIter::new(font_system, &fonts, &default_families, &scripts);
let mut font_iter = FontFallbackIter::new(
font_system,
&fonts,
&default_families,
&scripts,
&line[start_run..end_run],
);
let font = font_iter.next().expect("no default font found");
@ -341,7 +347,7 @@ fn shape_skip(
let fonts = font_system.get_font_matches(attrs);
let default_families = [&attrs.family];
let mut font_iter = FontFallbackIter::new(font_system, &fonts, &default_families, &[]);
let mut font_iter = FontFallbackIter::new(font_system, &fonts, &default_families, &[], "");
let font = font_iter.next().expect("no default font found");
let font_id = font.id();