Fix ll galge plugin fl
This commit is contained in:
parent
95740fead4
commit
c6fd9b8f96
1 changed files with 34 additions and 1 deletions
|
|
@ -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);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue