Any way to reduce kerning/space between letters in a text box? OR show a picture inside the text box?

basically i want to actually display a small image inside a message box and thought a good workaround would be placing 2 small icons next to each other and reduce the space between em, however turns out i cant find a way to reduce said space, ive checked on yanfly's core along the extended message packs but there doesnt seem to be anything to do that.

1718209602593.png


otherwise if there if there is a way to display a picture within a textbox that would also be good, this is mainly to show certain controls like seeing here since ive got graphics of stuff like shift and space
Someone else might know better, but I followed the code down to strokeText() which is a basic JavaScript function, I didn't see any way to modify the space between letters.

You could mess with using Show Image to put the picture inside the message window, but that wouldn't play nicely if you have your text displayed the default way of getting typed at character at a time.

You could also try @Eliaquim's Hakuen Studios Escape Codes to embed an eval in the message that shows an image - I'm not positive how that would play out.
The \i[n] text code adds a 2 px margin each side of the icon (rpg_windows.js):
JavaScript:
Window_Base.prototype.processDrawIcon = function(iconIndex, textState) {
    this.drawIcon(iconIndex, textState.x + 2, textState.y + 2);
    textState.x += Window_Base._iconWidth + 4;
};
Fields that support text codes use drawTextEx, which draws each character separately (cf Window_Base#processCharacter). So like Turan suggests, I think you could use a plugin that lets you define a custom text code, e.g. for "draw icon without margin", or "offset textState.x".

With an eval text code like Hakuen Escape Codes you could try one of these between your icons:
  1. textState.x -= 4
  2. this._textState.x -= 4
I.e. "move left by 4 px". (2 px after the previous icon, and 2 px before the next one.)

Alternatively, with my own Cae_CustomEscCodes I'd consider a "Process" code with replacer:
JavaScript:
if (this._textState)
  this._textState.x -= parseInt(arguments[1], 10);
I.e. "move left by N px, where N is the value of the first argument". E.g. \dx[4].

There are probably other plugins that can do a similar thing~
Alternatively, with my own Cae_CustomEscCodes
I forgot you had that! Sorry 😅
The \i[n] text code adds a 2 px margin each side of the icon (rpg_windows.js):
JavaScript:
Window_Base.prototype.processDrawIcon = function(iconIndex, textState) {
    this.drawIcon(iconIndex, textState.x + 2, textState.y + 2);
    textState.x += Window_Base._iconWidth + 4;
};
Fields that support text codes use drawTextEx, which draws each character separately (cf Window_Base#processCharacter). So like Turan suggests, I think you could use a plugin that lets you define a custom text code, e.g. for "draw icon without margin", or "offset textState.x".

With an eval text code like Hakuen Escape Codes you could try one of these between your icons:
  1. textState.x -= 4
  2. this._textState.x -= 4
I.e. "move left by 4 px". (2 px after the previous icon, and 2 px before the next one.)

Alternatively, with my own Cae_CustomEscCodes I'd consider a "Process" code with replacer:
JavaScript:
if (this._textState)
  this._textState.x -= parseInt(arguments[1], 10);
I.e. "move left by N px, where N is the value of the first argument". E.g. \dx[4].

There are probably other plugins that can do a similar thing~

Thanks for the replies, though sorry if this is bothersome but mind explaining how one would apply the coding to do this?

quite frankly im no coder and despite reading throuroughly i still cant grasp programming concepts wich ends up in me doing stuff like this but not understanding why it doesnt work.
1718246290624.png

in this im using the hakuen escape codes plugin, i havent tried the other yet.

honestly im also surprised how backwards rpg maker is sometimes, with some things you'd think thatd be simple to do ending up requiring installing multiple plugins and writing code to get some results.
me doing stuff like this but not understanding why it doesnt work.
Just from your post, we don't understand either. How doesn't it work? What do you see? Where's the screenshot in-game?

honestly im also surprised how backwards rpg maker is sometimes, with some things you'd think thatd be simple to do ending up requiring installing multiple plugins and writing code to get some results.
That's not a very helpful mindset. 😉 Imagine giving hundreds of thousands of people any set of tools and letting them go off to just do stuff. None of those people have the same brain that you do, and you're going to get lots of them telling you "why didn't you put this in my bag?"

For example: I've been floating around here for years and I have never seen another person ask to print two icons in a row with no space between them.

RPG Maker was designed to do a specific thing: emulate classic JRPGs. I haven't played a 2D Final Fantasy or Dragon Quest that showed large images in the middle of the text boxes.

That doesn't make it "backwards" - it's setting a scope for a project. Without making the software huge and expensive and no longer suited for beginners, there are finite things they can let you implement by default.

Did you try caethyril's second suggestion?
Code:
this._textState.x -= 4
Sorry for the late reply i kinda just went directly to sleep after this message.
Just from your post, we don't understand either. How doesn't it work? What do you see? Where's the screenshot in-game?
1718286963782.png

sorry for not clarifying, it just kinda shows up as written.

That's not a very helpful mindset. 😉 Imagine giving hundreds of thousands of people any set of tools and letting them go off to just do stuff. None of those people have the same brain that you do, and you're going to get lots of them telling you "why didn't you put this in my bag?"

For example: I've been floating around here for years and I have never seen another person ask to print two icons in a row with no space between them.

RPG Maker was designed to do a specific thing: emulate classic JRPGs. I haven't played a 2D Final Fantasy or Dragon Quest that showed large images in the middle of the text boxes.

That doesn't make it "backwards" - it's setting a scope for a project. Without making the software huge and expensive and no longer suited for beginners, there are finite things they can let you implement by default.

true, sorry if it came off as rude, i supose im more familiar with other jrpgs of the era of snes and their more unique features, like treasure of the rudras and breath of fire games having animated enemies, games like chrono trigger or trials of mana having 8 direction movement or how the old fan translation of live a live had different fonts used per ingame era.

i was just kinda surprised given how it isnt an option in the textbox given how rpg maker already has great text features like coloring text or increasing and reducing font size and even the including icons option itself, even when ive already done a bunch of stuff for the more complex features ive wanted to include lol.

Did you try caethyril's second suggestion?
Code:
this._textState.x -= 4
and yep, same result unfortunately.
I didn't think you were rude, per se, I was just trying to point out that there's a lot involved in this kind of software and it's much easier to armchair quarterback from our perspective than it is to make it flexible and newbie-user-friendly from the design perspective 😉

That makes it seem like the plugin is not installed or configured properly.

- Do you have the correct version of the plugin, MV vs. MZ?
- Do you have Eli's Book installed if that's a prerequisite?
- Do you need to set up anything in the plugin parameters?
- If you press F8 during the play test and go to the Console tab, are there any errors?
- Did you save your project and start a new play test, as opposed to loading a save game?
I think you should also remove the spaces between text codes, i.e. \i[5]=|textState.x -= 4|=\i[5].

As noted in the plugin's help (linked as "How to Use" on the plugin's thread on this site, and in the plugin's help visible in the Plugin Manager), this is the main documentation:
Like Turan says, it needs another plugin, Eli_Book, and must be loaded after Eli_Book:
However, it looks like the MV version might have been removed? At the moment the only file available seems to be EliMZ_Book, which I think is for MZ exclusively. Perhaps @Eliaquim can clarify~

Alternatively, here are detailed instructions for my plugin:
Spoiler: click to expand
  1. Download Cae_CustomEscCodes.js from my thread ("General" category, sorted A-Z):
  2. Put the downloaded file in your project's js/plugins subfolder.
  3. In the Plugin Manager, double-click (or right-click -> Edit) on an empty row, then add my plugin.
  4. Double-click the new plugin entry to view its help & parameters.
  5. Double-click the Process Escape Codes parameter to edit its value.
  6. It's a list: double-click an empty row to add a new entry.
  7. Set the new entry's values to:
    • Code: dx
    • Arguments: a list with 1 value: Integer
    • Delimiters: [] (default)
    • Replacer:

      if (this._textState) this._textState.x -= parseInt(arguments[1], 10) || 0;
      (|| 0 is just a safety check, in case what's provided is not a number.)
  8. It'll look something like this screenshot (click to view original size):

    screenshot.png
  9. Keep clicking OK until you're out of the Plugin Manager.
  10. Make a test event, e.g. Show Text: \i[5]\dx[4]\i[5] ("icon 5, move left 4 px, icon 5").
  11. Save your project & test!

I forgot you had that! Sorry 😅
No need for an apology! I don't expect anyone to remember everything I've done...I had to go check whether I wrote that for MV as well. 👋
I didn't think you were rude, per se, I was just trying to point out that there's a lot involved in this kind of software and it's much easier to armchair quarterback from our perspective than it is to make it flexible and newbie-user-friendly from the design perspective 😉

That makes it seem like the plugin is not installed or configured properly.

- Do you have the correct version of the plugin, MV vs. MZ?
- Do you have Eli's Book installed if that's a prerequisite?
- Do you need to set up anything in the plugin parameters?
- If you press F8 during the play test and go to the Console tab, are there any errors?
- Did you save your project and start a new play test, as opposed to loading a save game?
noted.

MV version is 1.6.2, Eli's Book is installed, how to use doc doesnt list other prequisites other than have Eli's Book installed with Escape Codes itself below it and i always test in a new game.

1718291194316.png

instructions only say this for the eval function, wich is what was mentioned earlier.

Console DID return these errors though

1718291367530.png


wich clicking into them show this

1718291754258.png

1718291783945.png


i am no coder but i assume its not even starting the scripts in this case
Console DID return these errors though
As you can see from the filename, you have the MZ version of Eli's book, not MV. That's causing the prerequisite for the escape code plugin to fail, which means it's not loading at all.

However, it looks like the MV version might have been removed?
Eli had a status post a few days ago that he was temporarily removing his MV plugins from itch to replace them with free versions.

I don't know how long that takes to appear on the storefront. It might be worth your time to try caethyril's version.
I think you should also remove the spaces between text codes, i.e. \i[5]=|textState.x -= 4|=\i[5].

As noted in the plugin's help (linked as "How to Use" on the plugin's thread on this site, and in the plugin's help visible in the Plugin Manager), this is the main documentation:
Like Turan says, it needs another plugin, Eli_Book, and must be loaded after Eli_Book:
However, it looks like the MV version might have been removed? At the moment the only file available seems to be EliMZ_Book, which I think is for MZ exclusively. Perhaps @Eliaquim can clarify~

Alternatively, here are detailed instructions for my plugin:
Spoiler: click to expand
  1. Download Cae_CustomEscCodes.js from my thread ("General" category, sorted A-Z):
  2. Put the downloaded file in your project's js/plugins subfolder.
  3. In the Plugin Manager, double-click (or right-click -> Edit) on an empty row, then add my plugin.
  4. Double-click the new plugin entry to view its help & parameters.
  5. Double-click the Process Escape Codes parameter to edit its value.
  6. It's a list: double-click an empty row to add a new entry.
  7. Set the new entry's values to:
    • Code: dx
    • Arguments: a list with 1 value: Integer
    • Delimiters: [] (default)
    • Replacer:

      Code:
      if (this._textState)
         this._textState.x -= parseInt(arguments[1], 10) || 0;

      (|| 0 is just a safety check, in case what's provided is not a number.)
  8. It'll look something like this screenshot (click to view original size):

    View attachment 308331

  9. Keep clicking OK until you're out of the Plugin Manager.
  10. Make a test event, e.g. Show Text: \i[5]\dx[4]\i[5] ("icon 5, move left 4 px, icon 5").
  11. Save your project & test!
Alrighty, ill try that last thing then move to try the other plugin if it doesnt work, id hope itd also work in mv since it says MV/MZ and most plugins MZ plugins seem to be compatible with MV

thank you for the detailed instructions, ill update if it works.

As you can see from the filename, you have the MZ version of Eli's book, not MV. That's causing the prerequisite for the escape code plugin to fail, which means it's not loading at all.

just saw this one second later after posting lol, ill try the other plugin then.
Aaaaand it works

1718293726185.png


whew, thanks a lot for bearing with me and my lack of knowledge of these things, i kinda struggle with a lot of this since im more of an art guy than code guy, so i appreciate the help a lot.
Yay! 😂

If you're going to be using that a lot, you might want to define a "macro" as well. E.g. so you can type \shift and that'll get auto-replaced with \i[5]\dx[4]\i[5].

With my plugin, that would be a "Convert" code:
  • Code = shift
  • Arguments = (empty list)
  • Delimiters = (doesn't matter - no arguments means this is ignored)
  • Replacer = return "\x1bi[5]\x1bdx[4]\x1bi[5]";
most plugins MZ plugins seem to be compatible with MV
Just to forewarn you, that's not the case.

It's more true for MV going to MZ - many MV plugins can work in MZ, unless they deal with windows or animations or other things that were changed.

But MZ supports an entirely newer version of JavaScript, so anyone taking advantage of that in their syntax means the plugin can't load at all in MV. That's why the MZ book gave the ? token error.

You should look for plugins written specifically for MV.
Yay! 😂

If you're going to be using that a lot, you might want to define a "macro" as well. E.g. so you can type \shift and that'll get auto-replaced with \i[5]\dx[4]\i[5].

With my plugin, that would be a "Convert" code:
  • Code = shift
  • Arguments = (empty list)
  • Delimiters = (doesn't matter - no arguments means this is ignored)
  • Replacer = return "\x1bi[5]\x1bdx[4]\x1bi[5]";
oh thanks a lot, this is actually going to be very useful given how i also format some of my dialogues for my game, i appreciate it.

Just to forewarn you, that's not the case.

It's more true for MV going to MZ - many MV plugins can work in MZ, unless they deal with windows or animations or other things that were changed.

But MZ supports an entirely newer version of JavaScript, so anyone taking advantage of that in their syntax means the plugin can't load at all in MV. That's why the MZ book gave the ? token error.

You should look for plugins written specifically for MV.
Noted, had the assumption they'd both work because they both use java even if MV was an older version somehow i thought the java code would be the same with the difference being just the MV engine having less features than MZ, so i wasnt aware of that.
Neat! I can find some uses for this as well 🙂

I remember asking a similar question a long time ago:

I think you should also remove the spaces between text codes, i.e. \i[5]=|textState.x -= 4|=\i[5].

As noted in the plugin's help (linked as "How to Use" on the plugin's thread on this site, and in the plugin's help visible in the Plugin Manager), this is the main documentation:
Like Turan says, it needs another plugin, Eli_Book, and must be loaded after Eli_Book:
However, it looks like the MV version might have been removed? At the moment the only file available seems to be EliMZ_Book, which I think is for MZ exclusively. Perhaps @Eliaquim can clarify~

Alternatively, here are detailed instructions for my plugin:
Spoiler: click to expand
  1. Download Cae_CustomEscCodes.js from my thread ("General" category, sorted A-Z):
  2. Put the downloaded file in your project's js/plugins subfolder.
  3. In the Plugin Manager, double-click (or right-click -> Edit) on an empty row, then add my plugin.
  4. Double-click the new plugin entry to view its help & parameters.
  5. Double-click the Process Escape Codes parameter to edit its value.
  6. It's a list: double-click an empty row to add a new entry.
  7. Set the new entry's values to:
    • Code: dx
    • Arguments: a list with 1 value: Integer
    • Delimiters: [] (default)
    • Replacer:

      Code:
      if (this._textState)
         this._textState.x -= parseInt(arguments[1], 10) || 0;

      (|| 0 is just a safety check, in case what's provided is not a number.)
  8. It'll look something like this screenshot (click to view original size):

    View attachment 308331

  9. Keep clicking OK until you're out of the Plugin Manager.
  10. Make a test event, e.g. Show Text: \i[5]\dx[4]\i[5] ("icon 5, move left 4 px, icon 5").
  11. Save your project & test!


No need for an apology! I don't expect anyone to remember everything I've done...I had to go check whether I wrote that for MV as well. 👋

noted.

MV version is 1.6.2, Eli's Book is installed, how to use doc doesnt list other prequisites other than have Eli's Book installed with Escape Codes itself below it and i always test in a new game.

View attachment 308332
instructions only say this for the eval function, wich is what was mentioned earlier.

Console DID return these errors though

View attachment 308334

wich clicking into them show this

View attachment 308336
View attachment 308338

i am no coder but i assume its not even starting the scripts in this case
@caethyril @VinegarDude Thanks for tagging me here!
Sorry for the inconvenience, now all my MV stuff is on one page, together with the sample project:

Maybe you can test this feature better, by going into the Escape Codes map and see how the formula escape code is being used on the Show Text box.

I also need to change that MVZ name on the plugin. I did that sometime ago, when I though I would want to make a single plugin that worked for two Maker versions, well, it didn't work well ^^''

Original thread: https://forums.rpgmakerweb.com/threads/any-way-to-reduce-kerning-space-between-letters-in-a-text-box-or-show-a-picture-inside-the-text-box.169457/