As document says :
'' Godot currently doesn't have a way to enforce integer scaling when using the canvas_items or viewport stretch mode, which means pixel art may look bad if the final window size is not a multiple of the base window size. To fix this, use an add-on such as the Integer Resolution Handler ''
godot currently does not support enforce integer scaling viewport, and then point out a plugin doing this job. The plugin https://github.com/Yukitty/godot-addon-integer_resolution_handler do accomplish this job, but it does not work for 4.x as API changes a lot.
After searching through documents and source files, I still can't find these APIs to do what I want, so I come here for help.