VE - Damage Popup change "FontFace"?

AdamSakuru

[Null_Value]
Veteran
Joined
Mar 14, 2014
Messages
314
Reaction score
171
First Language
English
Primarily Uses
N/A
https://victorenginescripts.wordpress.com/rpg-maker-mv/damage-popup/
I'm using Victor's Damage Popup plugin and there's a parameter for "Font Face"

Code:
-Popup Fontface
The parameters 'Fontface' defines the font name for the popup display.
You can use script codes that returns a string with the fontname se the
value for it.
But I'm not sure how to do this. Would anyone know the right way? By default it's this:
Code:
this.standardFontFace()
 

kovak

Silverguard
Veteran
Joined
Apr 3, 2016
Messages
1,256
Reaction score
1,558
First Language
PT - EN
Primarily Uses
RMMV
this.fontFace = 'font name'

as far as i know they need to be in .ttf format to work
 

Aloe Guvner

Walrus
Veteran
Joined
Sep 28, 2017
Messages
1,628
Reaction score
1,090
First Language
English
Primarily Uses
RMMV
Not quite, the way Victor set it up, it requires a function (because he uses the eval command on it, it can't just be the name of the font as a simple string).

This is the default function:
Code:
Window_Base.prototype.standardFontFace = function() {
   if ($gameSystem.isChinese()) {
      return 'SimHei, Heiti TC, sans-serif';
   } else if ($gameSystem.isKorean()) {
      return 'Dotum, AppleGothic, sans-serif';
   } else {
      return 'GameFont';
   }
};
So it stands to reason you could insert this code into the plugin somewhere:
Code:
Window_Base.prototype.myFontFace = function() {
   return 'XXXXXXX';
};
Where XXXXXXX is the font-family defined in your gamefont.css file.

And then your parameter in the plugin would be:
Code:
this.myFontFace()
 

AdamSakuru

[Null_Value]
Veteran
Joined
Mar 14, 2014
Messages
314
Reaction score
171
First Language
English
Primarily Uses
N/A
Not quite, the way Victor set it up, it requires a function (because he uses the eval command on it, it can't just be the name of the font as a simple string).

This is the default function:
Code:
Window_Base.prototype.standardFontFace = function() {
   if ($gameSystem.isChinese()) {
      return 'SimHei, Heiti TC, sans-serif';
   } else if ($gameSystem.isKorean()) {
      return 'Dotum, AppleGothic, sans-serif';
   } else {
      return 'GameFont';
   }
};
So it stands to reason you could insert this code into the plugin somewhere:
Code:
Window_Base.prototype.myFontFace = function() {
   return 'XXXXXXX';
};
Where XXXXXXX is the font-family defined in your gamefont.css file.

And then your parameter in the plugin would be:
Code:
this.myFontFace()
I apologize if this is obvious bit I'm unfamiliar with this stuff. How do I set it to a font that is not the game font?
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
1,654
Reaction score
1,106
First Language
EN
Primarily Uses
RMMV
Assuming you have the font and the permissions (if required) to use it: copy the font file into your project's fonts subfolder, then use Notepad or something to open the gamefont.css file (found in the same folder) and add this:
Code:
@font-face {
    font-family: FontLabel;
    src: url("font-name-goes-here.ttf");
}
Replace FontLabel with whatever you like, e.g. PopupFont. The font-family label is what's used in the code to refer to this font. As you can see, the actual filename goes in the brackets on the next line. Then for the parameter in Victor's plugin I'd suggest trying this:
Code:
String('FontLabel');
Again, replace FontLabel with whatever you called it in the CSS file. I think this should work around the eval without the need for additional code, though I haven't tested it myself... :kaoswt:


If you don't have a licence/permission to distribute the font you want to use but it can be expected to be present on the players' systems (e.g. if you want to use Segoe UI on Windows systems), this old thread on the Steam Discussions may be of interest: https://steamcommunity.com/app/363890/discussions/1/1318836262668686748/
 

AdamSakuru

[Null_Value]
Veteran
Joined
Mar 14, 2014
Messages
314
Reaction score
171
First Language
English
Primarily Uses
N/A
Thanks to the both of you for the help. I got it working.
 

Aloe Guvner

Walrus
Veteran
Joined
Sep 28, 2017
Messages
1,628
Reaction score
1,090
First Language
English
Primarily Uses
RMMV
@caethyril That's a clever trick, I didn't think of using the String global object to get around the eval!
 

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

Latest Threads

Latest Posts

Latest Profile Posts

The most rewarding part of making custom body character parts is absolutely not making the masks work. Somebody please put me out of my misery.
Any commercial devs here ever mess with Gamejolt? Been contemplating making my games available there but don't know if it's worth the effort or not.
Social distancing taught me of how much of not a loner I am. Dammit, I miss seeing my friends...
Happy 4th of July all. Anybody have plans? Mine here is staying home away from the virus. Still a nice 3 day weekend.
The project I am working on is going great at the moment. I'm hoping everyone is having as successful a time as I am. :)

Forum statistics

Threads
99,258
Messages
963,575
Members
130,849
Latest member
DuckGames
Top