mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-02 03:44:50 +00:00
Dynamic text: new line/paragraph rendering fixed
This commit is contained in:
@@ -883,10 +883,8 @@ public class DefineEditTextTag extends TextTag {
|
||||
lastWasWhiteSpace = true;
|
||||
}
|
||||
} else {
|
||||
if (c == '\r' || prevChar != '\r') {
|
||||
if (multiline) {
|
||||
textModel.newParagraph();
|
||||
}
|
||||
if (multiline) {
|
||||
textModel.newParagraph();
|
||||
}
|
||||
}
|
||||
prevChar = c;
|
||||
@@ -950,14 +948,21 @@ public class DefineEditTextTag extends TextTag {
|
||||
textModel.calculateTextWidths();
|
||||
|
||||
List<TEXTRECORD> allTextRecords = new ArrayList<>();
|
||||
int lastHeight = 0;
|
||||
int yOffset = 0;
|
||||
for (List<SameStyleTextRecord> line : lines) {
|
||||
int width = 0;
|
||||
int currentOffset = 0;
|
||||
for (SameStyleTextRecord tr : line) {
|
||||
width += tr.width;
|
||||
if (tr.style.fontHeight + tr.style.fontLeading > currentOffset) {
|
||||
currentOffset = tr.style.fontHeight + tr.style.fontLeading;
|
||||
if (line.isEmpty()) {
|
||||
currentOffset = lastHeight;
|
||||
} else {
|
||||
for (SameStyleTextRecord tr : line) {
|
||||
width += tr.width;
|
||||
int lineHeight = tr.style.fontHeight + tr.style.fontLeading;
|
||||
lastHeight = lineHeight;
|
||||
if (lineHeight > currentOffset) {
|
||||
currentOffset = lineHeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
yOffset += currentOffset;
|
||||
|
||||
@@ -50,6 +50,11 @@ public class DynamicTextModel {
|
||||
|
||||
public void newParagraph() {
|
||||
|
||||
if (paragraph == null) {
|
||||
// add empty paragraph
|
||||
paragraph = new Paragraph(this);
|
||||
paragraphs.add(paragraph);
|
||||
}
|
||||
paragraph = null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user