### 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
memdelete(fd);
		ERR_FAIL_V_MSG(false, "FreeType: Can't load dynamic font, engine is compiled without FreeType support!");
#endif
	} else {
		
		fd->hb_handle = _bmp_font_create(fd, nullptr);
	}
	p_font_data->cache[p_size] = fd;
	return true;
}
_FORCE_INLINE_ void TextServerAdvanced::_font_clear_cache(FontAdvanced *p_font_data) {
	MutexLock ftlock(ft_mutex);
	for (const KeyValue<Vector2i, FontForSizeAdvanced *> &E : p_font_data->cache) {
		memdelete(E.value);
	}
	p_font_data->cache.clear();
	p_font_data->face_init = false;
	p_font_data->supported_features.clear();
	p_font_data->supported_varaitions.clear();
	p_font_data->supported_scripts.clear();
}
hb_font_t *TextServerAdvanced::_font_get_hb_handle(const RID &p_font_rid, int64_t p_size) const {
	FontAdvanced *fd = font_owner.get_or_null(p_font_rid);
	ERR_FAIL_COND_V(!fd, nullptr);
	MutexLock lock(fd->mutex);
	Vector2i size = _get_size(fd, p_size);
	ERR_FAIL_COND_V(!_ensure_cache_for_size(fd, size), nullptr);
	return fd->cache[size]->hb_handle;
}
RID TextServerAdvanced::_create_font() {