FALLBACK FONTS AND FONT CHECKING

Help out players who didn't install your custom font

RPG Maker XP can only use fonts that are installed in the system.
It may be possible to write a font loader DLL and use the RGSS linker, but I'm not aware of such a thing existing yet.

You want to use a custom font for your game, because none of the windows fonts are great. However your players just want to jump in and run game.exe without reading any readme files.
Also a small number of players won't have the administrator password to install a font.

This tutorial will show you two things:
* How to use a fallback font, so players who didn't install the font at least see something.
* How to check if the font is installed, and warn players they won't get the best experience of the game.

Fallback Fonts

Where you specify a font name in RGSS, you can use an array of names.
Let's look at a default font changer script:
class Font

alias font_fix_initialize initialize

def initialize
  font_fix_initialize
  self.name = "FancyFont"
end

end


This changes the default font to a custom font called "FancyFont".
But anyone without FancyFont is going to see missing text, even on the new game menu screen.



Let's change the name to a list:

class Font

alias font_fix_initialize initialize

def initialize
  font_fix_initialize
  self.name = [ "FancyFont", "Courier New", "MS PMincho" ]
end

end


Now the game at least shows something, even if it's not pretty.
Font names in a list are tried in order until one of them works.

When you're using a 3rd party script (e.g. a battle system) that has its own font configuration, you'll usually be able to just configure it with a list.
But be sure to test, in some cases you might need to make edits.

Checking if a font is installed

This can be done in a script, or an event.
An easy way to do it is using an autorun event on your first map.
Most games have some sort of opening scene autorun event already, so you can just insert a check at the top.



The script call is on tab 4 of a conditional branch.
If you have several fonts required, it might be worth writing a small ruby function to check all of them, in order to keep the event readable.

Thanks to Lavendersiren for the idea and parts of the solution.

Posts

Pages: 1
The same technique is applicable to VX as well. For VX Ace and later, you can just bundle the font with the game.
Pages: 1