Advertisement
kurashi

Dynamic Fonts [RGSS3]

Apr 27th, 2016
594
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.69 KB | None | 0 0
  1. =begin
  2.  
  3.   Name: Dynamic Fonts {RGSS3 - VX Ace}
  4.   Creator: KioKurashi
  5.   Usage Requirements: Credits to Kio Kurashi for the script. Can be used
  6.     Comercially or Non-comercially.
  7.    
  8.   Instructions: This script adds a new function to the message command in events.
  9.     The keycode to use is \F[n] where n is the number of the of the place in the
  10.     FONT_NAMES list located below. Fonts must be using their installed Font name
  11.     or the game will not be able to find them. The 0(zero) is reserved as the
  12.     default font "VL Gothic" if you would wish to change the font mid-message.
  13.     The font can be changed as many times in a message as you would like, and
  14.     will always revert to the default for the next message if not explicitly
  15.     defined.
  16.    
  17.     Modify the FONT_NAMES list to the fonts that you desire.
  18.    
  19. =end
  20.  
  21. module CONFIGTEXT
  22.   FONT_NAMES = ["Bodoni MT", "Arial Narrow", "Castellar"]
  23. end
  24.  
  25. #################### Do Not Edit Beyond This Point ############################
  26.  
  27. class Window_Base
  28. include CONFIGTEXT
  29.  
  30. alias :reset_font_without_name :reset_font_settings
  31.   def reset_font_settings
  32.     reset_font_without_name
  33.     contents.font.name = "VL Gothic"
  34.   end
  35.  
  36.   def process_escape_character(code, text, pos)
  37.     case code.upcase
  38.     when 'C'
  39.       change_color(text_color(obtain_escape_param(text)))
  40.     when 'I'
  41.       process_draw_icon(obtain_escape_param(text), pos)
  42.     when '{'
  43.       make_font_bigger
  44.     when '}'
  45.       make_font_smaller
  46.     when 'F'
  47.       alter_font(obtain_escape_param(text))
  48.     end
  49.   end
  50.  
  51.   def alter_font(number)
  52.     number == 0 ? fontname = "VL Gothic" : fontname = FONT_NAMES[number-1]
  53.     contents.font.name = fontname
  54.   end
  55. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement