mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-04 17:54:18 +00:00
set font creation and modification time to the modification time of the swf file
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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").
|
||||
*/
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user