From c6fd9b8f962d97c03042723a9199d77ee2420f21 Mon Sep 17 00:00:00 2001 From: dazedanon Date: Wed, 4 Mar 2026 13:58:34 -0600 Subject: [PATCH] Fix ll galge plugin fl --- js/plugins/LL_GalgeChoiceWindow.js | 35 +++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/js/plugins/LL_GalgeChoiceWindow.js b/js/plugins/LL_GalgeChoiceWindow.js index d2c1ce7..9439847 100644 --- a/js/plugins/LL_GalgeChoiceWindow.js +++ b/js/plugins/LL_GalgeChoiceWindow.js @@ -371,7 +371,35 @@ } }; + Window_GalgeChoiceList.prototype.wrapMessageText = function() { + const maxWidth = gcwWindowWidth - gcwWindowPadding * 2; + const tmp = new Bitmap(1, 1); + tmp.fontFace = $gameSystem.mainFontFace(); + tmp.fontSize = $gameSystem.mainFontSize(); + const wrapped = []; + messageTextLists.forEach(function(line) { + if (tmp.measureTextWidth(line) <= maxWidth) { + wrapped.push(line); + } else { + const words = line.split(" "); + let currentLine = ""; + words.forEach(function(word) { + const testLine = currentLine ? currentLine + " " + word : word; + if (tmp.measureTextWidth(testLine) > maxWidth && currentLine) { + wrapped.push(currentLine); + currentLine = word; + } else { + currentLine = testLine; + } + }); + if (currentLine) wrapped.push(currentLine); + } + }); + messageTextLists = wrapped; + }; + Window_GalgeChoiceList.prototype.start = function() { + this.wrapMessageText(); this.updatePlacement(); this.createCancelButton(); this.placeCancelButton(); @@ -596,9 +624,14 @@ return maxCols; }; + Window_GalgeChoiceList.prototype.breakLigatures = function(text) { + // Insert zero-width non-joiner (U+200C) to prevent missing ligature glyphs (fi, fl, ff, ffi, ffl, etc.) + return text.replace(/f([filt])/g, "f\u200C$1"); + }; + Window_GalgeChoiceList.prototype.setQuestionText = function() { messageTextLists.forEach((text, index) => { - this.drawText(this.convertEscapeCharacters(text), 0, this.lineHeight() * index, this.innerWidth, "center"); + this.drawText(this.breakLigatures(this.convertEscapeCharacters(text)), 0, this.lineHeight() * index, this.innerWidth, "center"); }, this); };