Controlling Text size

Random Panda

Veteran
Veteran
Joined
May 3, 2016
Messages
91
Reaction score
14
First Language
English
Primarily Uses
RMMV
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
 

DreamX

Veteran
Veteran
Joined
May 30, 2015
Messages
816
Reaction score
826
First Language
English
Primarily Uses
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()
 

Random Panda

Veteran
Veteran
Joined
May 3, 2016
Messages
91
Reaction score
14
First Language
English
Primarily Uses
RMMV
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.
 

DreamX

Veteran
Veteran
Joined
May 30, 2015
Messages
816
Reaction score
826
First Language
English
Primarily Uses
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)
 
Last edited by a moderator:

Random Panda

Veteran
Veteran
Joined
May 3, 2016
Messages
91
Reaction score
14
First Language
English
Primarily Uses
RMMV
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
 

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

Latest Threads

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,867
Messages
1,017,061
Members
137,575
Latest member
akekaphol101
Top