diff --git a/.gitignore b/.gitignore index e7ae37017..63b993378 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,8 @@ hs_err_pid*.log *.~* /revision.txt /lib/ffdec_lib.jar +/lib/README.TXT +/libsrc/avi/nbproject/private/ /libsrc/gnujpdf/dist/ /libsrc/jsyntaxpane/jsyntaxpane/target/ /libsrc/ffdec_lib/build/ @@ -52,5 +54,4 @@ hs_err_pid*.log /jpexs_website.properties /version.properties /tools.properties -/nbproject/private/ -/libsrc/avi/nbproject/private/ \ No newline at end of file +/nbproject/private/ \ No newline at end of file diff --git a/lib/ttf.jar b/lib/ttf.jar index e07d1e1f4..509a4c424 100644 Binary files a/lib/ttf.jar and b/lib/ttf.jar differ diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2ConstantPool.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2ConstantPool.java index 38f8000ae..a8bc62468 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2ConstantPool.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2ConstantPool.java @@ -131,7 +131,7 @@ public class AVM2ConstantPool { try { return constant_int.get(index); } catch (IndexOutOfBoundsException ex) { - logger.log(Level.SEVERE, "Multiname not found. Index: " + index, ex); + logger.log(Level.SEVERE, "Int not found. Index: " + index, ex); } return 0; } @@ -140,7 +140,7 @@ public class AVM2ConstantPool { try { return constant_namespace.get(index); } catch (IndexOutOfBoundsException ex) { - logger.log(Level.SEVERE, "Multiname not found. Index: " + index, ex); + logger.log(Level.SEVERE, "Namespace not found. Index: " + index, ex); } return null; } @@ -149,7 +149,7 @@ public class AVM2ConstantPool { try { return constant_namespace_set.get(index); } catch (IndexOutOfBoundsException ex) { - logger.log(Level.SEVERE, "Multiname not found. Index: " + index, ex); + logger.log(Level.SEVERE, "NamespaceSet not found. Index: " + index, ex); } return null; } @@ -167,7 +167,7 @@ public class AVM2ConstantPool { try { return constant_uint.get(index); } catch (IndexOutOfBoundsException ex) { - logger.log(Level.SEVERE, "Multiname not found. Index: " + index, ex); + logger.log(Level.SEVERE, "UInt not found. Index: " + index, ex); } return 0; } @@ -176,7 +176,7 @@ public class AVM2ConstantPool { try { return constant_double.get(index); } catch (IndexOutOfBoundsException ex) { - logger.log(Level.SEVERE, "Multiname not found. Index: " + index, ex); + logger.log(Level.SEVERE, "Double not found. Index: " + index, ex); } return 0; } @@ -185,7 +185,7 @@ public class AVM2ConstantPool { try { return constant_decimal.get(index); } catch (IndexOutOfBoundsException ex) { - logger.log(Level.SEVERE, "Multiname not found. Index: " + index, ex); + logger.log(Level.SEVERE, "Decimal not found. Index: " + index, ex); } return null; } @@ -194,7 +194,7 @@ public class AVM2ConstantPool { try { return constant_string.get(index); } catch (IndexOutOfBoundsException ex) { - logger.log(Level.SEVERE, "Multiname not found. Index: " + index, ex); + logger.log(Level.SEVERE, "String not found. Index: " + index, ex); } return null; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/FontExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/FontExporter.java index e801010c5..1aa0a282e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/FontExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/FontExporter.java @@ -25,6 +25,7 @@ import com.jpexs.decompiler.flash.ApplicationInfo; import com.jpexs.decompiler.flash.EventListener; import com.jpexs.decompiler.flash.RetryTask; import com.jpexs.decompiler.flash.RunnableIOEx; +import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.exporters.modes.FontExportMode; import com.jpexs.decompiler.flash.exporters.settings.FontExportSettings; import com.jpexs.decompiler.flash.exporters.shape.PathExporter; @@ -41,6 +42,7 @@ import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.util.ArrayList; +import java.util.Date; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; @@ -147,6 +149,16 @@ public class FontExporter { f.getEngine().setCopyrightYear(cop == null ? "" : cop); f.setAuthor(ApplicationInfo.shortApplicationVerName); f.setVersion("1.0"); + + SWF swf = t.getSwf(); + if (swf != null && swf.swfList != null && swf.swfList.sourceInfo != null) { + String fileName = swf.swfList.sourceInfo.getFile(); + if (fileName != null) { + Date date = new Date(new File(fileName).lastModified()); + f.setCreationDate(date); + f.setModificationDate(date); + } + } int ascent = t.getAscent(); if (ascent != -1) { 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 1ad898740..6ce8def44 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 @@ -248,7 +248,7 @@ public abstract class TextTag extends CharacterTag implements DrawableTag { double descent = 0; double lineDistance = 0; - List glyphs = new ArrayList<>(); + List glyphs = null; boolean firstLine = true; double top = 0; List allLeftMargins = new ArrayList<>(); @@ -403,7 +403,7 @@ public abstract class TextTag extends CharacterTag implements DrawableTag { int textHeight = 12; int x = 0; int y = 0; - List glyphs = new ArrayList<>(); + List glyphs = null; for (TEXTRECORD rec : textRecords) { if (rec.styleFlagsHasColor) { if (numText == 2) { @@ -458,7 +458,7 @@ public abstract class TextTag extends CharacterTag implements DrawableTag { int textHeight = 12; int x = 0; int y = 0; - List glyphs = new ArrayList<>(); + List glyphs = null; ExportRectangle result = null; for (TEXTRECORD rec : textRecords) { if (rec.styleFlagsHasFont) { diff --git a/libsrc/ttf/src/fontastic/Fontastic.java b/libsrc/ttf/src/fontastic/Fontastic.java index 8e62b2030..a997b0e5a 100644 --- a/libsrc/ttf/src/fontastic/Fontastic.java +++ b/libsrc/ttf/src/fontastic/Fontastic.java @@ -29,6 +29,7 @@ package fontastic; import java.io.File; import java.io.IOException; import java.util.ArrayList; +import java.util.Date; import java.util.List; import org.doubletype.ossa.Engine; import org.doubletype.ossa.OutOfRangeException; @@ -201,6 +202,14 @@ public class Fontastic { m_engine.setCopyrightYear(copyrightYear); } + public void setCreationDate(Date date) { + m_engine.setCreationDate(date); + } + + public void setModificationDate(Date date) { + m_engine.setModificationDate(date); + } + /** * Sets the version of the font (default is "0.1"). */ diff --git a/libsrc/ttf/src/org/doubletype/ossa/Engine.java b/libsrc/ttf/src/org/doubletype/ossa/Engine.java index a3f2d6499..359f72bcb 100644 --- a/libsrc/ttf/src/org/doubletype/ossa/Engine.java +++ b/libsrc/ttf/src/org/doubletype/ossa/Engine.java @@ -187,6 +187,22 @@ public class Engine { m_typeface.setCopyrightYear(a_value); } + public void setCreationDate(Date a_value) { + if (m_typeface == null) { + return; + } + + m_typeface.setCreationDate(a_value); + } + + public void setModificationDate(Date a_value) { + if (m_typeface == null) { + return; + } + + m_typeface.setModificationDate(a_value); + } + public void setFontFamilyName(String a_value) { if (m_typeface == null) { return; diff --git a/libsrc/ttf/src/org/doubletype/ossa/module/GlyphFile.java b/libsrc/ttf/src/org/doubletype/ossa/module/GlyphFile.java index 0a34ae5cc..64778d09c 100644 --- a/libsrc/ttf/src/org/doubletype/ossa/module/GlyphFile.java +++ b/libsrc/ttf/src/org/doubletype/ossa/module/GlyphFile.java @@ -35,6 +35,7 @@ package org.doubletype.ossa.module; import java.awt.Point; import java.io.File; import java.util.ArrayList; +import java.util.Date; import java.util.List; import org.doubletype.ossa.adapter.EContour; import org.doubletype.ossa.adapter.EContourPoint; @@ -52,6 +53,10 @@ public class GlyphFile { private String m_copyrightYear; + private Date m_creationDate; + + private Date m_modificationDate; + private String m_license; private Integer m_advanceWidth = null; @@ -149,6 +154,22 @@ public class GlyphFile { return m_copyrightYear; } + public void setCreationDate(Date a_value) { + m_creationDate = a_value; + } + + public Date getCreationDate() { + return m_creationDate; + } + + public void setModificationDate(Date a_value) { + m_modificationDate = a_value; + } + + public Date getModificationDate() { + return m_modificationDate; + } + public void setAdvanceWidth(int a_width) { m_advanceWidth = a_width; } diff --git a/libsrc/ttf/src/org/doubletype/ossa/module/TypefaceFile.java b/libsrc/ttf/src/org/doubletype/ossa/module/TypefaceFile.java index 11b32267e..cdf30fa66 100644 --- a/libsrc/ttf/src/org/doubletype/ossa/module/TypefaceFile.java +++ b/libsrc/ttf/src/org/doubletype/ossa/module/TypefaceFile.java @@ -389,6 +389,8 @@ public class TypefaceFile extends GlyphFile { writer.setFontFamilyName(fontFamilyName); writer.setCopyrightYear(getCopyrightYear()); + writer.setCreationDate(getCreationDate()); + writer.setModificationDate(getModificationDate()); writer.setFontVersion(getVersion()); writer.setManufacturer(getAuthor()); writer.setAscent((int) getAscender()); diff --git a/libsrc/ttf/src/org/doubletype/ossa/truetype/FontFileWriter.java b/libsrc/ttf/src/org/doubletype/ossa/truetype/FontFileWriter.java index 5a56238e1..2b6e41a2d 100644 --- a/libsrc/ttf/src/org/doubletype/ossa/truetype/FontFileWriter.java +++ b/libsrc/ttf/src/org/doubletype/ossa/truetype/FontFileWriter.java @@ -39,6 +39,7 @@ import java.io.RandomAccessFile; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; +import java.util.Date; /** * @author e.e @@ -225,6 +226,14 @@ public class FontFileWriter extends FontFormatWriter { public TTGlyph getGlyph(int a_index) { return m_glyf.getGlyph(a_index); } + + public void setCreationDate(Date a_date) { + m_head.setCreationDate(a_date); + } + + public void setModificationDate(Date a_date) { + m_head.setModificationDate(a_date); + } /** * adds character mapping to diff --git a/libsrc/ttf/src/org/doubletype/ossa/truetype/HeadWriter.java b/libsrc/ttf/src/org/doubletype/ossa/truetype/HeadWriter.java index 4716deebf..2f18831ae 100644 --- a/libsrc/ttf/src/org/doubletype/ossa/truetype/HeadWriter.java +++ b/libsrc/ttf/src/org/doubletype/ossa/truetype/HeadWriter.java @@ -73,6 +73,10 @@ public class HeadWriter extends FontFormatWriter { private Point m_min = new Point(0, 0); private Point m_max = new Point(0, 0); + + private Date m_creationDate = new Date(); + + private Date m_modificationDate = m_creationDate; public HeadWriter() { super(); @@ -109,6 +113,14 @@ public class HeadWriter extends FontFormatWriter { m_max.y = a_value.y; } } + + public void setCreationDate(Date a_date) { + m_creationDate = a_date; + } + + public void setModificationDate(Date a_date) { + m_modificationDate = a_date; + } public void write() throws IOException { // table version number @@ -130,8 +142,8 @@ public class HeadWriter extends FontFormatWriter { writeUInt16(1024); // created, modified - writeLongDateTime(new Date()); - writeLongDateTime(new Date()); + writeLongDateTime(m_creationDate); + writeLongDateTime(m_modificationDate); writeFWord(m_min.x); writeFWord(m_min.y); diff --git a/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java b/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java index 1d26f6b76..565012593 100644 --- a/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java +++ b/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java @@ -126,6 +126,10 @@ public class CommandLineArgumentParser { private static boolean commandLineMode = false; + private static String stdOut = null; + + private static String stdErr = null; + @SuppressWarnings("unchecked") private static final ConfigurationItem[] commandlineConfigBoolean = new ConfigurationItem[]{ Configuration.decompile, @@ -368,6 +372,12 @@ public class CommandLineArgumentParser { case "-exportfiletimeout": parseExportFileTimeout(args); break; + case "-stdout": + parseStdOut(args); + break; + case "-stderr": + parseStdErr(args); + break; case "-affinity": parseAffinity(args); break; @@ -717,6 +727,24 @@ public class CommandLineArgumentParser { } } + private static void parseStdOut(Stack args) { + if (args.isEmpty()) { + System.err.println("stdOut parameter expected"); + badArguments(); + } + + stdOut = args.pop(); + } + + private static void parseStdErr(Stack args) { + if (args.isEmpty()) { + System.err.println("stdErr parameter expected"); + badArguments(); + } + + stdErr = args.pop(); + } + private static void parseAffinity(Stack args) { if (Platform.isWindows()) { if (args.isEmpty()) { @@ -886,6 +914,15 @@ public class CommandLineArgumentParser { } for (File inFile : inFiles) { + String inFileName = Path.getFileNameWithoutExtension(inFile); + if (stdOut != null) { + System.setOut(new PrintStream(new FileOutputStream(stdOut.replace("{swfFile}", inFileName), true))); + } + + if (stdErr != null) { + System.setErr(new PrintStream(new FileOutputStream(stdErr.replace("{swfFile}", inFileName), true))); + } + long startTimeSwf = 0; if (!singleFile) { startTimeSwf = System.currentTimeMillis();