From e4efcc60686a2871babc95f48b8a492c63a4fdfc Mon Sep 17 00:00:00 2001 From: "honfika@gmail.com" Date: Fri, 27 Mar 2015 14:31:34 +0100 Subject: [PATCH] font export fix --- .../decompiler/flash/exporters/FontExporter.java | 11 +++++++++-- .../flash/console/CommandLineArgumentParser.java | 13 +++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) 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 7f1a86325..7bc93147a 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 @@ -149,8 +149,15 @@ public class FontExporter { f.setAuthor(ApplicationInfo.shortApplicationVerName); f.setVersion("1.0"); - f.setAscender(Math.round(t.getAscent() / divider)); - f.setDescender(Math.round(t.getDescent() / divider)); + int ascent = t.getAscent(); + if (ascent != -1) { + f.setAscender(Math.round(ascent / divider)); + } + + int descent = t.getDescent(); + if (descent != -1) { + f.setDescender(Math.round(descent / divider)); + } int glyphCount = 0; for (int i = 0; i < shapes.size(); i++) { diff --git a/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java b/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java index 1ab2fd4d1..1d26f6b76 100644 --- a/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java +++ b/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java @@ -886,6 +886,12 @@ public class CommandLineArgumentParser { } for (File inFile : inFiles) { + long startTimeSwf = 0; + if (!singleFile) { + startTimeSwf = System.currentTimeMillis(); + System.out.println("Start exporting " + inFile.getName()); + } + SWF exfile = new SWF(new FileInputStream(inFile), Configuration.parallelSpeedUp.get()); String outDir = outDirBase.getAbsolutePath(); if (!singleFile) { @@ -1037,12 +1043,19 @@ public class CommandLineArgumentParser { } exfile.exportXfl(handler, outDir + (multipleExportTypes ? File.separator + "xfl" : ""), inFile.getName(), ApplicationInfo.APPLICATION_NAME, ApplicationInfo.applicationVerName, ApplicationInfo.version, Configuration.parallelSpeedUp.get(), xflVersion); } + + if (!singleFile) { + long stopTimeSwf = System.currentTimeMillis(); + long time = stopTimeSwf - startTimeSwf; + System.out.println("Export finished: " + inFile.getName() + " Export time: " + Helper.formatTimeSec(time)); + } } } catch (OutOfMemoryError | Exception ex) { System.err.print("FAIL: Exporting Failed on Exception - "); Logger.getLogger(CommandLineArgumentParser.class.getName()).log(Level.SEVERE, null, ex); System.exit(1); } + long stopTime = System.currentTimeMillis(); long time = stopTime - startTime; System.out.println("Export finished. Total export time: " + Helper.formatTimeSec(time));