Font Draw Method Tutorial

An expanded version of this scriptlet will be put into the Bitmap Add-Ons script (for RMXP, VX and VXA) soon.

Font is a property of the Bitmap class, so whenever you need to call on a font property in a window, it will be preceded by self.contents., so as an example: = “Arial”

will change the contents font name to "Arial" on the window’s Bitmap.

Font (with a capital F) will globally change the font settings, but because it’s a Bitmap property.

The following scriptlet will show how the font properties can be used in a single method (draw_font) to make drawing fonts easier.

# ** Window_Base
class Window_Base < Window
  # * Draw font
  #   bold    : Bold on/off
  #   italic  : Italic on/off
  #   size    : Font size
  #   color   : Font color
  # Example   : draw_font("Arial", 14, false, true, 1)
  def draw_font(name = "MS Gothic", size = 14, bold = false, italic = false, color = 0)
    # Font name and size = name
    self.contents.font.size = size
    # Check bold on (1 or true) or off (0 or false)
    case bold
    when 0, false; self.contents.font.bold = false
    when 1, true; self.contents.font.bold = true
    # Check italic on (1 or true) or off (0 or false)
    case italic
    when 0, false; self.contents.font.italic = false
    when 1, true; self.contents.font.italic = true
    # Change Color
    # If color is set to 0 or 1, "normal" or "system" default colors respectively will be used.
    # Setting color as 2 will randomize the colors, including its alpha properties.
    case color
    when 0; self.contents.font.color = normal_color
    when 1; self.contents.font.color = system_color
    when 2; self.contents.font.color =, rand(255), rand(255), rand(255))
  # * Reset font settings to default
  def reset_fonts
    draw_font(Font.default_name, Font.default_size, 0, 0, 0)

This can then be used as a direct method in the window. There's no need to precede it with self.contents. since it's been defined in Window_Base, on which each window relies.

I've also added reset_fonts, a method to reset the font settings to the defaults. Again this can be placed as a direct method without needing the self.contents. before it.

This works for RMXP, RMVX and RMVXA.