Distributing RPG Maker XP games with custom fonts

Discussion in 'RMXP Tutorials' started by Zeriab, Nov 6, 2016.

  1. Zeriab

    Zeriab Huggins! Veteran

    Messages:
    1,198
    Likes Received:
    1,248
    First Language:
    English
    Primarily Uses:
    RMXP

    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.


    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?

    1. No fallback - No text is drawn
    2. 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:


    [​IMG]


    Copy those files into your own game directory.


    [​IMG]


    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:

    Code:
    [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:

    Code:
    [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:


    [​IMG]


    Note we have two executables here.

    1. Game.exe
    2. 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.


    [​IMG]


    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

    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 edited by a moderator: Nov 19, 2016
    #1
    IRHP, Heretic86 and Marquise* like this.
  2. Marquise*

    Marquise* Veteran Veteran

    Messages:
    4,520
    Likes Received:
    7,819
    First Language:
    French-Canadian
    I never settled my fonts even in Ace.  I guess this tutorial makes me a place to look at starter.  (Ack... actually 2 or 3 peoples asked me for fonts...  I never made one for computers.  *sigh*  yeah, I know... if I can make big monsters... I can do typical fonts... I hope!)


    Woah... even coming with a program!  I dunno how you should be thanks... wait... *HUGE CYBERMENTAL BEAR HUGS*
     
    Last edited by a moderator: Nov 8, 2016
    #2
    Zeriab likes this.
  3. Zeriab

    Zeriab Huggins! Veteran

    Messages:
    1,198
    Likes Received:
    1,248
    First Language:
    English
    Primarily Uses:
    RMXP
    Thank you. I love hugs <3


    For Ace I believe you can just add the custom fonts to a Fonts folder and have them read automatically.


    *hugs*
     
    #3
    Marquise* likes this.
  4. Marquise*

    Marquise* Veteran Veteran

    Messages:
    4,520
    Likes Received:
    7,819
    First Language:
    French-Canadian
    Woahhh...  I wasn't there yet, but then I got stuck on... *sigh* spriting!  (Fortunately I had the time to play with the systems graphics.)


    One day, I will do it all!  (as long as I don't have any requests to do big MV monsters I can't refuse!  LOL)
     
    Last edited by a moderator: Nov 8, 2016
    #4
    Zeriab likes this.
  5. Zeriab

    Zeriab Huggins! Veteran

    Messages:
    1,198
    Likes Received:
    1,248
    First Language:
    English
    Primarily Uses:
    RMXP
    I have updated the links to point to a new version of the tool.


    Previously I checked for *.ttf in a case-sensitive manner. I.e. Hello Kitty.ttf would be picked up, but not I am Mister Roboto.TTF.


    Now searches for *.ttf in a case-insensitive manner.
     
    #5
    Marsigne and Marquise* like this.
  6. Legacy

    Legacy Coding Ninja Member

    Messages:
    12
    Likes Received:
    4
    Location:
    England
    First Language:
    English
    Nice script Zeriab, it's good to see you still working on RMXP :3
     
    #6
    Zeriab and Marsigne like this.
  7. Marquise*

    Marquise* Veteran Veteran

    Messages:
    4,520
    Likes Received:
    7,819
    First Language:
    French-Canadian
    Hello Kitty, Mr Roboto LOL  I like the toutch!
     
    #7
    Zeriab and Marsigne like this.
  8. Zeriab

    Zeriab Huggins! Veteran

    Messages:
    1,198
    Likes Received:
    1,248
    First Language:
    English
    Primarily Uses:
    RMXP
    Thank you :3


    I still enjoy working with RMXP from time to time.
     
    Last edited by a moderator: Nov 21, 2016
    #8
    Marquise* likes this.
  9. Marquise*

    Marquise* Veteran Veteran

    Messages:
    4,520
    Likes Received:
    7,819
    First Language:
    French-Canadian
    I understand... I miss my Amiga!  ;)
     
    #9
    Zeriab likes this.
  10. Snufkin

    Snufkin Sniff Member

    Messages:
    3
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMXP
    Thanks
     
    Last edited: Oct 6, 2017
    #10
    Zeriab likes this.
  11. Samno911

    Samno911 GMD Member

    Messages:
    7
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RM2k3
    Some of the images on the page are broken, but I should be able to figure out how it all runs with some experimentation. I tried following the directions on the page, but my fonts still aren't visible. I am using a message script, but it actually has a demo that is able to switch fonts, so I don't think that is an issue. I used the launcher to open the game, but my fonts are still invisible. I am using a .ttf and i installed it for good measure, is there a specific way I need to call the font inside the game?
     
    Last edited: Dec 14, 2018
    #11
    Marquise* likes this.

Share This Page