diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFont2Tag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFont2Tag.java index 5e026016c..dc0d73cf2 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFont2Tag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFont2Tag.java @@ -231,24 +231,26 @@ public class DefineFont2Tag extends FontTag { fontName = new String(sis.readBytesEx(fontNameLen, "fontName")); } numGlyphs = sis.readUI16("numGlyphs"); - //offsetTable = new long[numGlyphs]; + long[] offsetTable = new long[numGlyphs]; + long pos = sis.getPos(); for (int i = 0; i < numGlyphs; i++) { //offsetTable if (fontFlagsWideOffsets) { - sis.readUI32("offset"); + offsetTable[i] = sis.readUI32("offset"); } else { - sis.readUI16("offset"); + offsetTable[i] = sis.readUI16("offset"); } } if (numGlyphs > 0) { //codeTableOffset if (fontFlagsWideOffsets) { - sis.readUI32("offset"); + sis.readUI32("codeTableOffset"); } else { - sis.readUI16("offset"); + sis.readUI16("codeTableOffset"); } } glyphShapeTable = new ArrayList<>(); for (int i = 0; i < numGlyphs; i++) { + sis.seek(pos + offsetTable[i]); glyphShapeTable.add(sis.readSHAPE(1, false, "shape")); } @@ -260,6 +262,7 @@ public class DefineFont2Tag extends FontTag { codeTable.add(sis.readUI8("code")); } } + if (fontFlagsHasLayout) { fontAscent = sis.readSI16("fontAscent"); fontDescent = sis.readSI16("fontDescent"); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFont3Tag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFont3Tag.java index bd45194f1..4f2247b37 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFont3Tag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFont3Tag.java @@ -144,22 +144,25 @@ public class DefineFont3Tag extends FontTag { fontName = new String(sis.readBytesEx(fontNameLen, "fontName")); } numGlyphs = sis.readUI16("numGlyphs"); + long[] offsetTable = new long[numGlyphs]; + long pos = sis.getPos(); for (int i = 0; i < numGlyphs; i++) { //offsetTable if (fontFlagsWideOffsets) { - sis.readUI32("offset"); + offsetTable[i] = sis.readUI32("offset"); } else { - sis.readUI16("offset"); + offsetTable[i] = sis.readUI16("offset"); } } if (numGlyphs > 0) { if (fontFlagsWideOffsets) { - sis.readUI32("offset"); //codeTableOffset + sis.readUI32("codeTableOffset"); //codeTableOffset } else { - sis.readUI16("offset"); //codeTableOffset + sis.readUI16("codeTableOffset"); //codeTableOffset } } glyphShapeTable = new ArrayList<>(); for (int i = 0; i < numGlyphs; i++) { + sis.seek(pos + offsetTable[i]); glyphShapeTable.add(sis.readSHAPE(1, false, "shape")); } codeTable = new ArrayList<>(); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontTag.java index d7e2bea7e..50ba570a3 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFontTag.java @@ -160,13 +160,17 @@ public class DefineFontTag extends FontTag { glyphShapeTable = new ArrayList<>(); if (sis.available() > 0) { + long pos = sis.getPos(); int firstOffset = sis.readUI16("firstOffset"); int nGlyphs = firstOffset / 2; + long[] offsetTable = new long[nGlyphs]; + offsetTable[0] = firstOffset; for (int i = 1; i < nGlyphs; i++) { - sis.readUI16("offset"); //offset + offsetTable[i] = sis.readUI16("offset"); } for (int i = 0; i < nGlyphs; i++) { + sis.seek(pos + offsetTable[i]); glyphShapeTable.add(sis.readSHAPE(1, false, "shape")); } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/TextTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/TextTag.java index 48d4e38fc..e6550695f 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/TextTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/TextTag.java @@ -288,7 +288,7 @@ public abstract class TextTag extends CharacterTag implements DrawableTag { } if (rec.styleFlagsHasFont) { font = (FontTag) swf.characters.get(rec.fontId); - glyphs = font.getGlyphShapeTable(); + glyphs = font == null ? null : font.getGlyphShapeTable(); textHeight = rec.textHeight; } if (rec.styleFlagsHasXOffset) { @@ -306,7 +306,7 @@ public abstract class TextTag extends CharacterTag implements DrawableTag { Matrix matTr = Matrix.getTranslateInstance(x, y); mat = mat.concatenate(matTr); mat = mat.concatenate(Matrix.getScaleInstance(rat)); - if (entry.glyphIndex != -1) { + if (entry.glyphIndex != -1 && glyphs != null) { // shapeNum: 1 SHAPE shape = glyphs.get(entry.glyphIndex); BitmapExporter.export(swf, shape, textColor, image, mat, colorTransform); 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 2b75b92d5..056bba71a 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 @@ -143,7 +143,7 @@ public class Timeline { this.id = id; this.swf = swf; this.displayRect = displayRect; - this.frameRate = swf.frameRate; + this.frameRate = swf.frameRate < 1 ? 1 : swf.frameRate; this.timelined = parentTag == null ? swf : (Timelined) parentTag; this.parentTag = parentTag; this.tags = tags;