Merge pull request #46055 from bruvzg/fix_spacing_space

[3.2] Fix SPACING_SPACE not used for drawing characters.
This commit is contained in:
Rémi Verschelde 2021-02-15 17:30:34 +01:00 committed by GitHub
commit daf1151b79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -885,13 +885,18 @@ float DynamicFont::draw_char(RID p_canvas_item, const Point2 &p_pos, CharType p_
if (!data_at_size.is_valid())
return 0;
int spacing = spacing_char;
if (p_char == ' ') {
spacing += spacing_space;
}
if (p_outline) {
if (outline_data_at_size.is_valid() && outline_cache_id.outline_size > 0) {
outline_data_at_size->draw_char(p_canvas_item, p_pos, p_char, p_next, p_modulate * outline_color, fallback_outline_data_at_size, false, true); // Draw glpyh outline.
}
return data_at_size->draw_char(p_canvas_item, p_pos, p_char, p_next, p_modulate, fallback_data_at_size, true, false) + spacing_char; // Return advance of the base glyph.
return data_at_size->draw_char(p_canvas_item, p_pos, p_char, p_next, p_modulate, fallback_data_at_size, true, false) + spacing; // Return advance of the base glyph.
} else {
return data_at_size->draw_char(p_canvas_item, p_pos, p_char, p_next, p_modulate, fallback_data_at_size, false, false) + spacing_char; // Draw base glyph and return advance.
return data_at_size->draw_char(p_canvas_item, p_pos, p_char, p_next, p_modulate, fallback_data_at_size, false, false) + spacing; // Draw base glyph and return advance.
}
}