Skip to content

Commit

Permalink
Fixed Do not display fonts added to stage (for example in testdata/as…
Browse files Browse the repository at this point in the history
…2.swf, the vertical text - sprite 10)
  • Loading branch information
jindrapetrik committed Mar 19, 2023
1 parent e907a37 commit 4654d1d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
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;
Expand Down Expand Up @@ -337,7 +338,7 @@ private synchronized void initialize() {
if (swf.getCyclicCharacters().contains(characterId)) {
fl.characterId = -1;
}
}
}
String className = po.getClassName();
if (className != null) {
fl.className = className;
Expand All @@ -348,7 +349,17 @@ private synchronized void initialize() {
}
}
}
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()) {
Expand Down
4 changes: 3 additions & 1 deletion src/com/jpexs/decompiler/flash/gui/MainPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -5600,7 +5600,9 @@ private void initTimeline(Timeline timeline) {
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();
Expand Down

0 comments on commit 4654d1d

Please sign in to comment.