diff --git a/CHANGELOG.md b/CHANGELOG.md index cc18f601d..e8ce3d36c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ All notable changes to this project will be documented in this file. - [#1672] Raw editor - digits grouping causing incorrect cursor movement - Rename invalid identifiers renames identifiers with a dollar sign - [#1676] Messages on movie tags when Flash Player ActiveX not available +- [#1677] DefineFont2/3 - missing codeTableOffset if numGlyphs is zero ## [14.3.1] - 2021-03-25 ### Fixed @@ -2181,13 +2182,14 @@ All notable changes to this project will be documented in this file. [#1466]: https://www.free-decompiler.com/flash/issues/1466 [#1513]: https://www.free-decompiler.com/flash/issues/1513 [#1657]: https://www.free-decompiler.com/flash/issues/1657 +[#1676]: https://www.free-decompiler.com/flash/issues/1676 [#1660]: https://www.free-decompiler.com/flash/issues/1660 [#1669]: https://www.free-decompiler.com/flash/issues/1669 [#1668]: https://www.free-decompiler.com/flash/issues/1668 [#1670]: https://www.free-decompiler.com/flash/issues/1670 [#1671]: https://www.free-decompiler.com/flash/issues/1671 [#1672]: https://www.free-decompiler.com/flash/issues/1672 -[#1676]: https://www.free-decompiler.com/flash/issues/1676 +[#1677]: https://www.free-decompiler.com/flash/issues/1677 [#1665]: https://www.free-decompiler.com/flash/issues/1665 [#1661]: https://www.free-decompiler.com/flash/issues/1661 [#1435]: https://www.free-decompiler.com/flash/issues/1435 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 c2368b1c5..10e43d46a 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 @@ -152,12 +152,11 @@ public class DefineFont2Tag extends FontTag { offsetTable[i] = sis.readUI16("offset"); } } - if (numGlyphs > 0) { //codeTableOffset - if (fontFlagsWideOffsets) { - sis.readUI32("codeTableOffset"); - } else { - sis.readUI16("codeTableOffset"); - } + + if (fontFlagsWideOffsets) { + sis.readUI32("codeTableOffset"); + } else { + sis.readUI16("codeTableOffset"); } glyphShapeTable = new ArrayList<>(); @@ -280,23 +279,24 @@ public class DefineFont2Tag extends FontTag { sos.writeUI16((int) (long) offset); } } - if (numGlyphs > 0) { - long offset = (glyphShapeTable.size() + 1/*CodeTableOffset*/) * (fontFlagsWideOffsets ? 4 : 2) + baGlyphShapes.length; - if (fontFlagsWideOffsets) { - sos.writeUI32(offset); - } else { - sos.writeUI16((int) offset); - } - sos.write(baGlyphShapes); - for (int i = 0; i < numGlyphs; i++) { - if (fontFlagsWideCodes) { - sos.writeUI16(codeTable.get(i)); - } else { - sos.writeUI8(codeTable.get(i)); - } + long offset = (glyphShapeTable.size() + 1/*CodeTableOffset*/) * (fontFlagsWideOffsets ? 4 : 2) + baGlyphShapes.length; + if (fontFlagsWideOffsets) { + sos.writeUI32(offset); + } else { + sos.writeUI16((int) offset); + } + if (numGlyphs > 0) { + sos.write(baGlyphShapes); + } + for (int i = 0; i < numGlyphs; i++) { + if (fontFlagsWideCodes) { + sos.writeUI16(codeTable.get(i)); + } else { + sos.writeUI8(codeTable.get(i)); } } + if (fontFlagsHasLayout) { sos.writeUI16(fontAscent); sos.writeUI16(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 9b20038e3..59a1d85c9 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 @@ -145,12 +145,10 @@ public class DefineFont3Tag extends FontTag { offsetTable[i] = sis.readUI16("offset"); } } - if (numGlyphs > 0) { - if (fontFlagsWideOffsets) { - sis.readUI32("codeTableOffset"); //codeTableOffset - } else { - sis.readUI16("codeTableOffset"); //codeTableOffset - } + if (fontFlagsWideOffsets) { + sis.readUI32("codeTableOffset"); + } else { + sis.readUI16("codeTableOffset"); } glyphShapeTable = new ArrayList<>(); for (int i = 0; i < numGlyphs; i++) { @@ -271,23 +269,24 @@ public class DefineFont3Tag extends FontTag { sos.writeUI16((int) offset2); } } + long offset = (glyphShapeTable.size() + 1/*CodeTableOffset*/) * (fontFlagsWideOffsets ? 4 : 2) + baGlyphShapes.length; + if (fontFlagsWideOffsets) { + sos.writeUI32(offset); + } else { + sos.writeUI16((int) offset); + } if (numGlyphs > 0) { - long offset = (glyphShapeTable.size() + 1/*CodeTableOffset*/) * (fontFlagsWideOffsets ? 4 : 2) + baGlyphShapes.length; - if (fontFlagsWideOffsets) { - sos.writeUI32(offset); - } else { - sos.writeUI16((int) offset); - } sos.write(baGlyphShapes); + } - for (int i = 0; i < numGlyphs; i++) { - if (fontFlagsWideCodes) { - sos.writeUI16(codeTable.get(i)); - } else { - sos.writeUI8(codeTable.get(i)); - } + for (int i = 0; i < numGlyphs; i++) { + if (fontFlagsWideCodes) { + sos.writeUI16(codeTable.get(i)); + } else { + sos.writeUI8(codeTable.get(i)); } } + if (fontFlagsHasLayout) { sos.writeUI16(fontAscent); sos.writeUI16(fontDescent);