Font won't change during an event - a fix and a question

Hi guys,

I was trying to use two different fonts in a cutscene, something like:

[IMG]http://i57.tinypic.com/fuvznp.png[/IMG]

Running the event, the font size was actually changed, but not the font itself. After some research I found out why it didn't work. In the Window_Base script:

 #--------------------------------------------------------------------------

  # * Reset Font Settings

  #--------------------------------------------------------------------------

  def reset_font_settings

    change_color(normal_color)

    contents.font.size = Font.default_size

    contents.font.bold = Font.default_bold

    contents.font.italic = Font.default_italic

  end

 

This function completely ignores font name. I fixed it with the following patch:

 

 class Window_Base < Window

 

    alias myfont_reset_font_settings reset_font_settings

    def reset_font_settings

      myfont_reset_font_settings

      

      contents.font.name = Font.default_name

      

    end

  end

  

And now it seems to work as I intended. I'm curious, is there a specific reason why the Window_Base class was designed to ignore changes in font name? Could my fix possibly mess up something else?

 
I've moved this thread to RGSSx Script Support. Please be sure to post your threads in the correct forum next time. Thank you.


Interesting. The default font name is actually an array with several possible entries. It chooses whichever of those it's able to find, checking in order from right to left.


Maybe it assumes you are not going to change the defaults.
Sorry for posting in the wrong forum. 

As for the default value, RM documentation states:

"You can change the default values set for each component when a new Font object is created."

So I guess those values are supposed to be changed, but I wonder what was the original purpose, since the Game_Window class ignores the default_name value. It may be a bug, but it seems a little far-fetched case. Anyway, the tweak I posted in the OP might sound a little hackish, but works if you need to use different fonts and want to change them at will.
It may be that nothing in the default scripts CHANGES the default_name of the font class. In that case, there would be no need to reset it.
It may be that nothing in the default scripts CHANGES the default_name of the font class. In that case, there would be no need to reset it.
That's possibile. But if that's the case, it means the developers chose to completely block the usage of different fonts in the main engine by design. Sounds strange to me, since the rest of the script seems to be written to be extremely flexible. But whatever, I was just curious about it 🙂

Original thread: https://forums.rpgmakerweb.com/threads/font-wont-change-during-an-event-a-fix-and-a-question.28579/