### 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
FontAdvanced *fd = font_owner.get_or_null(p_font_rid);
	ERR_FAIL_COND_V(!fd, 0);
	MutexLock lock(fd->mutex);
	Vector2i size = _get_size(fd, p_size);
	ERR_FAIL_COND_V(!_ensure_cache_for_size(fd, size), 0);
#ifdef MODULE_FREETYPE_ENABLED
	if (fd->cache[size]->inv_glyph_map.is_empty()) {
		FT_Face face = fd->cache[size]->face;
		FT_UInt gindex;
		FT_ULong charcode = FT_Get_First_Char(face, &gindex);
		while (gindex != 0) {
			if (charcode != 0) {
				fd->cache[size]->inv_glyph_map[gindex] = charcode;
			}
			charcode = FT_Get_Next_Char(face, charcode, &gindex);
		}
	}
	if (fd->cache[size]->inv_glyph_map.has(p_glyph_index)) {
		return fd->cache[size]->inv_glyph_map[p_glyph_index];
	} else {
		return 0;
	}
#else
	return p_glyph_index;
#endif
}
bool TextServerAdvanced::_font_has_char(const RID &p_font_rid, int64_t p_char) const {