### Godot version

v4.2.dev5.official [e3e2528ba]

### System information

Godot v4.2.dev5 - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 970 (NVIDIA; 31.0.15.3623) - Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz (8 Threads)

### Issue description

#79975 closed his issue too early, it's a separate issue to #78434.

I'll just repost his same gif:
![256703477-a7db18c1-eccf-42af-85ef-1a1472f30c73](https://github.com/godotengine/godot/assets/15337628/1a7926ea-a9d8-4eb3-a857-8d34df23228f)

### Steps to reproduce

I had a theory it was related to editor settings and I tracked it down:

1. Editor -> `Display Scale` = Custom
2. Editor -> `Custom Display Scale` = 1.15
3. Click Save & Restart
4. Print stuff

```
var number := 0
func _process(delta: float) -> void:
	number += 1
	print(number)
```

The scale number matters, 1.1 seems to be fine but smaller decimal places such as 1.15 are what cause the issue.

### Minimal reproduction project

[printbug.zip](https://github.com/godotengine/godot/files/12683758/printbug.zip)

p_item->parent = current;
	p_item->E = current->subitems.push_back(p_item);
	p_item->index = current_idx++;
	p_item->char_ofs = current_char_ofs;
	if (p_item->type == ITEM_TEXT) {
		ItemText *t = static_cast<ItemText *>(p_item);
		current_char_ofs += t->text.length();
	} else if (p_item->type == ITEM_IMAGE) {
		current_char_ofs++;
	}
	if (p_enter) {
		current = p_item;
	}
	if (p_ensure_newline) {
		Item *from = current_frame->lines[current_frame->lines.size() - 1].from;
		
		if (_find_layout_subitem(from, p_item)) {
			_invalidate_current_line(current_frame);
			current_frame->lines.resize(current_frame->lines.size() + 1);
		}
	}
	if (current_frame->lines[current_frame->lines.size() - 1].from == nullptr) {
		current_frame->lines[current_frame->lines.size() - 1].from = p_item;
	}
	p_item->line = current_frame->lines.size() - 1;
	_invalidate_current_line(current_frame);
	if (fit_content) {