diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/FontPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/FontPanel.java index 4a5bb1142..fda4a0257 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/FontPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/FontPanel.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.gui; import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.configuration.Configuration; +import com.jpexs.decompiler.flash.tags.DefineTextTag; import com.jpexs.decompiler.flash.tags.Tag; import com.jpexs.decompiler.flash.tags.base.FontTag; import com.jpexs.decompiler.flash.tags.base.TextTag; @@ -259,12 +260,15 @@ public class FontPanel extends JPanel implements ActionListener { oldchars += c; } + int fontId = ft.getFontId(); if (updateTextsCheckBox.isSelected()) { for (Tag tag : swf.tags) { if (tag instanceof TextTag) { TextTag textTag = (TextTag) tag; - String text = textTag.getFormattedText(textTag.getSwf().tags); - mainPanel.saveText(textTag, text); + if (textTag.getFontIds(swf.tags).contains(fontId)) { + String text = textTag.getFormattedText(textTag.getSwf().tags); + mainPanel.saveText(textTag, text); + } } } } diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java index 4c46964dc..c4f658fff 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java @@ -34,6 +34,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; import java.io.StringReader; +import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -139,6 +140,13 @@ public class DefineEditTextTag extends TextTag { return ret; } + @Override + public List getFontIds(List tags) { + List ret = new ArrayList<>(); + ret.add(fontId); + return ret; + } + @Override public String getFormattedText(List tags) { String ret = ""; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java index 17885dd15..c1e1b4363 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java @@ -102,6 +102,17 @@ public class DefineText2Tag extends TextTag implements DrawableTag { return ret; } + @Override + public List getFontIds(List tags) { + List ret = new ArrayList<>(); + for (TEXTRECORD rec : textRecords) { + if (rec.styleFlagsHasFont) { + ret.add(rec.fontId); + } + } + return ret; + } + @Override public String getFormattedText(List tags) { FontTag fnt = null; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java index 78c6d7674..c4ef7c6ac 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java @@ -102,6 +102,17 @@ public class DefineTextTag extends TextTag implements DrawableTag { return ret; } + @Override + public List getFontIds(List tags) { + List ret = new ArrayList<>(); + for (TEXTRECORD rec : textRecords) { + if (rec.styleFlagsHasFont) { + ret.add(rec.fontId); + } + } + return ret; + } + @Override public String getFormattedText(List tags) { FontTag fnt = null; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/base/TextTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/base/TextTag.java index 9467e51d9..53afc1858 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/base/TextTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/base/TextTag.java @@ -54,6 +54,8 @@ public abstract class TextTag extends CharacterTag implements BoundedTag { public abstract String getText(List tags); + public abstract List getFontIds(List tags); + public abstract String getFormattedText(List tags); public abstract boolean setFormattedText(MissingCharacterHandler missingCharHandler, List tags, String text) throws ParseException;