From 06b3deda28a21f8c111588a4e6b4f3dbe6e8e352 Mon Sep 17 00:00:00 2001 From: "honfika@gmail.com" Date: Sun, 7 Sep 2014 23:26:20 +0200 Subject: [PATCH] #668: text tags fixed --- .../methodinfo_parser/MethodInfoLexer.java | 3 +- .../decompiler/flash/tags/base/FontTag.java | 47 ++++++++++--------- 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/methodinfo_parser/MethodInfoLexer.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/methodinfo_parser/MethodInfoLexer.java index 607b11ab4..3b957c44c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/methodinfo_parser/MethodInfoLexer.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/methodinfo_parser/MethodInfoLexer.java @@ -758,8 +758,7 @@ public final class MethodInfoLexer { * * @return the next token * @exception java.io.IOException if any I/O-Error occurs - * @throws - * com.jpexs.decompiler.flash.abc.methodinfo_parser.MethodInfoParseException + * @throws MethodInfoParseException */ public ParsedSymbol yylex() throws java.io.IOException, MethodInfoParseException { int zzInput; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/FontTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/FontTag.java index d5109b21a..86ec24769 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/FontTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/FontTag.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.tags.base; import com.jpexs.decompiler.flash.SWF; @@ -166,29 +167,33 @@ public abstract class FontTag extends CharacterTag implements AloneTag, Drawable } public void shiftGlyphIndices(int fontId, int startIndex) { - List textRecords = new ArrayList<>(); for (Tag t : swf.tags) { + List textRecords = null; if (t instanceof DefineTextTag) { - textRecords.addAll(((DefineTextTag) t).textRecords); + textRecords = ((DefineTextTag) t).textRecords; + } else if (t instanceof DefineText2Tag) { + textRecords = ((DefineText2Tag) t).textRecords; } - if (t instanceof DefineText2Tag) { - textRecords.addAll(((DefineText2Tag) t).textRecords); - } - } - int curFontId = 0; - for (TEXTRECORD tr : textRecords) { - if (tr.styleFlagsHasFont) { - curFontId = tr.fontId; - } - if (curFontId != fontId) { - continue; - } - for (GLYPHENTRY en : tr.glyphEntries) { - if (en == null) { //Currently edited - continue; - } - if (en.glyphIndex >= startIndex) { - en.glyphIndex++; + + if (textRecords != null) { + int curFontId = 0; + for (TEXTRECORD tr : textRecords) { + if (tr.styleFlagsHasFont) { + curFontId = tr.fontId; + } + if (curFontId != fontId) { + continue; + } + for (GLYPHENTRY en : tr.glyphEntries) { + if (en == null) { //Currently edited + continue; + } + if (en.glyphIndex >= startIndex) { + en.glyphIndex++; + } + } + + t.setModified(true); } } }