You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2026-01-05 19:31:35 +00:00
Adjust hex code box baseline calculation.
This commit is contained in:
@@ -4961,7 +4961,8 @@ bool TextServerAdvanced::_shaped_text_resize_object(const RID &p_shaped, const V
|
||||
} else if (sd->preserve_invalid || (sd->preserve_control && is_control(gl.index))) {
|
||||
// Glyph not found, replace with hex code box.
|
||||
if (sd->orientation == ORIENTATION_HORIZONTAL) {
|
||||
sd->ascent = MAX(sd->ascent, get_hex_code_box_size(gl.font_size, gl.index).y);
|
||||
sd->ascent = MAX(sd->ascent, get_hex_code_box_size(gl.font_size, gl.index).y * 0.85);
|
||||
sd->descent = MAX(sd->descent, get_hex_code_box_size(gl.font_size, gl.index).y * 0.15);
|
||||
} else {
|
||||
sd->ascent = MAX(sd->ascent, Math::round(get_hex_code_box_size(gl.font_size, gl.index).x * 0.5));
|
||||
sd->descent = MAX(sd->descent, Math::round(get_hex_code_box_size(gl.font_size, gl.index).x * 0.5));
|
||||
@@ -5242,7 +5243,8 @@ bool TextServerAdvanced::_shape_substr(ShapedTextDataAdvanced *p_new_sd, const S
|
||||
} else if (p_new_sd->preserve_invalid || (p_new_sd->preserve_control && is_control(gl.index))) {
|
||||
// Glyph not found, replace with hex code box.
|
||||
if (p_new_sd->orientation == ORIENTATION_HORIZONTAL) {
|
||||
p_new_sd->ascent = MAX(p_new_sd->ascent, get_hex_code_box_size(gl.font_size, gl.index).y);
|
||||
p_new_sd->ascent = MAX(p_new_sd->ascent, get_hex_code_box_size(gl.font_size, gl.index).y * 0.85);
|
||||
p_new_sd->descent = MAX(p_new_sd->descent, get_hex_code_box_size(gl.font_size, gl.index).y * 0.15);
|
||||
} else {
|
||||
p_new_sd->ascent = MAX(p_new_sd->ascent, Math::round(get_hex_code_box_size(gl.font_size, gl.index).x * 0.5));
|
||||
p_new_sd->descent = MAX(p_new_sd->descent, Math::round(get_hex_code_box_size(gl.font_size, gl.index).x * 0.5));
|
||||
@@ -6593,7 +6595,8 @@ void TextServerAdvanced::_shape_run(ShapedTextDataAdvanced *p_sd, int64_t p_star
|
||||
gl.index = p_sd->text[i];
|
||||
if (p_sd->orientation == ORIENTATION_HORIZONTAL) {
|
||||
gl.advance = get_hex_code_box_size(fs, gl.index).x;
|
||||
p_sd->ascent = MAX(p_sd->ascent, get_hex_code_box_size(fs, gl.index).y);
|
||||
p_sd->ascent = MAX(p_sd->ascent, get_hex_code_box_size(fs, gl.index).y * 0.85);
|
||||
p_sd->descent = MAX(p_sd->descent, get_hex_code_box_size(fs, gl.index).y * 0.15);
|
||||
} else {
|
||||
gl.advance = get_hex_code_box_size(fs, gl.index).y;
|
||||
gl.y_off = get_hex_code_box_size(fs, gl.index).y;
|
||||
|
||||
Reference in New Issue
Block a user