Author Topic: [RMXP]Distributing RPG Maker XP games with custom fonts  (Read 1026 times)

Zeriab

  • Trained Citizen (Level 3)
  • *
  • Posts: 74
  • Occasionally kind
    • View Profile
[RMXP]Distributing RPG Maker XP games with custom fonts
« on: November 06, 2016, 07:31:25 AM »
Distributing RPG Maker XP games with custom fonts
Installing fonts is such a bother and requires admin privileges, so let us not do that

When developing our games it is very possible we want to use another font. This information is already present elsewhere, but as a quick reminder it can look like this.
Code: [Select]
Font.default_name = "Roboto"
Font.default_name = ["Roboto", "Arial"] # Fall back to Arial if Roboto does not exist

What happens if Roboto does not exists?
  • No fallback - No text is drawn
  • Fallback - Text drawn in Arial instead.

Neither case is acceptable if we really want Roboto to be the font used.

Luckily we can use the AddFontResource function from GDI32.dll to load font resources. Unfortunately, in RMXP we cannot use fonts loaded through that call until the game is started anew. Should we load fonts in one game, and then run another game, that other game can use the fonts resources. I have encapsulated this functionality into a tool.

Note: AddFontResource requires the font to exist on the file system. I.e. it cannot load fonts from encrypted archives.

Tool
Download: http://www.mediafire.com/file/6l9s59bef58eadx/Font+Launcher.zip
Demo: http://www.mediafire.com/file/j6dkhqkpa4yyllr/Demo.zip

Once you unpack the zip file you will see the following elements:


Copy those files into your own game directory.


Copy the fonts you want into the Fonts folder, and use Launcher.exe. That's it.

Note: I have included the RGSS104E.dll just for good measure, just in case you use another DLL version. Feel free to change the Launcher.ini file if you prefer to another version.

Have renamed your Game.exe files? Edit the Launcher.ini file:
Quote
[Game]
Library=RGSS104E.dll
Scripts=Data\Scripts.rxdata
Title=Launcher

[Launcher]
Game=Game

Say the name is "Hello Steven.exe" then change the Launcher.ini file to be:
Quote
[Game]
Library=RGSS104E.dll
Scripts=Data\Scripts.rxdata
Title=Launcher

[Launcher]
Game=Hello Steven


Read priority
As you sure have noticed. We have an encrypted archive called Launcher.rgssad. To explain why this is important because encrypted archives have higher read priority than file system files. I don't mind showing the code: http://pastebin.com/8aw6CFcY

The name of the executable have functional meaning. Let us look at the sample game directory again:


Note we have two executables here.
  • Game.exe
  • Launcher.exe
   
In our example both Game.ini and Launcher.ini has Scripts=Data\Scripts.rxdata, yet they do not load the same Scripts.rxdata

The RGSS Player executable looks first for a Configuration settings file with the same name as itself and ending with .ini, next it looks for an RGSS Encrypted Archive file with the same name as itself and ending with .rgssad.

In other words you can say
  • Launcher.exe is associated with Launcher.ini and Launcher.rgssad
  • Game.exe is associated with Game.ini

Next it tries to load the resource located at Data\Scripts.rxdata. If it has an encrypted archive associated it searched that before the file system. So we end up with this loading sequence.


You can also encrypt the game just fine. Then you'll Game.exe try to load resources from Game.rgssad before the file system.

License
Code: [Select]
Copyright (c) 2016 Zeriab

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
 
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not
   claim that you wrote the original software. If you use this software
   in a product, an acknowledgement in the product documentation would be
   appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
   misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.

Final notes
Wachunga has made a script which tries to actually install the fonts: https://github.com/wachunga/rmxp-auto-font-install
That script requires administrative privileges, actually install the fonts and cause changes to registration database.
Using my tool does not install anything and it requires no administrative privileges. On the downside it does runs two executables.

Let me extend some thanks to Laura Shigihara. She is using a custom font for her upcoming game, Rakuen, and her request for help eventually turned into the tool and this topic.

Thank you for reading my tutorial.
Any comments are appreciated.
Additional data about whether it works for your or not is appreciated.

*hugs*
 - Zeriab
« Last Edit: November 19, 2016, 06:27:06 AM by Zeriab »

supershigi

  • No Yoshi is an Island
  • Royal Citizen
  • *
  • Posts: 4178
    • View Profile
Re: [RMXP]Distributing RPG Maker XP games with custom fonts
« Reply #1 on: November 06, 2016, 01:47:18 PM »
This is really a fantastic tool, Zeriab! Thank-you so much for your help with this. After talking with Reives and Lannie about the issues they had with custom fonts, I was really worried that I wouldn't be able to use the font I currently have in Rakuen (which would be a shame, because I cannot imagine another font fitting so well)... So this is a HUGE weight off my shoulders.

And to anyone else reading this thread: This tool is super easy to use. If you're using RPG Maker XP and want to use a custom font, it'll help a lot more people play your game. Before using it, despite the fact that I included the font and instructions for how to install it, I still had several testers report that they were unable to see the dialogue because they didn't install the font. Many folks have never installed fonts before (prior to using rpg maker, I had actually never installed them either). And it doesn't do anything to change the registry either, so this is super rad :)
« Last Edit: November 06, 2016, 02:11:52 PM by supershigi »

Astragoth

  • Tea Leeble
  • *
  • Posts: 1752
    • View Profile
    • Astra's Blog
Re: [RMXP]Distributing RPG Maker XP games with custom fonts
« Reply #2 on: November 12, 2016, 12:06:50 PM »
I've already told you this Zeriab, but thanks SOO much again for writing this tool, you are awesome! ^_^

Zeriab

  • Trained Citizen (Level 3)
  • *
  • Posts: 74
  • Occasionally kind
    • View Profile
Re: [RMXP]Distributing RPG Maker XP games with custom fonts
« Reply #3 on: November 13, 2016, 08:40:58 AM »
Thank you for your kind words Laura and Astra :3
I am glad you find my work useful. It was fun finding a solution to this problem.

@Shigi: Apart from the actually investigating custom fonts you also allowed me to play Rakuen. More than a fair trade in my eyes :D

*hugs*

supershigi

  • No Yoshi is an Island
  • Royal Citizen
  • *
  • Posts: 4178
    • View Profile
Re: [RMXP]Distributing RPG Maker XP games with custom fonts
« Reply #4 on: November 16, 2016, 08:03:22 PM »
Quote from: Zeriab
@Shigi: Apart from the actually investigating custom fonts you also allowed me to play Rakuen. More than a fair trade in my eyes

Awww... I'm still so happy that you enjoyed it ^__^

Merlandese

  • Coffee Leeble
  • *
  • Posts: 724
    • View Profile
Re: [RMXP]Distributing RPG Maker XP games with custom fonts
« Reply #5 on: November 18, 2016, 07:19:10 AM »
This is brilliant, Zeriab!

When I finish up today's workload I'll give it a shot for Social Caterpillar. This is something RMXP has need for a LONG time!

EDIT: Ah, dang, it looks like one of the custom scripts I use to generate most of my texts doesn't work with it. It's this "Text to Image" script that lets you type something like a normal text but draws it as an image you can move and control on screen.

It's not a huge deal. It's still super nice this exists. If you want to take a look at the weird script I'm using just say so and I'll shoot it your way. :)
« Last Edit: November 18, 2016, 07:46:38 AM by Merlandese »


Zeriab

  • Trained Citizen (Level 3)
  • *
  • Posts: 74
  • Occasionally kind
    • View Profile
Re: [RMXP]Distributing RPG Maker XP games with custom fonts
« Reply #6 on: November 19, 2016, 02:40:24 AM »
Hey Lannie, I'm glad you like my work :)

Can you send me your script, and even better also a demo showcasing the issue? I would like to take a look.

*hugs*

Merlandese

  • Coffee Leeble
  • *
  • Posts: 724
    • View Profile
Re: [RMXP]Distributing RPG Maker XP games with custom fonts
« Reply #7 on: November 19, 2016, 05:06:37 AM »
Yeah, man, no prob. I'll shoot you a PM as soon as it's ready. :)


Zeriab

  • Trained Citizen (Level 3)
  • *
  • Posts: 74
  • Occasionally kind
    • View Profile
Re: [RMXP]Distributing RPG Maker XP games with custom fonts
« Reply #8 on: November 19, 2016, 06:19:55 AM »
Oh, silly me. I forgot to accommodate for different casings. I have updated the topic with the new version.
Thanks for reporting the bug :D
« Last Edit: November 19, 2016, 06:27:49 AM by Zeriab »

Merlandese

  • Coffee Leeble
  • *
  • Posts: 724
    • View Profile
Re: [RMXP]Distributing RPG Maker XP games with custom fonts
« Reply #9 on: November 19, 2016, 07:22:52 AM »
Perfect and timely fix! Thanks, man!


Zeriab

  • Trained Citizen (Level 3)
  • *
  • Posts: 74
  • Occasionally kind
    • View Profile
Re: [RMXP]Distributing RPG Maker XP games with custom fonts
« Reply #10 on: November 19, 2016, 03:46:12 PM »
Your input made my stuff better.
How can I not be happy about that <3