[3.2] Fix SPACING_SPACE not used for drawing characters.

This commit is contained in:
bruvzg 2021-02-15 18:03:18 +02:00
parent 40c30adf04
commit 56fccb1ec1
No known key found for this signature in database
GPG key ID: 009E1BFE42239B95

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.
}
}