Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Changing default font

hey err.. a really quick one

i need to change the font halfway through my dialog.
now in main, i've stated:
Code:
    Font.default_name = $fontface = $defaultfonttype = "Fixedsys Excelsior 2.00"

    Font.default_size = $fontsize = $defaultfontsize = 30
is it possible to use a script call to change it to another font?
 
i've tried
Code:
    Font.default_name = "Tahoma"
and
Code:
    $fontface = "Tahoma"

but it doesnt work

please help?
(i'll give you a cookie)
 
i found the section, its:
Code:
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

# Ultimate Font Override by Blizzard

# Version: 1.02b

# Type: Project-Script Compatibility Improvement

# Date: 19.10.2006

# Date v1.01b: 30.7.2007

# Date v1.02b: 15.11.2008

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

# 

#   You can change the font/fontsize with the "Call script" event command or

#   directly through a script by using these methods:

# 

#     $game_system.fontname = "FONTNAME"

#     $game_system.fontsize = FONTSIZE

# 

#   It will override the font from any RMXP version. It is also possible to

#   change the font during the game. It will be saved, too.

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

 

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

# START Configuration

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

 

Font.default_name = 'Fixedsys Excelsior 2.00' # default font name

Font.default_size = 30                        # default font size

 

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

# END Configuration

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

 

#==============================================================================

# Game_System

#==============================================================================

 

class Game_System

  

  attr_reader :fontname

  attr_reader :fontsize

  

  alias init_ultimate_font_override_later initialize

  def initialize

    init_ultimate_font_override_later

    self.fontname = Font.default_name

    self.fontsize = Font.default_size

  end

  

  def fontname=(name)

    Font.default_name = $defaultfonttype = $fontface = @fontname = name

  end

    

  def fontsize=(size)

    Font.default_size = $defaultfontsize = $fontsize = @fontsize = size

  end

  

end

 

#==============================================================================

# Bitmap

#==============================================================================

 

class Bitmap

 

  alias init_font_override_later initialize

  def initialize(w, h = nil)

    if w.is_a?(Numeric) && h.is_a?(Numeric)

      init_font_override_later(w, h)

    else

      init_font_override_later(w)

    end

      if $game_system != nil && $game_system.fontname != nil &&

          !$scene.is_a?(Scene_Title)

        self.font.name = $game_system.fontname

        self.font.size = $game_system.fontsize

      else

        self.font.name = Font.default_name

        self.font.size = Font.default_size

      end

    end

  end

 
i pasted that above main, in a seperate script thingy,
and i did a script call using
Code:
$game_system.fontname = "Tahoma"

$game_system.fontsize = 24521
but it didnt work :<

what am i doing wrong?
 
I'm not sure. I shrinked the code to this, and it works for me:
[rgss]Font.default_name = 'Fixedsys Excelsior 2.00'             # default font name
Font.default_size = 30                        # default font size    
 
class Game_System
  attr_reader :fontname
  attr_reader :fontsize
  alias init_game_system_later initialize
  def initialize
    init_game_system_later
    self.fontname = Font.default_name
    self.fontsize = Font.default_size
  end
 
  def fontname=(name)
    Font.default_name = $defaultfonttype = $fontface = @fontname = name
  end
   
  def fontsize=(size)
    Font.default_size = $defaultfontsize = $fontsize = @fontsize = size
  end
 
end
[/rgss]
 
well it works in a way that the default font is changed to the fixedsys one
but i already knew how to do that..
now i need to change it to whatever, tahoma or something, midway through an event
and it still doesnt work :<

maybe its another script that fuqs it up, lemme test that for a bit......
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top