Dynamic default font

I'm looking for a plugin that allows the Dev to change the default font. My game features two distinct time periods and Iij would like the game font to reflect that in the menus.

I know how to change the default font in the .css file but I'm looking for a plugin that will direct the engine to a different .css file when prompted. Kind of like the windowskins plugin.
Disclaimer: haven't tested this

First, add another font inside the CSS file
Code:
@font-face {
   font-family: YourFont;
   src: url("your-font-name.ttf");
}

You can have as many fonts as you want in the CSS file, just have different font-family and source for each.

In a plugin:
Code:
Window_Base.prototype.standardFontFace = function() {
   if ($gameVariables && $gameVariables.value(17)) {
      return $gameVariables.value(17)
  }
   return 'GameFont'
}

Now you can set the value of Variable #17 to the font-family (like GameFont) and that'll be used for windows.

To set a variable to a text (string) value like "GameFont", you can still use the Control Variables Event Command, in the script option at the bottom enter "GameFont" (with the quotes)

Caveats:
  • If a window is already created, it probably won't change the font while it's still alive. It'll probably have to be killed and then made again (scene change or map change should do this)
  • There's probably other parts of the game besides windows that use fonts
  • If you use other plugins and those authors did something weird with creating the window, this may not have an effect
Thank you for the quick response! I won't be able to test this until tonight, but I have a question. Can I use the second code you provided in an evented script call, or does it have to be an actual plugin? I have no idea how to make a plugin.
It would be in a plugin, because it overwrites the default behavior of how the font is chosen.

Creating a plugin is like creating any other file on your computer. If you were to create a text file, you would create "my_text_file.txt". Well, a Javascript file is just a text file with a different file type. So create a file called "ChangeFontDuringGame.js" inside your project plugins folder (same place you have all the other plugins).
Open up this new file in any text editor (Notepad++ is a good one if you're a beginner) and paste the code in and then add the plugin in your Plugin Manager.

Please don't use the default Notepad on Windows because that'll destroy the formatting.
Awesome, thanks! I'll try that as soon as I'm done driving today.
Holy freaking crap!!!!! So I had 15 minutes to kill and I tried your code....It freaking worked! You're amazing, thank you so much. That was the last game mechanic I needed to figure out to move forward with my idea.
It would be in a plugin, because it overwrites the default behavior of how the font is chosen.

Creating a plugin is like creating any other file on your computer. If you were to create a text file, you would create "my_text_file.txt". Well, a Javascript file is just a text file with a different file type. So create a file called "ChangeFontDuringGame.js" inside your project plugins folder (same place you have all the other plugins).
Open up this new file in any text editor (Notepad++ is a good one if you're a beginner) and paste the code in and then add the plugin in your Plugin Manager.

Please don't use the default Notepad on Windows because that'll destroy the formatting.
Man, I thought I had it licked. Your code worked like a charm on the menus, but it didn't actually change the default font. I didn't feel like this was a problem because I could just select whatever font I wanted when showing text boxes. The problem I'm having now is that I can't dynamically change the font for battle processing. I can go into terms and change the font, but there seems to be no way to change it back and forth between the fonts. So, long story longer, when I am using the old font, all of the battle messages are still in the futuristic font that is set as the game's default. Is there a way to change that?

Is there a master list somewhere of what the %1, %2, etc variables are. Maybe I can find one that isn't used or I can re-purpose and assign a value to that. For instance, I'm using Yanfly's message macro for the font selection so that when I type \1 before the text in terms it shows the correct font. I figured %1 was the value for actor so I changed actor 1's name to \1 Harold and the font came out correctly. So, I'm thinking if I can find a way to assign a blank %x variable with my font macro I can define the term as something like %x %1 is victorious! in the database.

You've been super helpful and I hope you can be so again.

Original thread: https://forums.rpgmakerweb.com/threads/dynamic-default-font.114967/