custom font which is NOT pre-installed in a computer

Started by godsrighthand, June 26, 2009, 10:08:01 am

Previous topic - Next topic

godsrighthand

RMXP
--------------------------------------------------
How do i get <subject of post> to work in a game
It must work in messages. ( all other areas like menu etc are optional )
Does the user have to install it??
Is there any message script that can do this??
--------------------------------------------------
the font is " Abaddon "
My fav sayings
---My god carries a hammer. Your god died nailed to a tree. Any questions?
---When I die, I want to go peacefully like my Grandfather did, in his sleep -- not screaming, like the passengers in his car.
---War doesn't determine who's right. War determines who's left.
---I don't suffer from insanity. I enjoy every minute of it.
---I intend to live forever, or die trying.

Arkaea Halfdemon

Blizzard's Ultimate Font Override in Tons of Addons should do the trick. Make sure you include the font in the download folder when you export your project, though.

godsrighthand

My fav sayings
---My god carries a hammer. Your god died nailed to a tree. Any questions?
---When I die, I want to go peacefully like my Grandfather did, in his sleep -- not screaming, like the passengers in his car.
---War doesn't determine who's right. War determines who's left.
---I don't suffer from insanity. I enjoy every minute of it.
---I intend to live forever, or die trying.

Aqua


godsrighthand

Quote from: Aqua on June 26, 2009, 12:15:18 pm
You can get an auto-font installer script.


i did find one though i did not understand how to use it
http://www.rmxp.org/forums/viewtopic.php?t=2622

it says place it in script directory but scripts are stored in an encrypted format ( RPGXP data )
My fav sayings
---My god carries a hammer. Your god died nailed to a tree. Any questions?
---When I die, I want to go peacefully like my Grandfather did, in his sleep -- not screaming, like the passengers in his car.
---War doesn't determine who's right. War determines who's left.
---I don't suffer from insanity. I enjoy every minute of it.
---I intend to live forever, or die trying.

Blizzard

June 26, 2009, 12:58:50 pm #5 Last Edit: June 26, 2009, 01:01:22 pm by Blizzard
You can use mine.

#==============================================================================
# Scene_Title
#==============================================================================

Fontfiles = [
   'Impressed.ttf',
   'Future.ttf',
   'Papyrus.ttf',
   'CopperPlate-Normal.ttf',
   'Brush.ttf',
   'Geometrix.ttf',
   'LED_REAL.ttf',
   'EurostileExtended-Roman-DTC.ttf'
   ]
Fontnames = [
   'Impressed',
   'Future',
   'Papyrus',
   'CopperPlate-Normal',
   'Brush Script',
   'Geometrix',
   'LED Real',
   'EurostileExtended-Roman-DTC'
   ]
         
class Scene_Title
 
 alias main_ifa_later main
 def main
   font = CP.fonts_load
   CP.data_save(font)
   unless font
     str = ENV['SystemRoot'].sub('WINNT', '')
     win = ENV['SystemRoot'].dup.sub(str, '')
     if win == 'WINNT'
       p 'The game found a possible problem while initializing the ' +
          'font installer. Please install these fonts manually if problems occur.'
     end
     install = Win32API.new('gdi32', 'AddFontResource', ['P'], 'L')
     acknowledge_WINDOZE = Win32API.new('kernel32', 'WriteProfileString', ['P'] * 3, 'L')
     acknowledge_user = Win32API.new('user32', 'SendMessage', ['L'] * 4, 'L')
     _SourceF = 'Fontfiles\\'
     _WINFonts = ENV['SystemRoot'] + '\\Fonts\\'
     succeeded, failed, missing = [], [], []
     Fontfiles.each_index {|i|
         font = Fontfiles[i]
         if FileTest.exists?(_SourceF + font)
           if FileTest.exists?(_WINFonts + font) &&
               FileTest.size(_WINFonts + font) == FileTest.size(_SourceF + font)
             next
           end
           FileUtils.copy(_SourceF + font, _WINFonts + font)
           install.call(_SourceF + font)
           acknowledge_WINDOZE.call('Fonts', Fontnames[i], font)
           acknowledge_user.call(0xFFFF, 0x001D,0,0)
           if FileTest.exists?(_WINFonts + font)
             succeeded.push(Fontnames[i])
           else
             failed.push(font)
           end
         else
           missing.push(font)
         end}
     succeeded_fonts = succeeded[0]
     (1...succeeded.size).each {|i| succeeded_fonts += ', ' + succeeded[i]}
     unless succeeded_fonts == nil
       p "Installed following fonts: #{succeeded_fonts}"
     end
     failed_fonts = failed[0]
     (1...failed.size).each {|i| failed_fonts += ', ' + failed[i]}
     unless failed_fonts == nil
       p "Could not install following fontfiles: #{failed_fonts}" +
         '. Please install these fonts manually.'
     end
     missing_fonts = missing[0]
     (1...missing.size).each {|i| missing_fonts += ', ' + missing[i]}
     unless missing_fonts == nil
       p "Could not find following fontfiles: #{missing_fonts}"
     end
     unless succeeded_fonts == nil
       p 'New fonts were installed. Restarting the game now. If you ' +
         'experience any problems, please manually install the fonts by ' +
         "copying the font files located in #{_SourceF}" +
         " folder into your #{_WINFonts} folder and/or restaring your PC."
       Thread.new {system('Game')}
       exit
     end
   end
   main_ifa_later
 end
 
end


Just define font filenames and font names on top. All your fontfiles should be located in a folder called "Fontfiles" in the game's main folder. Keep in mind that I don't officially support this script as I made it for my own game only.

You need Fileutils as well. I did not make Fileutils. (But I think that I did remove the stuff I don't need because I don't remember it being that short. o.o; )

# 
# = fileutils.rb
#
# Copyright (c) 2000-2005 Minero Aoki <aamine@loveruby.net>
#
# This program is free software.
# You can distribute/modify this program under the same terms of ruby.
#
# == module FileUtils
#

module FileUtils

 def self.private_module_function(name)   #:nodoc:
   module_function name
   private_class_method name
 end

 OPT_TABLE = {}   #:nodoc: internal use only
 
 def copy(src, dest, options = {})
   fu_check_options options, :preserve, :noop, :verbose
   fu_output_message "cp#{options[:preserve] ? ' -p' : ''} #{[src,dest].flatten.join ' '}" if options[:verbose]
   return if options[:noop]
   fu_each_src_dest(src, dest) do |s, d|
     copy_file s, d, options[:preserve]
   end
 end
 module_function :copy

 OPT_TABLE['copy'] = %w( noop verbose preserve )

 def fu_check_options(options, *optdecl)   #:nodoc:
   h = options.dup
   optdecl.each do |name|
     h.delete name
   end
   raise ArgumentError, "no such option: #{h.keys.join(' ')}" unless h.empty?
 end
 private_module_function :fu_check_options
 
 def fu_each_src_dest(src, dest)   #:nodoc:
   fu_each_src_dest0(src, dest) do |s, d|
     raise ArgumentError, "same file: #{s} and #{d}" if fu_same?(s, d)
     yield s, d
   end
 end
 private_module_function :fu_each_src_dest

 def fu_each_src_dest0(src, dest)   #:nodoc:
   if src.is_a?(Array)
     src.each do |s|
       s = s.to_str
       yield s, File.join(dest, File.basename(s))
     end
   else
     src = src.to_str
     if File.directory?(dest)
       yield src, File.join(dest, File.basename(src))
     else
       yield src, dest.to_str
     end
   end
 end
 private_module_function :fu_each_src_dest0

 def fu_same?(a, b)   #:nodoc:
   if fu_have_st_ino?
     st1 = File.stat(a)
     st2 = File.stat(b)
     st1.dev == st2.dev && st1.ino == st2.ino
   else
     File.expand_path(a) == File.expand_path(b)
   end
 rescue Errno::ENOENT
   return false
 end
 private_module_function :fu_same?

 def fu_have_st_ino?   #:nodoc:
   !fu_windows?
 end
 private_module_function :fu_have_st_ino?

 def copy_file(src, dest, preserve = false, dereference = true)
   ent = Entry_.new(src, nil, dereference)
   ent.copy_file dest
   ent.copy_metadata dest if preserve
 end
 module_function :copy_file

 module StreamUtils_
 
   private
   
   def fu_windows?
     /mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM
   end
 
   def fu_copy_stream0(src, dest, blksize)   #:nodoc:
     # FIXME: readpartial?
     while s = src.read(blksize)
       dest.write s
     end
   end

   def fu_blksize(st)
     s = st.blksize
     return nil unless s
     return nil if s == 0
     s
   end

   def fu_default_blksize
     1024
   end

 end

 include StreamUtils_
 extend StreamUtils_

 class Entry_   #:nodoc: internal use only
   include StreamUtils_

   def initialize(a, b = nil, deref = false)
     @prefix = @rel = @path = nil
     if b
       @prefix = a
       @rel = b
     else
       @path = a
     end
     @deref = deref
     @stat = nil
     @lstat = nil
   end
   
   def copy_file(dest)
     st = stat()
     File.open(path(),  'rb') {|r|
       File.open(dest, 'wb', st.mode) {|w|
         fu_copy_stream0 r, w, (fu_blksize(st) || fu_default_blksize())
       }
     }
   end

   def copy_metadata(path)
     st = lstat()
     File.utime st.atime, st.mtime, path
     begin
       File.chown st.uid, st.gid, path
     rescue Errno::EPERM
       # clear setuid/setgid
       File.chmod st.mode & 01777, path
     else
       File.chmod st.mode, path
     end
   end
 
   def stat
     return @stat if @stat
     if lstat() && lstat().symlink?
       @stat = File.stat(path())
     else
       @stat = lstat()
     end
     @stat
   end
   
   def lstat
     if dereference?
       @lstat ||= File.stat(path())
     else
       @lstat ||= File.lstat(path())
     end
   end

   def dereference?
     @deref
   end
 
   def path
     if @path
       @path.to_str
     else
       join(@prefix, @rel)
     end
   end

   
 end

end
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

godsrighthand

Thanks
If its your script i should have no problem with it :)
Ill try it out first thing in the morning
My fav sayings
---My god carries a hammer. Your god died nailed to a tree. Any questions?
---When I die, I want to go peacefully like my Grandfather did, in his sleep -- not screaming, like the passengers in his car.
---War doesn't determine who's right. War determines who's left.
---I don't suffer from insanity. I enjoy every minute of it.
---I intend to live forever, or die trying.

Blizzard

Lol, no, it's not my first script. It's just a script that I never released. This actually isn't even the exact version I use in my game. In my game the words "the game", etc. in the messages are replaces by "Chaos Project" and there are also German messages. And I'm not running it in Scene_Title, but in Scene_StormTronics. xD
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Hellfire Dragon

QuoteLol, no, it's not my first script.

he never said it was your first script, he said he'll try it first thing in the morning :P

Blizzard

Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

fugibo


godsrighthand

Its not working
in the game no text appears at all

what i did::
I put in abaddon.ttf in "Fontfiles" folder within the main game folder
I inserted your scripts above main (first the fileutils )
I defined the font as abaddon.ttf and the fontname as Abaddon
Then i used ultimate font override and configured it like so
Font.default_name = 'Abaddon' # default font name
Font.default_size = 24      # default font size

PS: what was your first script??
My fav sayings
---My god carries a hammer. Your god died nailed to a tree. Any questions?
---When I die, I want to go peacefully like my Grandfather did, in his sleep -- not screaming, like the passengers in his car.
---War doesn't determine who's right. War determines who's left.
---I don't suffer from insanity. I enjoy every minute of it.
---I intend to live forever, or die trying.

Blizzard

Quote from: Blizzard on June 26, 2009, 12:58:50 pm
All your fontfiles should be located in a folder called "Fontfiles" in the game's main folder.


My first script was a credits script. It's been turned into the Picture Scene from Tons later.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Ryex

Quote from: godsrighthand on June 26, 2009, 10:50:02 pm
I put in abaddon.ttf in "Fontfiles" folder within the main game folder

did you not see that line
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Blizzard

>.<

@godsrighthand: Did you use an old save game or did you start a new game? Is the font installed at all? If it's installed, try first deinstalling it manually (just delete it from the WINDOWS\Fonts folder). Try to let the installer install the font. Then try it vice versa. Uninstall the font and install it manually. Maybe something isn't right. i.e. the font might not be called Abbadon. You can check the real font name by opening Paint and trying to use the text tool.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

godsrighthand

method 1-manual install, using ultimate font override
method 2-using your script, using ultimate font override
neither work
I get an error message

Script 'TOA 2' line 1208: RGSSError Occured
Failed to create bitmap



My fav sayings
---My god carries a hammer. Your god died nailed to a tree. Any questions?
---When I die, I want to go peacefully like my Grandfather did, in his sleep -- not screaming, like the passengers in his car.
---War doesn't determine who's right. War determines who's left.
---I don't suffer from insanity. I enjoy every minute of it.
---I intend to live forever, or die trying.

Blizzard

Remove Tons temporarily, another script is messing up something.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

godsrighthand

If i remove tons ( ultimate font override) how do i use the fonts ingame??
My fav sayings
---My god carries a hammer. Your god died nailed to a tree. Any questions?
---When I die, I want to go peacefully like my Grandfather did, in his sleep -- not screaming, like the passengers in his car.
---War doesn't determine who's right. War determines who's left.
---I don't suffer from insanity. I enjoy every minute of it.
---I intend to live forever, or die trying.

G_G


Blizzard

Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

godsrighthand

Quote from: Blizzard on June 28, 2009, 08:25:53 am
Quote from: Blizzard on June 27, 2009, 01:19:25 pm
Remove Tons temporarily, another script is messing up something.



i understand that but if i do that how do i use the font?? I mean if i remove TOA how can i tell RMXP to use a new font?? I dont understand you, please elaborate 
My fav sayings
---My god carries a hammer. Your god died nailed to a tree. Any questions?
---When I die, I want to go peacefully like my Grandfather did, in his sleep -- not screaming, like the passengers in his car.
---War doesn't determine who's right. War determines who's left.
---I don't suffer from insanity. I enjoy every minute of it.
---I intend to live forever, or die trying.

Blizzard

Quote from: godsrighthand on June 27, 2009, 08:52:04 am
method 1-manual install, using ultimate font override
method 2-using your script, using ultimate font override
neither work
I get an error message

Script 'TOA 2' line 1208: RGSSError Occured
Failed to create bitmap


This error isn't caused by Tons of Add-ons. Don't you think it would have been faster to simply do it instead of repeatedly questioning? :P
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

godsrighthand

Tried it

RESULT- No error came
            The default font was used

I think the error is with tons
My fav sayings
---My god carries a hammer. Your god died nailed to a tree. Any questions?
---When I die, I want to go peacefully like my Grandfather did, in his sleep -- not screaming, like the passengers in his car.
---War doesn't determine who's right. War determines who's left.
---I don't suffer from insanity. I enjoy every minute of it.
---I intend to live forever, or die trying.

Blizzard

That error came up because a script tried to create a bitmap with 0 width and/or height. As far as I know that has pretty much nothing to do with fonts.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

godsrighthand

your right another script is messing up something. i tried other methods to get custom fonts they dont work either. Ill try to find out which script it is
Thanks for your help
My fav sayings
---My god carries a hammer. Your god died nailed to a tree. Any questions?
---When I die, I want to go peacefully like my Grandfather did, in his sleep -- not screaming, like the passengers in his car.
---War doesn't determine who's right. War determines who's left.
---I don't suffer from insanity. I enjoy every minute of it.
---I intend to live forever, or die trying.

GAX

By any chance are you using Vista?

Put simple, Vista's bullshit oversecurity will NOT allow an RMXP script to install fonts.  It's bullshit, I know, but sadly Micro$haft isn't nice to ANYONE.

Rule 2: ShowHide
Quote from: Rule No.2Keep your signatures at reasonable size. The pictures in your signature may altogether be no more than 200kB and take up an area of 1600px2. That means 2 pictures of 400x200 are fine, one picture of 800x200 is fine and so on. Also your pictures height must not exceed 200 pixels, width can be as big as you want as long as your pictures match the other criteria. Every signature not matching this criteria is a subject of the moderator team to remove and leave this rule as message in your signature.

Aqua


Subsonic_Noise

June 30, 2009, 12:21:39 pm #27 Last Edit: June 30, 2009, 12:23:04 pm by Subsonic_Noise
Quote from: Badou Nails on June 30, 2009, 05:16:38 am
By any chance are you using Vista?

Put simple, Vista's bullshit oversecurity will NOT allow an RMXP script to install fonts.  It's bullshit, I know, but sadly Micro$haft isn't nice to ANYONE.

WOW This means I must have some special edition because it worked nice on my PC >.>
Please people, stop dissing Vista, it isn't that bad. In fact, I've been using Vista x64 for some time now
and I never had a virus or a crash or any compatibility problem execept for some freeware programs.
But that also could be because of my special edition. -_-

Sorry for Offtopic but I had to say this.

EDIT: I did not want to insult you, I hope that's clear.

godsrighthand

If i break any rules I apologize in advance

No i am not using vista
I only use xp and ubuntu
Vista sucks Donkey balls
My fav sayings
---My god carries a hammer. Your god died nailed to a tree. Any questions?
---When I die, I want to go peacefully like my Grandfather did, in his sleep -- not screaming, like the passengers in his car.
---War doesn't determine who's right. War determines who's left.
---I don't suffer from insanity. I enjoy every minute of it.
---I intend to live forever, or die trying.