From 4654d1d6109123b71dffcf08ba39cbcd351c60b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sun, 12 Mar 2023 22:42:08 +0100 Subject: [PATCH] Fixed Do not display fonts added to stage (for example in testdata/as2.swf, the vertical text - sprite 10) --- CHANGELOG.md | 1 + .../jpexs/decompiler/flash/timeline/Timeline.java | 15 +++++++++++++-- src/com/jpexs/decompiler/flash/gui/MainPanel.java | 4 +++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1adff4046..96018c669 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ All notable changes to this project will be documented in this file. - [#1989] AS3 - Slow deobfuscation (AVM2DeobfuscatorSimpleOld) - AS3 - getouterscope instruction support - [#1990] Cloning DefineSprite causing incorrect tags written +- Do not display fonts added to stage (for example in testdata/as2.swf, the vertical text - sprite 10) ### Changed - AS1/2/3 P-code - format Number values with EcmaScript toString function diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java index c98562035..44eb73002 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java @@ -44,6 +44,7 @@ import com.jpexs.decompiler.flash.tags.base.CharacterIdTag; import com.jpexs.decompiler.flash.tags.base.CharacterTag; import com.jpexs.decompiler.flash.tags.base.DisplayObjectCacheKey; import com.jpexs.decompiler.flash.tags.base.DrawableTag; +import com.jpexs.decompiler.flash.tags.base.FontTag; import com.jpexs.decompiler.flash.tags.base.ImageTag; import com.jpexs.decompiler.flash.tags.base.MorphShapeTag; import com.jpexs.decompiler.flash.tags.base.PlaceObjectTypeTag; @@ -337,7 +338,7 @@ public class Timeline { if (swf.getCyclicCharacters().contains(characterId)) { fl.characterId = -1; } - } + } String className = po.getClassName(); if (className != null) { fl.className = className; @@ -348,7 +349,17 @@ public class Timeline { } } } - fl.key = characterId != -1 || className != null; + //Special case, as FontTags are sometimes added to stage (like intestdata/as2.swf, Sprite 10) + //Do not display them. + //Steps to reproduce: Create new static text and set its orientation to vertical + //TODO: handle this better. Do not treat FontTag as drawable for example + if (character instanceof FontTag) { + fl.characterId = -1; + fl.className = null; + fl.key = true; + } else { + fl.key = characterId != -1 || className != null; + } } if (po.flagMove()) { diff --git a/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/src/com/jpexs/decompiler/flash/gui/MainPanel.java index 9f8dbd746..685880420 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -5600,7 +5600,9 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se if (frame < 0 || frame >= pageCount) { frame = 0; } - + //TODO: make this static texts instead of FontTag as drawable. + //We do not want to draw fonts directly added to stage as + //Fonts are really added to stage in some corner cases like for vertical text. Frame f = new Frame(timeline, 0); DepthState ds = new DepthState(tag.getSwf(), f); ds.characterId = ((CharacterTag) tag).getCharacterId();