diff --git a/www/js/plugins/LL_InfoPopupWIndowMV.js b/www/js/plugins/LL_InfoPopupWIndowMV.js index e6c21ba..135c3d1 100644 --- a/www/js/plugins/LL_InfoPopupWIndowMV.js +++ b/www/js/plugins/LL_InfoPopupWIndowMV.js @@ -14,6 +14,11 @@ * @author ルルの教会 * @url https://nine-yusha.com/plugin-infowindow/ * + * @param FontSize + * @text Font Size + * @desc ポップアップで表示するテキストのフォントサイズ(ピクセル)。既定値は24。 + * @default 24 + * * @help LL_InfoPopupWIndowMV.js * * ポップアップでインフォメッセージを表示します。 @@ -50,6 +55,8 @@ "use strict"; var pluginName = "LL_InfoPopupWIndowMV"; var parameters = PluginManager.parameters(pluginName); + // Font size for info popup text (uses Window_Base default if not set) + var exInfoWindowFontSize = Number(parameters['FontSize'] || 20); //----------------------------------------------------------------------------- // PluginCommand (for MV) @@ -251,12 +258,36 @@ }; Window_ExInfoWindow.prototype.refresh = function() { - this.contents.clear(); - this.drawTextEx(exInfoWindowText, 0, 0, this.innerWidth); + var self = this; + // Use a temporary override so drawTextEx uses the plugin-configured font size + var _origReset = Window_Base.prototype.resetFontSettings; + Window_Base.prototype.resetFontSettings = function() { + this.contents.fontFace = this.standardFontFace(); + this.contents.fontSize = exInfoWindowFontSize; + this.resetTextColor(); + }; + try { + this.contents.clear(); + // draw text with temporary font size + Window_Base.prototype.drawTextEx.call(this, exInfoWindowText, 0, 0); + } finally { + Window_Base.prototype.resetFontSettings = _origReset; + } }; // for MV Window_ExInfoWindow.prototype.textWidthEx = function(text) { - return this.drawTextEx(text, 0, this.contents.height); + // Ensure text width is measured with the configured font size. + var _origReset = Window_Base.prototype.resetFontSettings; + Window_Base.prototype.resetFontSettings = function() { + this.contents.fontFace = this.standardFontFace(); + this.contents.fontSize = exInfoWindowFontSize; + this.resetTextColor(); + }; + try { + return Window_Base.prototype.drawTextEx.call(this, text, 0, this.contents.height); + } finally { + Window_Base.prototype.resetFontSettings = _origReset; + } }; })();