From 72af4e6e93f284c736636b8e4bfc7a0506dae67d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sat, 3 Dec 2016 09:32:43 +0100 Subject: [PATCH] put advances back as were, fix font data size --- .../flash/iggy/IggyCharAdvances.java | 18 ++++++------------ .../jpexs/decompiler/flash/iggy/IggyFont.java | 2 +- .../jpexs/decompiler/flash/iggy/IggySwf.java | 4 ++-- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/iggy/IggyCharAdvances.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/iggy/IggyCharAdvances.java index 628c4dd1f..537e6be3b 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/iggy/IggyCharAdvances.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/iggy/IggyCharAdvances.java @@ -14,35 +14,29 @@ import java.util.List; public class IggyCharAdvances implements StructureInterface { List advances; - private List glyphs; + private long charCount; public List getScales() { return advances; } - public IggyCharAdvances(ReadDataStreamInterface stream, List glyphs) throws IOException { - this.glyphs = glyphs; + public IggyCharAdvances(ReadDataStreamInterface stream, long charCount) throws IOException { + this.charCount = charCount; readFromDataStream(stream); } @Override public void readFromDataStream(ReadDataStreamInterface stream) throws IOException { advances = new ArrayList<>(); - for (int i = 0; i < glyphs.size(); i++) { - if (glyphs.get(i) != null) { - advances.add(stream.readFloat()); - } else { - advances.add(null); - } + for (int i = 0; i < charCount; i++) { + advances.add(stream.readFloat()); } } @Override public void writeToDataStream(WriteDataStreamInterface stream) throws IOException { for (int i = 0; i < advances.size(); i++) { - if (advances.get(i) != null) { - stream.writeFloat(advances.get(i)); - } + stream.writeFloat(advances.get(i)); } } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/iggy/IggyFont.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/iggy/IggyFont.java index 0f175d5d2..c70b17c98 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/iggy/IggyFont.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/iggy/IggyFont.java @@ -285,7 +285,7 @@ public class IggyFont extends IggyTag { } if (abs_start_of_scale != 0) { s.seek(abs_start_of_scale, SeekMode.SET); - charScales = new IggyCharAdvances(s, glyphs); + charScales = new IggyCharAdvances(s, char_count); } if (abs_start_of_kern != 0) { s.seek(abs_start_of_kern, SeekMode.SET); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/iggy/IggySwf.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/iggy/IggySwf.java index 1905eebad..eedd9101f 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/iggy/IggySwf.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/iggy/IggySwf.java @@ -114,7 +114,7 @@ public class IggySwf implements StructureInterface { if (next_offset == 1) { font_data_sizes[i] = hdr.getFontEndAddress() - font_data_addresses[i]; } else { - font_data_sizes[i] = next_offset - offset; + font_data_sizes[i] = next_offset - offset + 8; } } while (true) { @@ -130,7 +130,7 @@ public class IggySwf implements StructureInterface { text_data_sizes.add(hdr.getFontEndAddress() - text_addr); break; } else { - text_data_sizes.add(next_offset - offset); + text_data_sizes.add(next_offset - offset + 8); } } s.readUI64(); //1