Skip empty spans when updating text buffers (#16524)
# Objective Fixes #16521 ## Solution If an empty span is encountered (such as the default `Text` value), we skip it entirely when updating buffers. This prevents unnecessarily bailing when the font doesn't exist (ex: when the default font is disabled)
This commit is contained in:
parent
6659f37df1
commit
0a8e2a3c9d
@ -107,6 +107,12 @@ impl TextPipeline {
|
||||
computed.entities.clear();
|
||||
|
||||
for (span_index, (entity, depth, span, text_font, color)) in text_spans.enumerate() {
|
||||
// Save this span entity in the computed text block.
|
||||
computed.entities.push(TextEntity { entity, depth });
|
||||
|
||||
if span.is_empty() {
|
||||
continue;
|
||||
}
|
||||
// Return early if a font is not loaded yet.
|
||||
if !fonts.contains(text_font.font.id()) {
|
||||
spans.clear();
|
||||
@ -122,9 +128,6 @@ impl TextPipeline {
|
||||
return Err(TextError::NoSuchFont);
|
||||
}
|
||||
|
||||
// Save this span entity in the computed text block.
|
||||
computed.entities.push(TextEntity { entity, depth });
|
||||
|
||||
// Get max font size for use in cosmic Metrics.
|
||||
font_size = font_size.max(text_font.font_size);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user