RGSS: Font

Now let’s enrich our previous Hello World demo. Do the following steps:

1-) Open RPG Maker and open the Script Edition (F11).
2-) Delete every piece of code there. Absolutely everything.
3-) Insert a new entry and name it something like “My Program”
4-) Enter the following piece of code in the editor.

[cc lang=”ruby”]

my_font = Font.new(“Arial”, 96)
my_font.color = Color.new(25,150,255)
my_font.bold = true
my_font.italic = true

my_sprite = Sprite.new()
my_sprite.bitmap = Bitmap.new(544, 416)
my_sprite.bitmap.font = my_font
my_sprite.bitmap.draw_text(0, 0, 500, 300, “Hello World!”, 2)

loop do


We created a font object with the Font class, my_font = Font.new(”Arial”, 96). Remember, the font needs to be in the font directory of the project. I wasn’t wrong when I said the RGSS2 Manual is poorly documented. I had to make many attempts to find the font maximum size. The program will crash if it’s bigger than 96.

We used the color property that refers to the Color class, my_font.color = Color.new(25,150,255). We passed 3 values in the parameters, each of them correspond to the RGB color value (Red/Green/Blue). Each value is from 0 to 255. (Values out of range are automatically corrected).

The font can use bold and italic style attributes: my_font.bold = true, my_font.italic = true. By default our font has shadow. If you prefer to remove this shadow you simply specify it with a false value: my_font.shadow = false






Leave a Reply

Your email address will not be published. Required fields are marked *