Controlling Text size

Hello, I'm trying to change a small section of a plugin. I would like to make the font displayed in this part bigger and am not sure how or if it is even possible. My knowledge of coding is somewhere between noob and intermediate ( i know enough to understand how it works, but I don't necessarily know what to write when I need to make it do something).  If anyone can help with any ideas, advice, or relevant tutorials I would great appreciate it. Ive included the snippet of code I'm trying to change below. as well as a screen shot of what it affects. Let me know if you need any additional information. Thanks in advance.


BattleResult.prototype.createActorName = function() {
this._name = new Sprite(new Bitmap(140,32));
this._name.opacity = 0;
this._name.bitmap.drawText(this._actor._name,0,0,140,32);
this._name.x = Moghunter.bresult_name_x;
this._name.y = Moghunter.bresult_name_y;
this.addChild(this._name);
};



Untitled-1.jpg
this.contents.fontSize = x;


Change x to the font size.


After you draw the text you want at that size you may want to reset the font, which you can do with this


this.contents.fontSize = this.standardFontSize();


or this (this also resets font color and font face):

Code:
this.resetFontSettings()
Thanks for the fast response! I tried that and get " TypeError Cannot set property 'fontSize' of undefined".


I also tried "this._name.fontSize = 50" so it matched the rest of the function, which didn't give me an error, but didn't seem to do anything.


Is there a specific spot of should add it to the code that you suggested? Again thanks for your response.
Thanks for the fast response! I tried that and get " TypeError Cannot set property 'fontSize' of undefined".


I also tried "this._name.fontSize = 50" so it matched the rest of the function, which didn't give me an error, but didn't seem to do anything.


Is there a specific spot of should add it to the code that you suggested? Again thanks for your response.

Woops, forgot to actually check the function you posted. I assumed it was just a standard window.


Try this:


this._name.bitmap.fontSize = x;


Do that before the drawtext line (change x)
It worked! Thank you so much!!!!!!!!
So now that I got that under my belt I was trying to get color to work that same way. I tried the code below but it just turned it black no matter what number I use. I'm not sure if anything else would be needed for color. Any help would be greatly appreciated.


BattleResult.prototype.createActorName = function() {
this._name = new Sprite(new Bitmap(140,60));
this._name.opacity = 0;
this._name.bitmap.textColor = 6;
this._name.bitmap.fontSize = 48;
this._name.bitmap.drawText(this._actor._name,0,0,140,60);
this._name.x = Moghunter.bresult_name_x;
this._name.y = Moghunter.bresult_name_y;
this.addChild(this._name);
};



Untitled-1.jpg

Original thread: https://forums.rpgmakerweb.com/threads/controlling-text-size.67087/