### 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
}
					if (flags & (1 << 2)) {
						st_flags.set_flag(TextServer::FONT_ITALIC);
					}
					unicode = (flags & 0x02);
					uint8_t encoding_id = f->get_8(); 
					if (!unicode) {
						switch (encoding_id) {
							case 0x00: {
								encoding = 2;
							} break;
							case 0xB2: {
								encoding = 6;
							} break;
							case 0xBA: {
								encoding = 7;
							} break;
							case 0xEE: {
								encoding = 0;
							} break;
							case 0xA1: {
								encoding = 3;
							} break;
							case 0xB1: {
								encoding = 5;
							} break;
							case 0xCC: {
								encoding = 1;
							} break;
							case 0xA2: {