mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-06 08:48:16 +00:00
#1128 Letterspacing bug (after font embed): ignore letterspacing when character changed
This commit is contained in:
@@ -115,7 +115,7 @@ public class TextExporter {
|
||||
new RetryTask(() -> {
|
||||
fos.write(Utf8Helper.getBytes("ID: " + textTag.getCharacterId() + Helper.newLine));
|
||||
if (settings.mode == TextExportMode.FORMATTED) {
|
||||
fos.write(Utf8Helper.getBytes(textTag.getFormattedText().text));
|
||||
fos.write(Utf8Helper.getBytes(textTag.getFormattedText(false).text));
|
||||
} else {
|
||||
String separator = Configuration.textExportSingleFileRecordSeparator.get();
|
||||
separator = Helper.newLine + separator + Helper.newLine;
|
||||
@@ -140,7 +140,7 @@ public class TextExporter {
|
||||
new RetryTask(() -> {
|
||||
try (OutputStream fos = new BufferedOutputStream(new FileOutputStream(file))) {
|
||||
if (settings.mode == TextExportMode.FORMATTED) {
|
||||
fos.write(Utf8Helper.getBytes(textTag.getFormattedText().text));
|
||||
fos.write(Utf8Helper.getBytes(textTag.getFormattedText(false).text));
|
||||
} else {
|
||||
String separator = Configuration.textExportSingleFileRecordSeparator.get();
|
||||
separator = Helper.newLine + separator + Helper.newLine;
|
||||
|
||||
@@ -77,7 +77,7 @@ public class TextImporter {
|
||||
TextTag textTag = swf.getText(characterId);
|
||||
if (textTag != null) {
|
||||
String[] currentRecords = records.get(characterId);
|
||||
String text = textTag.getFormattedText().text;
|
||||
String text = textTag.getFormattedText(false).text;
|
||||
if (!saveText(textTag, text, currentRecords)) {
|
||||
return;
|
||||
}
|
||||
@@ -135,7 +135,7 @@ public class TextImporter {
|
||||
if (!formatted) {
|
||||
String[] records = newText.split(recordSeparator);
|
||||
if (textTag != null) {
|
||||
String text = textTag.getFormattedText().text;
|
||||
String text = textTag.getFormattedText(false).text;
|
||||
if (!saveText(textTag, text, records)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -501,7 +501,7 @@ public class DefineEditTextTag extends TextTag {
|
||||
}
|
||||
|
||||
@Override
|
||||
public HighlightedText getFormattedText() {
|
||||
public HighlightedText getFormattedText(boolean ignoreLetterSpacing) {
|
||||
HighlightedTextWriter writer = new HighlightedTextWriter(Configuration.getCodeFormatting(), true);
|
||||
writer.append("[");
|
||||
String[] alignNames = {"left", "right", "center", "justify"};
|
||||
|
||||
@@ -227,7 +227,7 @@ public abstract class StaticTextTag extends TextTag {
|
||||
}
|
||||
|
||||
@Override
|
||||
public HighlightedText getFormattedText() {
|
||||
public HighlightedText getFormattedText(boolean ignoreLetterSpacing) {
|
||||
FontTag fnt = null;
|
||||
HighlightedTextWriter writer = new HighlightedTextWriter(Configuration.getCodeFormatting(), true);
|
||||
writer.append("[").newLine();
|
||||
@@ -263,7 +263,7 @@ public abstract class StaticTextTag extends TextTag {
|
||||
writer.append("height ").append(rec.textHeight).newLine();
|
||||
textHeight = rec.textHeight;
|
||||
}
|
||||
if (fnt != null) {
|
||||
if (fnt != null && !ignoreLetterSpacing) {
|
||||
int letterSpacing = detectLetterSpacing(rec, fnt, textHeight);
|
||||
if (letterSpacing != 0) {
|
||||
writer.append("letterspacing ").append(letterSpacing).newLine();
|
||||
|
||||
@@ -83,7 +83,7 @@ public abstract class TextTag extends CharacterTag implements DrawableTag {
|
||||
|
||||
public abstract List<Integer> getFontIds();
|
||||
|
||||
public abstract HighlightedText getFormattedText();
|
||||
public abstract HighlightedText getFormattedText(boolean ignoreLetterSpacing);
|
||||
|
||||
// use the texts from the "texts" argument when it is not null
|
||||
public abstract boolean setFormattedText(MissingCharacterHandler missingCharHandler, String formattedText, String[] texts) throws TextParseException;
|
||||
|
||||
Reference in New Issue
Block a user