[SOLVED] Window_Message: Weird spacing between first and second line of message?

window_message_weird_first_line_space.PNG


Don't be fooled by the fancy window skin or floating position- the image above shows a standard Window_Message with the only caveat being that the Bitmap.prototype.drawText() function usually used to render the letters has been replaced by a custom Bitmap.prototype.drawBmpFontText() function that handles the same parameters (text, x, y) normally passed to .drawText().

I also changed all the Window_Message functions to reflect the size of the Bitmap font:
Window_Message.png


Despite this, there is a discernible gap between the first line and the second line of the message.
window_message_weird_first_line_space_detail.PNG


A dump to the console shows the Y-value of the letters on the first line is 0, while the second line Y-value is 26, the third line is 44:
window_message_weird_first_line_space_console_output.PNG


I have no idea where this 26 is coming from!

I was hoping that somebody might be able to help and speculate what they think is happening and give me a hint about how I might go about fixing this?
It is driving me mad!

Thank you in advance!
My guess is it's in the processNewLine function. Where you're calling the y before setting the height. For a default function this is fine but if you're setting a new font height like that, the textState.height is pulling the original font size first before setting the new font size hence why there might be that weird gap between the first and second line and not the rest. Try switching the y and the height lines to see if that will fix it.
My guess is it's in the processNewLine function. Where you're calling the y before setting the height. For a default function this is fine but if you're setting a new font height like that, the textState.height is pulling the original font size first before setting the new font size hence why there might be that weird gap between the first and second line and not the rest. Try switching the y and the height lines to see if that will fix it.

Thanks- it was in the .processNewLine() function!

There's this code on line 423 of rpg_windows.js:
textHeight += maxFontSize + 8;

I just had to alias the function and remove the 8.

Now it works:
window_message_weird_first_line_space_fixed.PNG


Thank you!

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/solved-window_message-weird-spacing-between-first-and-second-line-of-message.124147/