diff --git a/www/js/plugins/JsScript12Set.js b/www/js/plugins/JsScript12Set.js index 81004c6..f53ba4f 100644 --- a/www/js/plugins/JsScript12Set.js +++ b/www/js/plugins/JsScript12Set.js @@ -147,14 +147,10 @@ Window_ChoiceList.prototype.itemRectForText = function(index) { var rect = this.itemRect(index); if ($gameSystem.vnChoices) { var txt = $gameMessage._choices[index]; -var icons = txt.match(/\\i\[/g) || txt.match(/\\I\[/g); -icons = icons ? icons.length * 36 : 0; -txt = this.convertEscapeCharacters(txt,index); -txt = txt.replace(/i\[\d*\]/g,""); -txt = txt.replace(/I\[\d*\]/g,""); -txt = txt.replace(/c\[\d*\]/g,""); -txt = txt.replace(/C\[\d*\]/g,""); -var txtSize = this.textWidth(txt) + icons; +// Use textWidthEx to measure the actual rendered width including escape codes +// Add the same prefix used in drawItem for accurate measurement +var fullText = SCol.Blk0 + txt; +var txtSize = this.textWidthEx(fullText); rect.x = (Galv.VNC.width - txtSize) / 2; } else { rect.x += this.textPadding();