Always include the last-resort font

This is used as a fallback for any characters that don't have glyphs in the
specified font.
This commit is contained in:
Matt Brubeck 2016-05-20 09:37:54 -07:00
parent 2d5dc8fa6d
commit e588943b4f
258 changed files with 127 additions and 905 deletions

View file

@ -197,17 +197,12 @@ impl TextRunScanner {
for (byte_index, character) in text.char_indices() {
// Search for the first font in this font group that contains a glyph for this
// character.
let mut font_index = 0;
let font_index = fontgroup.fonts.iter().position(|font| {
font.borrow().glyph_index(character).is_some()
}).unwrap_or(0);
// The following code panics one way or another if this condition isn't met.
assert!(fontgroup.fonts.len() > 0);
while font_index < fontgroup.fonts.len() - 1 {
if fontgroup.fonts.get(font_index).unwrap().borrow()
.glyph_index(character)
.is_some() {
break
}
font_index += 1;
}
let bidi_level = match bidi_levels {
Some(levels) => levels[*paragraph_bytes_processed],