VE - Damage Popup change "FontFace"?

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()
this.fontFace = 'font name'

as far as i know they need to be in .ttf format to work
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()
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?
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... 😅


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/
Thanks to the both of you for the help. I got it working.
@caethyril That's a clever trick, I didn't think of using the String global object to get around the eval!

Original thread: https://forums.rpgmakerweb.com/threads/ve-damage-popup-change-fontface.94237/