Changing Main Menu Command Font Size

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,626
Reaction score
1,195
First Language
English
Primarily Uses
RMMV
So I'd like to increase the font size of the list of commands on the main menu. I'm referring to the commands like: Items, Equip, Skills, Options, Save, etc...

How would I go about changing it? I tried adding "\{" to the front of the text in "Menu # Name" within YEP_MainMenuManager's plugin options, but it threw an error.

For the record, I only want to change the font size there and not for the rest of the game, so changing the font size in YEP_CoreEngine wouldn't work.
 

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
533
Reaction score
235
First Language
English
Primarily Uses
RMMV
The drawText call doesn't process escape codes, so that's why \{ didn't work for this case; but if you can find the specific drawText call you want to change the size of, then it's as simple as this:

JavaScript:
var saveSize = this.contents.fontSize;
this.contents.fontSize = 18; // whatever font size you want, I assume it's in points but I could be wrong.
// any calls to drawText with the larger font size
this.contents.fontSize = saveSize;
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,626
Reaction score
1,195
First Language
English
Primarily Uses
RMMV
Oooh in that case, couldn't I also just change drawText -> drawTextEx? I'll try your method 1st though.

Edit: I couldn't find any instance of "drawText" in YEP_MainMenuManager.js. Where would it be?

Edit2: Ok, I found this in rpg_windows.js
JavaScript:
//-----------------------------------------------------------------------------
// Window_MenuCommand
//
// The window for selecting a command on the menu screen.

function Window_MenuCommand() {
    this.initialize.apply(this, arguments);
}

Window_MenuCommand.prototype = Object.create(Window_Command.prototype);
Window_MenuCommand.prototype.constructor = Window_MenuCommand;

Window_MenuCommand.prototype.initialize = function(x, y) {
    Window_Command.prototype.initialize.call(this, x, y);
    this.selectLast();
};

Window_MenuCommand._lastCommandSymbol = null;

Window_MenuCommand.initCommandPosition = function() {
    this._lastCommandSymbol = null;
};

Window_MenuCommand.prototype.windowWidth = function() {
    return 240;
};

Window_MenuCommand.prototype.numVisibleRows = function() {
    return this.maxItems();
};

Window_MenuCommand.prototype.makeCommandList = function() {
    this.addMainCommands();
    this.addFormationCommand();
    this.addOriginalCommands();
    this.addOptionsCommand();
    this.addSaveCommand();
    this.addGameEndCommand();
};

Window_MenuCommand.prototype.addMainCommands = function() {
    var enabled = this.areMainCommandsEnabled();
    if (this.needsCommand('item')) {
        this.addCommand(TextManager.item, 'item', enabled);
    }
    if (this.needsCommand('skill')) {
        this.addCommand(TextManager.skill, 'skill', enabled);
    }
    if (this.needsCommand('equip')) {
        this.addCommand(TextManager.equip, 'equip', enabled);
    }
    if (this.needsCommand('status')) {
        this.addCommand(TextManager.status, 'status', enabled);
    }
};

Window_MenuCommand.prototype.addFormationCommand = function() {
    if (this.needsCommand('formation')) {
        var enabled = this.isFormationEnabled();
        this.addCommand(TextManager.formation, 'formation', enabled);
    }
};

Window_MenuCommand.prototype.addOriginalCommands = function() {
};

Window_MenuCommand.prototype.addOptionsCommand = function() {
    if (this.needsCommand('options')) {
        var enabled = this.isOptionsEnabled();
        this.addCommand(TextManager.options, 'options', enabled);
    }
};

Window_MenuCommand.prototype.addSaveCommand = function() {
    if (this.needsCommand('save')) {
        var enabled = this.isSaveEnabled();
        this.addCommand(TextManager.save, 'save', enabled);
    }
};

Window_MenuCommand.prototype.addGameEndCommand = function() {
    var enabled = this.isGameEndEnabled();
    this.addCommand(TextManager.gameEnd, 'gameEnd', enabled);
};

Window_MenuCommand.prototype.needsCommand = function(name) {
    var flags = $dataSystem.menuCommands;
    if (flags) {
        switch (name) {
        case 'item':
            return flags[0];
        case 'skill':
            return flags[1];
        case 'equip':
            return flags[2];
        case 'status':
            return flags[3];
        case 'formation':
            return flags[4];
        case 'save':
            return flags[5];
        }
    }
    return true;
};

Window_MenuCommand.prototype.areMainCommandsEnabled = function() {
    return $gameParty.exists();
};

Window_MenuCommand.prototype.isFormationEnabled = function() {
    return $gameParty.size() >= 2 && $gameSystem.isFormationEnabled();
};

Window_MenuCommand.prototype.isOptionsEnabled = function() {
    return true;
};

Window_MenuCommand.prototype.isSaveEnabled = function() {
    return !DataManager.isEventTest() && $gameSystem.isSaveEnabled();
};

Window_MenuCommand.prototype.isGameEndEnabled = function() {
    return true;
};

Window_MenuCommand.prototype.processOk = function() {
    Window_MenuCommand._lastCommandSymbol = this.currentSymbol();
    Window_Command.prototype.processOk.call(this);
};

Window_MenuCommand.prototype.selectLast = function() {
    this.selectSymbol(Window_MenuCommand._lastCommandSymbol);
};
 
Last edited:

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
533
Reaction score
235
First Language
English
Primarily Uses
RMMV
Yeah, you could, but I don't think I'd recommend it. There's probably a reason why windows don't just use drawTextEx everywhere. I don't know exactly what the reason is, but some possibilities are:

  • drawTextEx has no width management - it'll happily draw right off the edge of the window if you give it a long enough string.
  • drawTextEx draws the text one character at a time, which means it's inevitably slower than drawing it all in one go; I doubt that makes a difference in practice, but if you were drawing all text with drawTextEx, maybe there could be a noticeable drop in performance.

You're welcome to try it, however. Using it only for the experience text is unlikely to hit either of the above issues, at least. I don't know if there's other reasons not to use it though.

I'll note that when I wanted skill names to process text codes, I stuck to drawText but substituted the escape codes in beforehand using the convertEscapeCharacters function. That wouldn't work for this use case, mind you; only codes like \n or \v that get replaced with an actual value are handled there, because they're a simple find and replace operation.
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,626
Reaction score
1,195
First Language
English
Primarily Uses
RMMV
Yea, I just tried changing drawText to drawTextEx and you're right it messed up the alignment. So that's a no go... This is where I changed it (reverted back to default now).
JavaScript:
Window_Command.prototype.drawItem = function(index) {
    var rect = this.itemRectForText(index);
    var align = this.itemTextAlign();
    this.resetTextColor();
    this.changePaintOpacity(this.isCommandEnabled(index));
    this.drawText(this.commandName(index), rect.x, rect.y, rect.width, align);
};
Edit: So I just tried adding your code, but it threw an error: "Window_TitleCommand.initCommandPosition is not a function"
JavaScript:
var saveSize = this.contents.fontSize;
this.contents.fontSize = 33; // whatever font size you want, I assume it's in points but I could be wrong.
// any calls to drawText with the larger font size
this.contents.fontSize = saveSize;
Where do you suggest I put it? I pasted it in rpg_windows.js at the beginning of this:
JavaScript:
//-----------------------------------------------------------------------------
// Window_MenuCommand
//
// The window for selecting a command on the menu screen.
 
Last edited:

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
533
Reaction score
235
First Language
English
Primarily Uses
RMMV
The idea was to "wrap" the drawText call:

Yea, I just tried changing drawText to drawTextEx and you're right it messed up the alignment. So that's a no go... This is where I changed it (reverted back to default now).
JavaScript:
Window_Command.prototype.drawItem = function(index) {
    var rect = this.itemRectForText(index);
    var align = this.itemTextAlign();
    this.resetTextColor();
    this.changePaintOpacity(this.isCommandEnabled(index));
    var saveSize = this.contents.fontSize;
    this.contents.fontSize = 33;
    this.drawText(this.commandName(index), rect.x, rect.y, rect.width, align);
    this.contents.fontSize = saveSize;
};
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,626
Reaction score
1,195
First Language
English
Primarily Uses
RMMV
I believe that would affect everything throughout the game, instead of just the main menu's command list, but I'll try it.

Edit: Actually it'll suffice! It affects pretty much every command menu, but I can live with that lol.
 

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
533
Reaction score
235
First Language
English
Primarily Uses
RMMV
Yes, you're correct. You could however make a copy of the function but change Window_Command to Window_MenuCommand or Window_TitleCommand or whichever window you need it to apply to, and then make the change only in the copy.
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,626
Reaction score
1,195
First Language
English
Primarily Uses
RMMV
Btw, what is the purpose of var saveSize = this.contents.fontSize and this.contents.fontSize = saveSize;?
 

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
533
Reaction score
235
First Language
English
Primarily Uses
RMMV
That just makes sure that any other drawText calls in the same window are drawn at the normal size. In your specific case they might not matter, as the commands are the only text in the window.
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,626
Reaction score
1,195
First Language
English
Primarily Uses
RMMV
Hmm, it's not having any effect (when I tried to make a copy like you suggested)...
JavaScript:
Window_MenuCommand.prototype.drawItem = function(index) {
    var rect = this.itemRectForText(index);
    var align = this.itemTextAlign();
    this.resetTextColor();
    this.changePaintOpacity(this.isCommandEnabled(index));
    this.contents.lineHeight = 40;
    this.contents.fontSize = 33;
    this.drawText(this.commandName(index), rect.x, rect.y, rect.width, align);
};
Does placement matter? I placed this chunk right after the original.

Edit: Oh wait, I think I have to change Window_MenuCommand.prototype = Object.create(Window_Command.prototype); -> Window_MenuCommand.prototype = Object.create(Window_MenuCommand.prototype);
However, when I did, it gave me an error: "this.clearCommandList is not a function"

Edit2: I had to change Window_Command.prototype.initialize.call(this, x, y); -> Window_MenuCommand.prototype.initialize.call(this, x, y);

But now it gives me "RangeError: Maximum call stack size exceeded"

Edit3: Ok, I think it's cause we named the copy Window_MenuCommand so this function is running in an endless loop:
JavaScript:
Window_MenuCommand.prototype.initialize = function(x, y) {
    Window_MenuCommand.prototype.initialize.call(this, x, y);
    this.selectLast();
};
Edit4: Sweet, I got it working! I had to make a copy of the ALL the Window_Command functions and named it Window_MainCommand then adjusted accordingly in Window_MenuCommand. My only gripe now is: How do I increase line-height? I tried: this.contents.lineHeight = 40; but it has no effect...
 
Last edited:

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
533
Reaction score
235
First Language
English
Primarily Uses
RMMV
Okay, so I think the way you resolved the issues with my suggestion is probably wrong? There shouldn't be any reason to duplicate functions other than drawItem and (if I recall the name correctly) itemHeight. I mean, if it works for you, okay, fine; but there should've been a simpler way to get it working.

Anyway, I already stealth-answered your last question, but let me say it again: the itemHeight function is what controls the height of a command, so I think that's what you'd need to override to fix your line height issue.
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,626
Reaction score
1,195
First Language
English
Primarily Uses
RMMV
Yea, there's definitely redundancies with the way I did it. But I wasn't sure what exactly had to be duplicated and when I tried duplicating only the bare minimums (or what I thought would be) I kept getting errors. That's why I just said screw it and duplicated the whole thing. It was an inefficient but "better safe than sorry" approach lol.
 
Last edited:

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

Latest Threads

Latest Posts

Latest Profile Posts

He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!

Forum statistics

Threads
106,036
Messages
1,018,461
Members
137,821
Latest member
Capterson
Top