### Godot version

8449592d92eaeef990f5502b419d491ee3eeb7a6

### System information

Windows 11

### Issue description

Zooming in the script editor on an empty script freezes the entire editor for a few seconds, but if the file is large then it freezes for 4-5 seconds (which is unacceptable). Looks like a recent regression.

### Steps to reproduce

Just zoom in/out on the large script file.

### Minimal reproduction project

N/A
return TS->font_get_stretch(_get_rid());
}
Dictionary Font::get_opentype_features() const {
	return Dictionary();
}
void Font::set_cache_capacity(int p_single_line, int p_multi_line) {
	cache.set_capacity(p_single_line);
	cache_wrap.set_capacity(p_multi_line);
}
Size2 Font::get_string_size(const String &p_text, HorizontalAlignment p_alignment, float p_width, int p_font_size, BitField<TextServer::JustificationFlag> p_jst_flags, TextServer::Direction p_direction, TextServer::Orientation p_orientation) const {
	bool fill = (p_alignment == HORIZONTAL_ALIGNMENT_FILL);
	ShapedTextKey key = ShapedTextKey(p_text, p_font_size, fill ? p_width : 0.0, fill ? p_jst_flags : TextServer::JUSTIFICATION_NONE, TextServer::BREAK_NONE, p_direction, p_orientation);
	Ref<TextLine> buffer;
	if (cache.has(key)) {
		buffer = cache.get(key);
	} else {
		buffer.instantiate();
		buffer->set_direction(p_direction);
		buffer->set_orientation(p_orientation);
		buffer->add_string(p_text, Ref<Font>(this), p_font_size);
		cache.insert(key, buffer);
	}
	buffer->set_width(p_width);
	buffer->set_horizontal_alignment(p_alignment);
	if (p_alignment == HORIZONTAL_ALIGNMENT_FILL) {
		buffer->set_flags(p_jst_flags);
	}
	return buffer->get_size();
}
Size2 Font::get_multiline_string_size(const String &p_text, HorizontalAlignment p_alignment, float p_width, int p_font_size, int p_max_lines, BitField<TextServer::LineBreakFlag> p_brk_flags, BitField<TextServer::JustificationFlag> p_jst_flags, TextServer::Direction p_direction, TextServer::Orientation p_orientation) const {