Repository: godotengine/godot
File: editor/gui/editor_spin_slider.cpp (C++)

Code before:
	TS->shaped_text_add_string(num_rid, numstr + U"\u2009" + suffix, font->get_rids(), font_size, font->get_opentype_features());

	float text_start = rtl ? Math::round(sb->get_offset().x) : Math::round(sb->get_offset().x + label_width + sep);
	Vector2 text_ofs = rtl ? Vector2(text_start + (number_width - TS->shaped_text_get_width(num_rid)), vofs) : Vector2(text_start, vofs);
	int v_size = TS->shaped_text_get_glyph_count(num_rid);
	const Glyph *glyphs = TS->shaped_text_get_glyphs(num_rid);
	for (int i = 0; i < v_size; i++) {
		for (int j = 0; j < glyphs[i].repeat; j++) {
			if (text_ofs.x >= text_start && (text_ofs.x + glyphs[i].advance) <= (text_start + number_width)) {
				Color color = fc;
				if (glyphs[i].start >= suffix_start) {
					color.a *= 0.4;
				}
				if (glyphs[i].font_rid != RID()) {
					TS->font_draw_glyph(glyphs[i].font_rid, ci, glyphs[i].font_size, text_ofs + Vector2(glyphs[i].x_off, glyphs[i].y_off), glyphs[i].index, color);
				} else if (((glyphs[i].flags & TextServer::GRAPHEME_IS_VIRTUAL) != TextServer::GRAPHEME_IS_VIRTUAL) && ((glyphs[i].flags & TextServer::GRAPHEME_IS_EMBEDDED_OBJECT) != TextServer::GRAPHEME_IS_EMBEDDED_OBJECT)) {
					TS->draw_hex_code_box(ci, glyphs[i].font_size, text_ofs + Vector2(glyphs[i].x_off, glyphs[i].y_off), glyphs[i].index, color);
				}
			}
			text_ofs.x += glyphs[i].advance;
		}
	}
	TS->free_rid(num_rid);

	if (!hide_slider) {
		if (editing_integer && get_max() == get_min()) {
			Ref<Texture2D> updown2 = read_only ? theme_cache.updown_disabled_icon : theme_cache.updown_icon;
			int updown_vofs = (size.height - updown2->get_height()) / 2;
			if (rtl) {
				updown_offset = sb->get_margin(SIDE_LEFT);
			} else {
				updown_offset = size.width - sb->get_margin(SIDE_RIGHT) - updown2->get_width();
			}
			Color c(1, 1, 1);
			if (hover_updown) {
				c *= Color(1.2, 1.2, 1.2);
			}
			draw_texture(updown2, Vector2(updown_offset, updown_vofs), c);
			if (rtl) {
				updown_offset += updown2->get_width();
			}
			if (grabber->is_visible()) {
				grabber->hide();
			}
		} else {
			const int grabber_w = 4 * EDSCALE;
			const int width = size.width - sb->get_minimum_size().width - grabber_w;
			const int ofs = sb->get_offset().x;
			const int svofs = (size.height + vofs) / 2 - 1;
			Color c = fc;


Review comment (refactor):
I tested the changes and they work as expected on top of my PR. However, the fix for [#42809](https://github.com/godotengine/godot/issues/42809)
 affects all integer properties across the editor and project settings, and also removes the option to restore the up/down arrows when needed. It would be better to move this fix into a separate PR since it introduces a broader behavior change that likely needs its own discussion.

Code after:
	RID num_rid = TS->create_shaped_text();
	TS->shaped_text_add_string(num_rid, numstr + U"\u2009" + suffix, font->get_rids(), font_size, font->get_opentype_features());

	float text_start = rtl ? Math::round(sb->get_offset().x) : Math::round(sb->get_offset().x + label_width + sep);
	Vector2 text_ofs = rtl ? Vector2(text_start + (number_width - TS->shaped_text_get_width(num_rid)), vofs) : Vector2(text_start, vofs);
	int v_size = TS->shaped_text_get_glyph_count(num_rid);
	const Glyph *glyphs = TS->shaped_text_get_glyphs(num_rid);
	for (int i = 0; i < v_size; i++) {
		for (int j = 0; j < glyphs[i].repeat; j++) {
			if (text_ofs.x >= text_start && (text_ofs.x + glyphs[i].advance) <= (text_start + number_width)) {
				Color color = fc;
				if (glyphs[i].start >= suffix_start) {
					color.a *= 0.4;
				}
				if (glyphs[i].font_rid != RID()) {
					TS->font_draw_glyph(glyphs[i].font_rid, ci, glyphs[i].font_size, text_ofs + Vector2(glyphs[i].x_off, glyphs[i].y_off), glyphs[i].index, color);
				} else if (((glyphs[i].flags & TextServer::GRAPHEME_IS_VIRTUAL) != TextServer::GRAPHEME_IS_VIRTUAL) && ((glyphs[i].flags & TextServer::GRAPHEME_IS_EMBEDDED_OBJECT) != TextServer::GRAPHEME_IS_EMBEDDED_OBJECT)) {
					TS->draw_hex_code_box(ci, glyphs[i].font_size, text_ofs + Vector2(glyphs[i].x_off, glyphs[i].y_off), glyphs[i].index, color);
				}
			}
			text_ofs.x += glyphs[i].advance;
		}
	}
	TS->free_rid(num_rid);

	if (control_state != CONTROL_STATE_HIDE) {
		if (editing_integer && control_state == CONTROL_STATE_DEFAULT) {
			Ref<Texture2D> updown2 = read_only ? theme_cache.updown_disabled_icon : theme_cache.updown_icon;
			int updown_vofs = (size.height - updown2->get_height()) / 2;
			if (rtl) {
				updown_offset = sb->get_margin(SIDE_LEFT);
			} else {
				updown_offset = size.width - sb->get_margin(SIDE_RIGHT) - updown2->get_width();
			}
			Color c(1, 1, 1);
			if (hover_updown) {
				c *= Color(1.2, 1.2, 1.2);
			}
			draw_texture(updown2, Vector2(updown_offset, updown_vofs), c);
			if (rtl) {
				updown_offset += updown2->get_width();
			}
			if (grabber->is_visible()) {
				grabber->hide();
			}
		} else {
			const int grabber_w = 4 * EDSCALE;
			const int width = size.width - sb->get_minimum_size().width - grabber_w;
			const int ofs = sb->get_offset().x;
			const int svofs = (size.height + vofs) / 2 - 1;
			Color c = fc;