This script is pretty easy to use, now first off the script must be placed under Materials like most other scripts.
Take note that a example font name is being used so please change the font name in the script before using or
it will not work and will pop up an error. After changing the font name to what ever font you have installed on your
PC 'Arial' being default, the script will change all fonts menu and message windows to the selected font.
This script has compatibility with "NMS - Neo Message System". When used with the NMS, this
script will only change menu fronts letting you have duel fonts with no error. Just be sure to have NMS above this
script on your script list. NMS 3.0 was used, but 2.0 should work with no compatibility issues.
=begin
~Menu Font Changer~
*Credit to Thomas1*
No credit needed for any use of this script, but if you want to go for it.
=end
module Menu_Config
# Change 'Knights Quest' below to 'Arial' for a default font.
# Anything else you enter in must be a font you have installed.
# This font will affect your main and battle menus and even message windows.
DEFAULT_FONT = 'Knights Quest'
# Set this to true to enable the font above for all windows,
# also sets the back_opacity to 255 for all windows and
# I recommend setting this to 'true' to maintain a consistent look.
USE_FOR_ALL = true
end
if Menu_Config::USE_FOR_ALL
Font.default_name = Menu_Config::DEFAULT_FONT
class Window_Base < Window
alias :eds_pre_menu_base_initialize :initialize
def initialize(*fats)
eds_pre_menu_base_initialize(*fats)
end
end
end
class Window_Base < Window
CAPTION_COLOR = Color.new(255,255,255)#(228, 228, 228)
CAPTION_HEIGHT = 12
X_OFFSET = 16
Y_OFFSET = -5
alias :eds_pre_window_caption_intialize :initialize
def initialize(*fats)
eds_pre_window_caption_intialize(*fats)
@caption_sprite = Sprite_Base.new(self.viewport)
create_caption_bitmap(1, CAPTION_HEIGHT)
@caption_sprite.x = self.x + X_OFFSET
@caption_sprite.y = self.y + Y_OFFSET
@caption_sprite.z = self.z + 1
end
def x=(value)
super
@caption_sprite.x = value + X_OFFSET unless @caption_sprite.nil?
end
def y=(value)
super
@caption_sprite.y = value + Y_OFFSET unless @caption_sprite.nil?
end
def z=(value)
super
@caption_sprite.z = value + 1 unless @caption_sprite.nil?
end
def caption=(text)
return unless text.is_a?(String)
return if text.empty?
@caption = text
width = @caption_sprite.bitmap.text_size(@caption).width
create_caption_bitmap(width, CAPTION_HEIGHT)
draw_caption
end
def create_caption_bitmap(w, h)
@caption_sprite.bitmap = Bitmap.new(w, h)
@caption_sprite.bitmap.font.size = 12
@caption_sprite.bitmap.font.color = CAPTION_COLOR
@caption_sprite.bitmap.font.bold = true
end
def draw_caption
unless @caption.nil?
h = @caption_sprite.bitmap.height
w = @caption_sprite.bitmap.width
rect = Rect.new( 0, h / 2, w, h / 4 )
@caption_sprite.bitmap.fill_rect(rect, Color.new(0, 0, 0, 96))
@caption_sprite.bitmap.draw_text(@caption_sprite.src_rect, @caption)
end
end
alias :eds_pre_caption_window_dispose :dispose
def dispose
eds_pre_caption_window_dispose
@caption_sprite.dispose
end
def find_window_width(text)
return Bitmap.new(544, 416).text_size(text).width + 32
end
end