Wechseln der Font beim xp?
Guten morgen allerseits,
Ich habe ein Problem mit meinem Zelda-Spiel auf dem rmxp: Ich will die Font wechseln.
Ein Script dafür habe ich auch bereits gefunden aber das funktioniert irgendwie nicht (die schrift ist einfach weg wenn ich es einsetze).
Auch bekomme ich eine Fehlermeldung ("undefined method main for scene_title") wenn ich das Script vor scene_title stelle weswegen ich es momentan direkt darunter in einem neuen script eingefügt habe.
Nun meine Fragen:
-Könnte es sein dass das daran liegt dass ich Windows98 nutze?
-Findet ihr einen Fehler im Script?
-Könnte es daran liegen dass das Script mit anderen Scripts von mir (z.B: dubealex´AMS) interferriert?
Und ganz wichtig:
-Kennt ihr ein anderes Script zum Wechseln der Font?
Hier das Script:
Code:
module Fonts
# filenames of fonts to be in stalled
Filenames = ['ReturnofGanon.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 = 'Graphics/Windowskins/'
# location of fonts after installation
#print ENV['Windir'], ENV['SystemRoot']
Dest = ENV['Windir'] + '\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