Help - Search - Members - Calendar
Full Version: how to get Custom font?
RPG RPG Revolution Forums > Game Engines > RPG Maker XP Discussion
JamesBlackwing
im working ona project in rpg maker xp andi want to add my custom font, im currently useing the UMS script to change the font but if i comple it and installit on another computer the game cease to display text, ive trying includeing my fonts .ttf file in the project folder butit dosent seem to make use if it.

how do i get around this without haveing to direct people into the games dirctory and copyit onto their windows system font folder?
Kiriashi
Go to the "Main" section in your scripts.


Press return after the word "begin" and add the following:

CODE
# Default font face
Font.default_name = "Verdana"
# Default font size
Font.default_size = 22


Change the word Verdana to the name of the font you want to make the default.

You can also change the font size.
Decedent
I've tried two games so far that had a dif font, and all I had to do was right click and select install? Even if that is only for new operating systems, I don't think you can get around the problem of people having to install the font in some fashion by themselves.
stripe103
Actually, this one would be better since I think that there are scripts that use other variables for changing the font
CODE
# Default font face
$defaultfonttype = $fontface = $fontname = Font.default_name = "Verdana"
# Default font size
$defaultfontsize = $fontsize = Font.default_size = 22

Oh and also, If there are scripts that don't change the font to the one you wanted, try looking for the line
CODE
self.contents.font.name


EDIT:
QUOTE (Decedent @ Jul 14 2010, 10:36 AM) *
I don't think you can get around the problem of people having to install the font in some fashion by themselves.

That is not true. If you create your own installer you can make it install the font file.
Or you could use a batch script or something like this one I created a while ago.
Batch Script
CODE
@echo off
::Batch Font Installer 1.2
::Made by Stripe103
::stripe103@hotmail.com
title Font Installer 1.2 - By Stripe103
echo Checking whether there is fonts in the current directory or not.
if exist *.fon (set fon=true)
if exist *.fnt (set fnt=true)
if exist *.otf (set otf=true)
if exist *.ttc (set ttc=true)
if exist *.ttf (set ttf=true)
if /i {%fon%}=={true} (goto :exist)
if /i {%fnt%}=={true} (goto :exist)
if /i {%otf%}=={true} (goto :exist)
if /i {%ttc%}=={true} (goto :exist)
if /i {%ttf%}=={true} (goto :exist)
goto :missing

:exist
color 2A
cls
echo Font files exist!
echo.
echo Files found:
echo.
if /i {%fon%}=={true} (echo FON:
dir *.fon /b
echo.)
if /i {%fnt%}=={true} (echo FNT:
dir *.fnt /b
echo.)
if /i {%otf%}=={true} (echo OTF:
dir *.otf /b
echo.)
if /i {%ttc%}=={true} (echo TTC:
dir *.ttc /b
echo.)
if /i {%ttf%}=={true} (echo TTF:
dir *.ttf /b
echo.)
echo Hit any key to begin install...
pause>nul
color 07
echo ==================================================================
echo.
if /i {%fon%}=={true} (copy /V *.fon %windir%\Fonts\
echo.)
if /i {%fnt%}=={true} (copy /V *.fnt %windir%\Fonts\
echo.)
if /i {%otf%}=={true} (copy /V *.otf %windir%\Fonts\
echo.)
if /i {%ttc%}=={true} (copy /V *.ttc %windir%\Fonts\
echo.)
if /i {%ttf%}=={true} (copy /V *.ttf %windir%\Fonts\)
goto :finished

:missing
color 4C
cls
echo There are no font files in the current directory...
echo.
echo Leave blank to close...
echo.
echo.
goto :fonts
exit

:fonts
echo These are the supported filetypes
echo.
echo Extension       File Description                         Populatity
echo ====================================================================
echo .FNT            Windows Font File                        Very Common
echo .FON            Generic Font File                        Very Common
echo .OTF            OpenType Font                            Very Common
echo .TTC            TrueType Font Collection                 Average
echo .TTF            TrueType Font                            Very Common
echo ====================================================================
echo.
echo Hit any key to close the window...
pause>nul
exit

:finished
color 2A
echo.
echo ==================================================================
echo Copying finished!
echo Hit any key to close the program or just hit X.
pause>nul
exit
It searches the current folder for files with the extensions FNT, FON, OTF, TTC or TTF and then copies the files found into the font folder on your computer. I've only tested it with XP and Win 7 and it only worked with XP but I'm trying to fix that.
Awakened Owl
Can you make a temporary font, so like their is a different font when you are reading a book than when you talk to someone?
JamesBlackwing
quote
QUOTE (stripe103 @ Jul 14 2010, 09:38 AM) *
Actually, this one would be better since I think that there are scripts that use other variables for changing the font
CODE
# Default font face
$defaultfonttype = $fontface = $fontname = Font.default_name = "Verdana"
# Default font size
$defaultfontsize = $fontsize = Font.default_size = 22

Oh and also, If there are scripts that don't change the font to the one you wanted, try looking for the line
CODE
self.contents.font.name


EDIT:
QUOTE (Decedent @ Jul 14 2010, 10:36 AM) *
I don't think you can get around the problem of people having to install the font in some fashion by themselves.

That is not true. If you create your own installer you can make it install the font file.
Or you could use a batch script or something like this one I created a while ago.
Batch Script
CODE
@echo off
::Batch Font Installer 1.2
::Made by Stripe103
::stripe103@hotmail.com
title Font Installer 1.2 - By Stripe103
echo Checking whether there is fonts in the current directory or not.
if exist *.fon (set fon=true)
if exist *.fnt (set fnt=true)
if exist *.otf (set otf=true)
if exist *.ttc (set ttc=true)
if exist *.ttf (set ttf=true)
if /i {%fon%}=={true} (goto :exist)
if /i {%fnt%}=={true} (goto :exist)
if /i {%otf%}=={true} (goto :exist)
if /i {%ttc%}=={true} (goto :exist)
if /i {%ttf%}=={true} (goto :exist)
goto :missing

:exist
color 2A
cls
echo Font files exist!
echo.
echo Files found:
echo.
if /i {%fon%}=={true} (echo FON:
dir *.fon /b
echo.)
if /i {%fnt%}=={true} (echo FNT:
dir *.fnt /b
echo.)
if /i {%otf%}=={true} (echo OTF:
dir *.otf /b
echo.)
if /i {%ttc%}=={true} (echo TTC:
dir *.ttc /b
echo.)
if /i {%ttf%}=={true} (echo TTF:
dir *.ttf /b
echo.)
echo Hit any key to begin install...
pause>nul
color 07
echo ==================================================================
echo.
if /i {%fon%}=={true} (copy /V *.fon %windir%\Fonts\
echo.)
if /i {%fnt%}=={true} (copy /V *.fnt %windir%\Fonts\
echo.)
if /i {%otf%}=={true} (copy /V *.otf %windir%\Fonts\
echo.)
if /i {%ttc%}=={true} (copy /V *.ttc %windir%\Fonts\
echo.)
if /i {%ttf%}=={true} (copy /V *.ttf %windir%\Fonts\)
goto :finished

:missing
color 4C
cls
echo There are no font files in the current directory...
echo.
echo Leave blank to close...
echo.
echo.
goto :fonts
exit

:fonts
echo These are the supported filetypes
echo.
echo Extension       File Description                         Populatity
echo ====================================================================
echo .FNT            Windows Font File                        Very Common
echo .FON            Generic Font File                        Very Common
echo .OTF            OpenType Font                            Very Common
echo .TTC            TrueType Font Collection                 Average
echo .TTF            TrueType Font                            Very Common
echo ====================================================================
echo.
echo Hit any key to close the window...
pause>nul
exit

:finished
color 2A
echo.
echo ==================================================================
echo Copying finished!
echo Hit any key to close the program or just hit X.
pause>nul
exit
It searches the current folder for files with the extensions FNT, FON, OTF, TTC or TTF and then copies the files found into the font folder on your computer. I've only tested it with XP and Win 7 and it only worked with XP but I'm trying to fix that.


tyed your batch script it just seems to crash on me when ever i try to run the game.. ive looked about for thigns to make custominstall fileds but ive yet to find software that lets you include the text file and set it up
stripe103
Okay, I guess it only work on some computers then. Anyway, as I mentioned, you can make your own installer as well.
There is this tool ClickTeam Install Creator which you can make installers in.
Really good. Though I haven't found any use in it yet.
Rukiri
I can't remember who made it but at HBGames their was a custom install font script, though this may help.

CODE
#==============================================================================
# ** Auto Font Install
#------------------------------------------------------------------------------
# Wachunga
# Version 1.0
# 2006-01-07
#------------------------------------------------------------------------------
=begin

Automatically installs one or more fonts so the player doesn't have to. It
only does this the first time the game is run and the process is quite
transparent (notification to the player is optional).

Thanks to MagicMagor for the pointer to one of the Win32 functions.

FEATURES
- handles installation of fonts so players don't have to
- supports multiple fonts
- process is quite transparent

SETUP
Create a Fonts folder in the game directory and place all fonts to be
installed within. Then update the Filenames and Names constants below,
adding an element to both arrays for each font.

This just installs the fonts. You'll still have to refer to them as necessary,
e.g. setting a new default as follows (in main):
Font.default_name = [Fonts::Names[0], 'MS PGothic']


This script requires the SDK available from:
http://www.rmxp.net/forums/index.php?&showtopic=31096

(To remove this dependency, just delete the three SDK-labeled lines,
including the 'end' at the bottom of the script.)

Note: if player does not have the rights to install fonts on their machine,
this probably won't work -- but then they wouldn't be able to do it manually
either. :)

#------------------------------------------------------------------------------
=end

module Fonts

# filenames of fonts to be in stalled
Filenames = ['RetGanon.ttf']
# e.g. Filenames = ['carbono_pw.ttf','FUTRFW.TTF']

# names (not filenames) of fonts to be installed
Names = ['Return of Ganon']
# e.g. Names = ['carbono', 'Futurist Fixed-width']

# whether to notify player (via pop-up message) that fonts were installed
Notify = false

# location of fonts (relative to game folder)
Source = 'Fonts/'

# location of fonts after installation
Dest = ENV['SystemRoot'] + '\Fonts\\'

end

class Scene_Title

AFR = Win32API.new('gdi32', 'AddFontResource', ['P'], 'L')
WPS = Win32API.new('kernel32', 'WriteProfileString', ['P'] * 3, 'L')
SM = Win32API.new('user32', 'SendMessage', ['L'] * 4, 'L')
WM_FONTCHANGE = 0x001D
HWND_BROADCAST = 0xffff

alias wachunga_autofontinstall_st_main main
def main
success = []

for i in 0...Fonts::Filenames.size
f = Fonts::Filenames[i]
# check if already installed...
if not FileTest.exists?(Fonts::Dest + f)

# check to ensure font is in specified location...
if FileTest.exists?(Fonts::Source + f)
# move file to fonts folder
File.rename(Fonts::Source + f, Fonts::Dest + f)
# add font resource
AFR.call(Fonts::Dest + f)
# add entry to win.ini/registry
WPS.call('Fonts', Fonts::Names[i] + ' (TrueType)', f)
SM.call(HWND_BROADCAST,WM_FONTCHANGE,0,0)
if FileTest.exists?(Fonts::Dest + f)
success.push(Fonts::Names[i])
else
p 'Auto Font Install: failed to install' + Fonts::Names[i] + '.'
end
else
p 'Auto Font Install: font ' + f + ' not found.'
end

end
end

if success != [] # one or more fonts successfully installed
if Fonts::Notify
fonts = ''
success.each do |f|
fonts << f << ', '
end
p 'Auto Font Install: sucessfully installed ' + fonts[0..-3]
end
# new fonts aren't recognized in RMXP until the program is
# restarted, so this is (unfortunately) necessary
a = Thread.new { system('Game') }
exit
end
wachunga_autofontinstall_st_main
end

end
stripe103
Yea that works too but when the game is deleted, the font isn't. If you use a installer, you can make it uninstall the font.
Rukiri
The fonts in the game directory, delete the game manually.
stripe103
CODE
# location of fonts after installation
Dest = ENV['SystemRoot'] + '\Fonts\\'

Nope, the script copies the font into the font folder of your computer.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.