set font creation and modification time to the modification time of the swf file

This commit is contained in:
honfika@gmail.com
2015-03-30 20:05:34 +02:00
parent 2d37d31dcc
commit 3ca2877834
12 changed files with 133 additions and 14 deletions

5
.gitignore vendored
View File

@@ -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/
/nbproject/private/

Binary file not shown.

View File

@@ -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;
}

View File

@@ -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) {

View File

@@ -248,7 +248,7 @@ public abstract class TextTag extends CharacterTag implements DrawableTag {
double descent = 0;
double lineDistance = 0;
List<SHAPE> glyphs = new ArrayList<>();
List<SHAPE> glyphs = null;
boolean firstLine = true;
double top = 0;
List<Integer> 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<SHAPE> glyphs = new ArrayList<>();
List<SHAPE> 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<SHAPE> glyphs = new ArrayList<>();
List<SHAPE> glyphs = null;
ExportRectangle result = null;
for (TEXTRECORD rec : textRecords) {
if (rec.styleFlagsHasFont) {

View File

@@ -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").
*/

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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());

View File

@@ -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

View File

@@ -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);

View File

@@ -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<Boolean>[] 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<String> args) {
if (args.isEmpty()) {
System.err.println("stdOut parameter expected");
badArguments();
}
stdOut = args.pop();
}
private static void parseStdErr(Stack<String> args) {
if (args.isEmpty()) {
System.err.println("stdErr parameter expected");
badArguments();
}
stdErr = args.pop();
}
private static void parseAffinity(Stack<String> 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();