mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
[TextServer] Remove negative offset from the first char when shaping substrings.
This commit is contained in:
parent
ef34c3d534
commit
369e690c55
2 changed files with 8 additions and 0 deletions
|
|
@ -5435,6 +5435,10 @@ bool TextServerAdvanced::_shape_substr(ShapedTextDataAdvanced *p_new_sd, const S
|
||||||
}
|
}
|
||||||
p_new_sd->width += gl.advance * gl.repeat;
|
p_new_sd->width += gl.advance * gl.repeat;
|
||||||
}
|
}
|
||||||
|
if (p_new_sd->glyphs.is_empty() && gl.x_off < 0.0) {
|
||||||
|
gl.advance += -gl.x_off;
|
||||||
|
gl.x_off = 0.0;
|
||||||
|
}
|
||||||
p_new_sd->glyphs.push_back(gl);
|
p_new_sd->glyphs.push_back(gl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4117,6 +4117,10 @@ RID TextServerFallback::_shaped_text_substr(const RID &p_shaped, int64_t p_start
|
||||||
new_sd->descent = MAX(new_sd->descent, Math::round(get_hex_code_box_size(gl.font_size, gl.index).x * 0.5));
|
new_sd->descent = MAX(new_sd->descent, Math::round(get_hex_code_box_size(gl.font_size, gl.index).x * 0.5));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (new_sd->glyphs.is_empty() && gl.x_off < 0.0) {
|
||||||
|
gl.advance += -gl.x_off;
|
||||||
|
gl.x_off = 0.0;
|
||||||
|
}
|
||||||
new_sd->width += gl.advance * gl.repeat;
|
new_sd->width += gl.advance * gl.repeat;
|
||||||
}
|
}
|
||||||
new_sd->glyphs.push_back(gl);
|
new_sd->glyphs.push_back(gl);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue