mirror of
https://github.com/godotengine/godot.git
synced 2024-11-24 21:22:48 +00:00
Merge pull request #98841 from bruvzg/ts_el_load
[TextServer] Only load ellipsis glyph when it's used.
This commit is contained in:
commit
de48d9f794
@ -5264,6 +5264,7 @@ void TextServerAdvanced::_shaped_text_overrun_trim_to_width(const RID &p_shaped_
|
||||
|
||||
// Find usable fonts, if fonts from the last glyph do not have required chars.
|
||||
RID dot_gl_font_rid = sd_glyphs[sd_size - 1].font_rid;
|
||||
if (add_ellipsis || enforce_ellipsis) {
|
||||
if (!_font_has_char(dot_gl_font_rid, sd->el_char)) {
|
||||
const Array &fonts = spans[spans.size() - 1].fonts;
|
||||
for (int i = 0; i < fonts.size(); i++) {
|
||||
@ -5304,6 +5305,7 @@ void TextServerAdvanced::_shaped_text_overrun_trim_to_width(const RID &p_shaped_
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
RID whitespace_gl_font_rid = sd_glyphs[sd_size - 1].font_rid;
|
||||
if (!_font_has_char(whitespace_gl_font_rid, ' ')) {
|
||||
const Array &fonts = spans[spans.size() - 1].fonts;
|
||||
@ -5315,8 +5317,8 @@ void TextServerAdvanced::_shaped_text_overrun_trim_to_width(const RID &p_shaped_
|
||||
}
|
||||
}
|
||||
|
||||
int32_t dot_gl_idx = dot_gl_font_rid.is_valid() ? _font_get_glyph_index(dot_gl_font_rid, last_gl_font_size, (found_el_char ? sd->el_char : '.'), 0) : -1;
|
||||
Vector2 dot_adv = dot_gl_font_rid.is_valid() ? _font_get_glyph_advance(dot_gl_font_rid, last_gl_font_size, dot_gl_idx) : Vector2();
|
||||
int32_t dot_gl_idx = ((add_ellipsis || enforce_ellipsis) && dot_gl_font_rid.is_valid()) ? _font_get_glyph_index(dot_gl_font_rid, last_gl_font_size, (found_el_char ? sd->el_char : '.'), 0) : -1;
|
||||
Vector2 dot_adv = ((add_ellipsis || enforce_ellipsis) && dot_gl_font_rid.is_valid()) ? _font_get_glyph_advance(dot_gl_font_rid, last_gl_font_size, dot_gl_idx) : Vector2();
|
||||
int32_t whitespace_gl_idx = whitespace_gl_font_rid.is_valid() ? _font_get_glyph_index(whitespace_gl_font_rid, last_gl_font_size, ' ', 0) : -1;
|
||||
Vector2 whitespace_adv = whitespace_gl_font_rid.is_valid() ? _font_get_glyph_advance(whitespace_gl_font_rid, last_gl_font_size, whitespace_gl_idx) : Vector2();
|
||||
|
||||
|
@ -4077,6 +4077,7 @@ void TextServerFallback::_shaped_text_overrun_trim_to_width(const RID &p_shaped_
|
||||
|
||||
// Find usable fonts, if fonts from the last glyph do not have required chars.
|
||||
RID dot_gl_font_rid = sd_glyphs[sd_size - 1].font_rid;
|
||||
if (add_ellipsis || enforce_ellipsis) {
|
||||
if (!_font_has_char(dot_gl_font_rid, sd->el_char)) {
|
||||
const Array &fonts = spans[spans.size() - 1].fonts;
|
||||
for (int i = 0; i < fonts.size(); i++) {
|
||||
@ -4117,6 +4118,7 @@ void TextServerFallback::_shaped_text_overrun_trim_to_width(const RID &p_shaped_
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
RID whitespace_gl_font_rid = sd_glyphs[sd_size - 1].font_rid;
|
||||
if (!_font_has_char(whitespace_gl_font_rid, ' ')) {
|
||||
const Array &fonts = spans[spans.size() - 1].fonts;
|
||||
@ -4128,8 +4130,8 @@ void TextServerFallback::_shaped_text_overrun_trim_to_width(const RID &p_shaped_
|
||||
}
|
||||
}
|
||||
|
||||
int32_t dot_gl_idx = dot_gl_font_rid.is_valid() ? _font_get_glyph_index(dot_gl_font_rid, last_gl_font_size, (found_el_char ? sd->el_char : '.'), 0) : -1;
|
||||
Vector2 dot_adv = dot_gl_font_rid.is_valid() ? _font_get_glyph_advance(dot_gl_font_rid, last_gl_font_size, dot_gl_idx) : Vector2();
|
||||
int32_t dot_gl_idx = ((add_ellipsis || enforce_ellipsis) && dot_gl_font_rid.is_valid()) ? _font_get_glyph_index(dot_gl_font_rid, last_gl_font_size, (found_el_char ? sd->el_char : '.'), 0) : -1;
|
||||
Vector2 dot_adv = ((add_ellipsis || enforce_ellipsis) && dot_gl_font_rid.is_valid()) ? _font_get_glyph_advance(dot_gl_font_rid, last_gl_font_size, dot_gl_idx) : Vector2();
|
||||
int32_t whitespace_gl_idx = whitespace_gl_font_rid.is_valid() ? _font_get_glyph_index(whitespace_gl_font_rid, last_gl_font_size, ' ', 0) : -1;
|
||||
Vector2 whitespace_adv = whitespace_gl_font_rid.is_valid() ? _font_get_glyph_advance(whitespace_gl_font_rid, last_gl_font_size, whitespace_gl_idx) : Vector2();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user