MV Pixel perfect scaling on graphics, but not fonts?

In my current MV project, which uses pixel art assets, I'm currently using @Galenmereth 's Pixel Perfect Scaling Mode to remove anti-aliasing from the graphics in scaled game windows, which works great. However, I am using a non-pixel font (primarily for readability/accessibility reasons), which, to me, looks much better with the anti-aliasing.

Spoiler: Screenshots
Right now, my options are either:
Crisp window, jagged font:
1636211354007.png

or smooth font, blurred window:
1636211424644.png

Is there a way to add anti-aliasing to the text separately, or to limit the "pixel perfect" scaling to non-font graphics?
Hi there!

Since the text is primarily drawn on the Bitmap Class, you could try do this:

OPTION 1
JavaScript:
const Bitmap_drawText = Bitmap.prototype.drawText
Bitmap.prototype.drawText = function(text, x, y, maxWidth, lineHeight, align) {
    this._smooth = true
    Bitmap_drawText.call(this, text, x, y, maxWidth, lineHeight, align)
    this._smooth = false
}

But I don't know if it will work the way it is supposed to, because the Galenmereth plugin applies the pixel perfect in all Game Canvas(Line 163).
JavaScript:
    Graphics.TDDP_updateCanvasImageRenderingMode = function() {
        this._canvas.style.imageRendering = usePixelPerfectMode() ? 'pixelated' : '';
    }

So you also try to change the "imageRendering" property of the canvas style, only for draw text, like that:

OPTION 2
JavaScript:
const Bitmap_drawText = Bitmap.prototype.drawText
Bitmap.prototype.drawText = function(text, x, y, maxWidth, lineHeight, align) {
    Graphics._canvas.style.imageRendering =  ''
    this._smooth = true
    Bitmap_drawText.call(this, text, x, y, maxWidth, lineHeight, align)
    this._smooth = false
    Graphics._canvas.style.imageRendering = usePixelPerfectMode() ? 'pixelated' : ''

}

I think it will remove the pixel-perfect of all the game canvas too. Meaning that not only the fonts, but everything else could be non-pixelated while drawing the text =/

Give it a try on OPTION 1 first. I believe that has more chances to work.
Thank you! Unfortunately, both options don't seem to work - with the plugin's pixel perfect scaling more turned on, the font remains pixelated. Without knowing much about canvas image rendering, I guess the scaling mode can't be changed for individual parts of the graphics? Or if it can, the TDDP_updateCanvasImageRenderingMode function would set the mode for the entire game canvas to "pixelated" again every time the Graphics are updated...
Thank you! Unfortunately, both options don't seem to work - with the plugin's pixel perfect scaling more turned on, the font remains pixelated. Without knowing much about canvas image rendering, I guess the scaling mode can't be changed for individual parts of the graphics? Or if it can, the TDDP_updateCanvasImageRenderingMode function would set the mode for the entire game canvas to "pixelated" again every time the Graphics are updated...
Gosh...
Ok, long shot, really don't know if the below will work...

const Bitmap_drawText = Bitmap.prototype.drawText
Bitmap.prototype.drawText = function(text, x, y, maxWidth, lineHeight, align) {
this._context.canvas.style.imageRendering = ""
this._canvas.style.imageRendering = ""
Bitmap_drawText.call(this, text, x, y, maxWidth, lineHeight, align)
}
Same effect, sadly (none).
I've also tried doing a few other things with the context (potentially not supported by all browsers)
JavaScript:
const Bitmap_drawText = Bitmap.prototype.drawText;
Bitmap.prototype.drawText = function(text, x, y, maxWidth, lineHeight, align) {
    this._context.imageSmoothingEnabled = true;
    this._context.imageSmoothingQuality = "medium";
    Bitmap_drawText.call(this, text, x, y, maxWidth, lineHeight, align);
};
also had no effect, though.

I can, however, blur the text:
JavaScript:
const Bitmap_drawText = Bitmap.prototype.drawText;
Bitmap.prototype.drawText = function(text, x, y, maxWidth, lineHeight, align) {
    this._context.filter = "blur(1px)";
    Bitmap_drawText.call(this, text, x, y, maxWidth, lineHeight, align);
};
but that apparently requires a blur of at least 1 px, which is too blurry for my purpose 😅
Sadly that it does not work =/
I'm out of ideas xD

Original thread: https://forums.rpgmakerweb.com/threads/pixel-perfect-scaling-on-graphics-but-not-fonts.141897/