mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Don't perform font matching for control characters
We can encounter control characters here, for example when processing a <pre> element which contains newlines. Control characters are inherently non-printing, therefore if we try to call find_by_codepoint for these characters we will end up triggering an unnecessary font fallback search.
This commit is contained in:
parent
691c6c6f1a
commit
4403bcddfe
1 changed files with 52 additions and 50 deletions
|
@ -215,6 +215,7 @@ impl TextRunScanner {
|
|||
|
||||
let (mut start_position, mut end_position) = (0, 0);
|
||||
for (byte_index, character) in text.char_indices() {
|
||||
if !character.is_control() {
|
||||
let font = font_group.borrow_mut().find_by_codepoint(&mut font_context, character);
|
||||
|
||||
let bidi_level = match bidi_levels {
|
||||
|
@ -271,6 +272,7 @@ impl TextRunScanner {
|
|||
run_info.script = script;
|
||||
mapping.selected = selected;
|
||||
}
|
||||
}
|
||||
|
||||
// Consume this character.
|
||||
end_position += character.len_utf8();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue