diff --git a/CHANGELOG.md b/CHANGELOG.md index b1f398769..b30bfe4ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,8 @@ All notable changes to this project will be documented in this file. - [#2231] AS3 coercion to String as convert - [#2257] Shape SVG Importer - Linear gradient matrix - [#2253] Drawing 0,0 grid in transform tool on Linux causing sun internal errors +- [#2239] Default font name detection +- [#2239] Exporting TTF font on Linux ### Changed - [#2185] MochiCrypt no longer offered for auto decrypt, user needs to choose variant from "Use unpacker" menu @@ -3418,6 +3420,7 @@ Major version of SWF to XML export changed to 2. [#2231]: https://www.free-decompiler.com/flash/issues/2231 [#2257]: https://www.free-decompiler.com/flash/issues/2257 [#2253]: https://www.free-decompiler.com/flash/issues/2253 +[#2239]: https://www.free-decompiler.com/flash/issues/2239 [#2206]: https://www.free-decompiler.com/flash/issues/2206 [#2100]: https://www.free-decompiler.com/flash/issues/2100 [#2123]: https://www.free-decompiler.com/flash/issues/2123 diff --git a/lib/ttf.jar b/lib/ttf.jar index 64ca2391b..37e97a55a 100644 Binary files a/lib/ttf.jar and b/lib/ttf.jar differ diff --git a/libsrc/ffdec_lib/lib/ttf.jar b/libsrc/ffdec_lib/lib/ttf.jar index 64ca2391b..37e97a55a 100644 Binary files a/libsrc/ffdec_lib/lib/ttf.jar and b/libsrc/ffdec_lib/lib/ttf.jar differ 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 943417a21..398064def 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 @@ -128,7 +128,7 @@ public class FontExporter { currentIndex++; } } - + return ret; } @@ -158,7 +158,7 @@ public class FontExporter { final double divider = t.getDivider(); File ttfFile = file; - + if (mode == FontExportMode.WOFF) { ttfFile = File.createTempFile("ffdec_export", ".ttf"); } @@ -167,7 +167,7 @@ public class FontExporter { if (fontName.length() == 0) { fontName = "noname"; } - + Fontastic f = new Fontastic(fontName, ttfFile); String cop = t.getCopyright(); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/FontTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/FontTag.java index c932248af..9e3bf7130 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/FontTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/FontTag.java @@ -376,11 +376,11 @@ public abstract class FontTag extends DrawableTag implements AloneTag { } if (installedFontsByFamily.containsKey("Times New Roman")) { - defaultFontName = "Times New Roman"; + defaultFontName = installedFontsByFamily.get("Times New Roman").keySet().iterator().next(); } else if (installedFontsByFamily.containsKey("Arial")) { - defaultFontName = "Arial"; + defaultFontName = installedFontsByFamily.get("Arial").keySet().iterator().next(); } else { - defaultFontName = installedFontsByFamily.keySet().iterator().next(); + defaultFontName = installedFontsByFamily.get(installedFontsByFamily.keySet().iterator().next()).keySet().iterator().next(); } } diff --git a/libsrc/ttf/src/fontastic/Fontastic.java b/libsrc/ttf/src/fontastic/Fontastic.java index a997b0e5a..59f6d236b 100644 --- a/libsrc/ttf/src/fontastic/Fontastic.java +++ b/libsrc/ttf/src/fontastic/Fontastic.java @@ -28,9 +28,15 @@ package fontastic; import java.io.File; import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; import org.doubletype.ossa.Engine; import org.doubletype.ossa.OutOfRangeException; import org.doubletype.ossa.adapter.EContour; @@ -169,11 +175,18 @@ public class Fontastic { m_engine.getTypeface().addRequiredGlyphs(); m_engine.buildTrueType(); - // End TTF creation - if (outFile.exists()) { - outFile.delete(); + // End TTF creation + + Path copied = outFile.toPath(); + Path originalPath = ttfFile.toPath(); + try { + Files.copy(originalPath, copied, StandardCopyOption.REPLACE_EXISTING); + } catch (IOException ex) { + //ignore } - ttfFile.renameTo(outFile); + + ttfFile.delete(); + cleanup(); }