From 58c24aa746e9ded0c28e794f6df957cc721f7bec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sat, 30 May 2015 07:11:50 +0200 Subject: [PATCH] Issue #903 FLA export - fix for missing fontName, fix last frame when no last ShowFrameTag present --- .../decompiler/flash/xfl/XFLConverter.java | 33 ++++++++++++++++++- .../jpexs/decompiler/flash/gui/MainPanel.java | 2 +- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java index a2c34f5db..86a0eaa5f 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java @@ -1788,7 +1788,25 @@ public class XFLConverter { boolean lastShapeTween = false; MorphShapeTag shapeTweener = null; - for (Tag t : timelineTags) { + //Add ShowFrameTag to the end when there is one last missing + List timTags = new ArrayList<>(timelineTags); + boolean needsFrameAdd = false; + SWF swf = null; + for (int i = timTags.size() - 1; i >= 0; i--) { + if (timTags.get(i) instanceof ShowFrameTag) { + break; + } + if (timTags.get(i) instanceof PlaceObjectTypeTag) { + needsFrameAdd = true; + swf = timTags.get(i).getSwf(); + break; + } + } + if (needsFrameAdd) { + timTags.add(new ShowFrameTag(swf)); + } + + for (Tag t : timTags) { if (t instanceof PlaceObjectTypeTag) { PlaceObjectTypeTag po = (PlaceObjectTypeTag) t; if (po.getDepth() == depth) { @@ -1936,6 +1954,9 @@ public class XFLConverter { if (fontName == null) { fontName = font.getFontNameIntag(); } + if (fontName == null) { + fontName = FontTag.defaultFontName; + } int fontStyle = font.getFontStyle(); String installedFont; if ((installedFont = FontTag.isFontFamilyInstalled(fontName)) != null) { @@ -2420,6 +2441,9 @@ public class XFLConverter { if ((fontName == null) && (font != null)) { fontName = font.getFontNameIntag(); } + if (fontName == null) { + fontName = FontTag.defaultFontName; + } int fontStyle = 0; if (font != null) { fontStyle = font.getFontStyle(); @@ -2565,6 +2589,9 @@ public class XFLConverter { if (fontName == null) { fontName = ft.getFontNameIntag(); } + if (fontName == null) { + fontName = FontTag.defaultFontName; + } italic = ft.isItalic(); bold = ft.isBold(); size = det.fontHeight; @@ -2997,6 +3024,7 @@ public class XFLConverter { logger.log(Level.SEVERE, "Error during ActionScript3 export", ex); } } + } private static int normHue(double h) { @@ -3216,6 +3244,9 @@ public class XFLConverter { if (fontName == null) { fontName = ft.getFontNameIntag(); } + if (fontName == null) { + fontName = FontTag.defaultFontName; + } italic = ft.isItalic(); bold = ft.isBold(); size = det.fontHeight; diff --git a/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/src/com/jpexs/decompiler/flash/gui/MainPanel.java index c67fcc61c..fe3faf22f 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -1839,7 +1839,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se } else { swf.exportXfl(errorHandler, selfile.getAbsolutePath(), new File(swf.getFile()).getName(), ApplicationInfo.APPLICATION_NAME, ApplicationInfo.applicationVerName, ApplicationInfo.version, Configuration.parallelSpeedUp.get(), selectedVersion); } - } catch (IOException ex) { + } catch (Exception ex) { View.showMessageDialog(null, translate("error.export") + ": " + ex.getClass().getName() + " " + ex.getLocalizedMessage(), translate("error"), JOptionPane.ERROR_MESSAGE); } Helper.freeMem();