Sadly for some reason Godot 4 made pixel art more challenging to achieve but nonetheless its possible to configure the engine to achieve pretty good results.
Project Settings
Open the project setting menu and in Display > Window

In my case the resolution of my game is 640×360
- Size Section
- Viewport Width: 640
- Viewport Height: 360
- Mode: Fullscreen
- Stretch Section
- Mode: Viewport
Then in Rendering > Textures

- Canvas Textures
- Default Texture Filter: Nearest
Fonts
Select your fonts in the file system viewer and change those two parameters:

- Antialiasing: None
- Subpixel Position: Disabled