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

gufino2

Villager
Member
Joined
Jun 14, 2014
Messages
9
Reaction score
1
First Language
Italian
Primarily Uses
Hi guys,

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



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?

 
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
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.
 

gufino2

Villager
Member
Joined
Jun 14, 2014
Messages
9
Reaction score
1
First Language
Italian
Primarily Uses
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.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
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.
 

gufino2

Villager
Member
Joined
Jun 14, 2014
Messages
9
Reaction score
1
First Language
Italian
Primarily Uses
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 :)
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,045
Members
137,569
Latest member
Shtelsky
Top