MV Changing font mid-game?

Hi again. I wanted to know if anyone knows a way to change the game's font mid game via eventing/scripting? There's this sorta trippy little segment of my game and so I wanted all game font including the font for menus and such to change when the player enters this section to sell it fully.
Save the code below in a plugin. Put any secondary font in your project's fonts folder. The plugin will load them and match them to your Secondary Font parameter. Use plugin command ToggleFont to switch back and forth. You can change the command to whatever you want. It only supports your main font and one secondary in its current form.

Note: Combat damage numbers are by default an image file in your system folder. They won't use a font, but you can alter the image to suit your needs.

Spoiler: Toggle Font Plugin
JavaScript:
/*:
 * @plugindesc Toggle between two fonts mid-game.
 * @author JGreene
 *
 * @param Primary Font
 * @desc The default font.
 * @default GameFont
 *
 * @param Secondary Font
 * @desc The font to toggle to.
 * @default Arial
 *
 * @help Put any secondary font in your project's fonts folder.
 *
 * The plugin will load them and match them to your Secondary Font parameter.
 *
 * Use plugin command ToggleFont to switch back and forth.
 */

(function() {
    var params = PluginManager.parameters('ToggleFont');
    var primaryFont = params['Primary Font'] || 'GameFont';
    var secondaryFont = params['Secondary Font'] || 'Arial';
    
    Graphics.loadFont(secondaryFont, 'fonts/' + secondaryFont + '.ttf');

    Window_Base.prototype.standardFontFace = function() {
        return $gameSystem._useSecondaryFont ? secondaryFont : primaryFont;
    };

    Game_System.prototype.toggleFont = function() {
        this._useSecondaryFont = !this._useSecondaryFont;
    };

    var _pluginCommand = Game_Interpreter.prototype.pluginCommand;
    Game_Interpreter.prototype.pluginCommand = function(command, args) {
        _pluginCommand.call(this, command, args);
        if (command === 'ToggleFont') {
            $gameSystem.toggleFont();
        }
    };
})();
YEP_MessageCore can allow you to per line, per message, per anything.
it require YEP_LoadCustomFonts (I have one for my base, and there are 3-4
other people as well doing this (as a snippet) but any works.

eliaquim has one in the pro version I believe (which is free for MV).
its in the museum pack on itch (easy to find).

if you just need 2 fonts, the above can work out, but if in between message,
you might need more of that if inside the same message box.
Save the code below in a plugin. Put any secondary font in your project's fonts folder. The plugin will load them and match them to your Secondary Font parameter. Use plugin command ToggleFont to switch back and forth. You can change the command to whatever you want. It only supports your main font and one secondary in its current form.

Note: Combat damage numbers are by default an image file in your system folder. They won't use a font, but you can alter the image to suit your needs.

Spoiler: Toggle Font Plugin
JavaScript:
/*:
 * @plugindesc Toggle between two fonts mid-game.
 * @author JGreene
 *
 * @param Primary Font
 * @desc The default font.
 * @default GameFont
 *
 * @param Secondary Font
 * @desc The font to toggle to.
 * @default Arial
 *
 * @help Put any secondary font in your project's fonts folder.
 *
 * The plugin will load them and match them to your Secondary Font parameter.
 *
 * Use plugin command ToggleFont to switch back and forth.
 */

(function() {
    var params = PluginManager.parameters('ToggleFont');
    var primaryFont = params['Primary Font'] || 'GameFont';
    var secondaryFont = params['Secondary Font'] || 'Arial';
   
    Graphics.loadFont(secondaryFont, 'fonts/' + secondaryFont + '.ttf');

    Window_Base.prototype.standardFontFace = function() {
        return $gameSystem._useSecondaryFont ? secondaryFont : primaryFont;
    };

    Game_System.prototype.toggleFont = function() {
        this._useSecondaryFont = !this._useSecondaryFont;
    };

    var _pluginCommand = Game_Interpreter.prototype.pluginCommand;
    Game_Interpreter.prototype.pluginCommand = function(command, args) {
        _pluginCommand.call(this, command, args);
        if (command === 'ToggleFont') {
            $gameSystem.toggleFont();
        }
    };
})();
Hi. Thank you for making this, however I can't seem to get it working the way I want it to. i set it to my font, "pl". Which is a custom made font that I have in my game's folder, and which I use in textboxes using Yanfly's message core commands.
1773786660638.png


However, the command seems to only switch the font to Arial. Here is a side by side for the menus of the base game font, and when it switches:

Before:
1773786742858.png


After:
1773786792029.png


And yes, my "pl" font is in my fonts folder and downloaded to my computer. Here's another screenshot of that (rummysfunctionalfont IS the game's default font btw)

1773786881592.png
Hi. Thank you for making this, however I can't seem to get it working the way I want it to. i set it to my font, "pl". Which is a custom made font that I have in my game's folder, and which I use in textboxes using Yanfly's message core commands.
I only tested it on a blank project. Wasn't sure if you were using Yanfly's or not. See if this fix works.

Spoiler: Toggle Font Plugin
JavaScript:
/*:
 * @plugindesc Toggle between two fonts mid-game. Place below YEP Message Core.
 * @author JGreene
 *
 * @param Primary Font
 * @desc The default font. Must be loaded in fonts/ folder.
 * @default GameFont
 *
 * @param Secondary Font
 * @desc The font to toggle to.
 * @default Arial
 *
 * @help Put any secondary font in your project's fonts folder.
 *
 * The plugin will load them and match them to your Secondary Font parameter.
 *
 * Use plugin command ToggleFont to switch back and forth.
 */
(function() {
    var params = PluginManager.parameters('ToggleFont');
    var primaryFont = params['Primary Font'] || 'GameFont';
    var secondaryFont = params['Secondary Font'] || 'Arial';

    Graphics.loadFont(secondaryFont, 'fonts/' + secondaryFont + '.ttf');

    Window_Base.prototype.standardFontFace = function() {
        return $gameSystem._useSecondaryFont ? secondaryFont : primaryFont;
    };

    var _Window_Message_resetFontSettings = Window_Message.prototype.resetFontSettings;
    Window_Message.prototype.resetFontSettings = function() {
        _Window_Message_resetFontSettings.call(this);
        this.contents.fontFace = $gameSystem._useSecondaryFont ? secondaryFont : primaryFont;
    };

    Game_System.prototype.toggleFont = function() {
        this._useSecondaryFont = !this._useSecondaryFont;
    };

    var _pluginCommand = Game_Interpreter.prototype.pluginCommand;
    Game_Interpreter.prototype.pluginCommand = function(command, args) {
        _pluginCommand.call(this, command, args);
        if (command === 'ToggleFont') {
            $gameSystem.toggleFont();
        }
    };
})();

Edit: I've released a plugin that's a lot better than this. https://forums.rpgmakerweb.com/threads/toggle-font.182921/

Original thread: https://forums.rpgmakerweb.com/threads/changing-font-mid-game.182906/