diff --git a/trunk/build_common.xml b/trunk/build_common.xml index afaae1604..69143e6c4 100644 --- a/trunk/build_common.xml +++ b/trunk/build_common.xml @@ -45,7 +45,7 @@ - + diff --git a/trunk/lib/jpacker.jar b/trunk/lib/jpacker.jar index 3c1a831de..e5b208e54 100644 Binary files a/trunk/lib/jpacker.jar and b/trunk/lib/jpacker.jar differ diff --git a/trunk/libsrc/jpacker/nbproject/project.properties b/trunk/libsrc/jpacker/nbproject/project.properties index 06f4e9079..853b1b314 100644 --- a/trunk/libsrc/jpacker/nbproject/project.properties +++ b/trunk/libsrc/jpacker/nbproject/project.properties @@ -39,8 +39,8 @@ javac.compilerargs= javac.deprecation=false javac.processorpath=\ ${javac.classpath} -javac.source=1.8 -javac.target=1.8 +javac.source=1.7 +javac.target=1.7 javac.test.classpath=\ ${javac.classpath}:\ ${build.classes.dir} @@ -60,7 +60,7 @@ javadoc.windowtitle= main.class=com.jpacker.JPacker manifest.file=manifest.mf meta.inf.dir=${src.dir}/META-INF -mkdist.disabled=false +mkdist.disabled=true platform.active=default_platform run.classpath=\ ${javac.classpath}:\ diff --git a/trunk/src/com/jpexs/decompiler/flash/SWF.java b/trunk/src/com/jpexs/decompiler/flash/SWF.java index 8f17965a8..54552a7e8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWF.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWF.java @@ -1355,6 +1355,9 @@ public final class SWF implements TreeItem, Timelined { if(c instanceof TextTag){ return "text"; } + if(c instanceof ButtonTag){ + return "button"; + } if(c instanceof FontTag){ return "font"; } @@ -2311,6 +2314,9 @@ public final class SWF implements TreeItem, Timelined { if (tag instanceof TextTag) { return exporter.getUniqueId("text"); } + if (tag instanceof ButtonTag) { + return exporter.getUniqueId("button"); + } return exporter.getUniqueId("tag"); } diff --git a/trunk/src/com/jpexs/decompiler/flash/exporters/TextExporter.java b/trunk/src/com/jpexs/decompiler/flash/exporters/TextExporter.java index 65a910670..1549aeb94 100644 --- a/trunk/src/com/jpexs/decompiler/flash/exporters/TextExporter.java +++ b/trunk/src/com/jpexs/decompiler/flash/exporters/TextExporter.java @@ -20,10 +20,13 @@ import com.jpexs.decompiler.flash.AbortRetryIgnoreHandler; import com.jpexs.decompiler.flash.RetryTask; import com.jpexs.decompiler.flash.RunnableIOEx; import com.jpexs.decompiler.flash.configuration.Configuration; +import com.jpexs.decompiler.flash.exporters.commonshape.ExportRectangle; +import com.jpexs.decompiler.flash.exporters.commonshape.SVGExporter; import com.jpexs.decompiler.flash.exporters.modes.TextExportMode; import com.jpexs.decompiler.flash.exporters.settings.TextExportSettings; import com.jpexs.decompiler.flash.tags.Tag; import com.jpexs.decompiler.flash.tags.base.TextTag; +import com.jpexs.decompiler.flash.types.CXFORMWITHALPHA; import com.jpexs.helpers.Helper; import com.jpexs.helpers.utf8.Utf8Helper; import java.io.File; @@ -56,6 +59,28 @@ public class TextExporter { } } + if (settings.mode == TextExportMode.SVG) { + for (Tag t : tags) { + if (t instanceof TextTag) { + final TextTag textTag = (TextTag) t; + final File file = new File(outdir + File.separator + textTag.getCharacterId() + ".svg"); + new RetryTask(new RunnableIOEx() { + @Override + public void run() throws IOException { + try (FileOutputStream fos = new FileOutputStream(file)) { + ExportRectangle rect = new ExportRectangle(textTag.getRect()); + SVGExporter exporter = new SVGExporter(rect); + textTag.toSVG(exporter, -2, new CXFORMWITHALPHA(), 0); + fos.write(Utf8Helper.getBytes(exporter.getSVG())); + } + } + }, handler).run(); + ret.add(file); + } + } + return ret; + } + if (settings.singleFile) { final File file = new File(outdir + File.separator + (settings.mode == TextExportMode.FORMATTED ? TEXT_EXPORT_FILENAME_FORMATTED : TEXT_EXPORT_FILENAME_PLAIN)); diff --git a/trunk/src/com/jpexs/decompiler/flash/exporters/commonshape/SVGExporter.java b/trunk/src/com/jpexs/decompiler/flash/exporters/commonshape/SVGExporter.java index 965d980dc..98e4fc517 100644 --- a/trunk/src/com/jpexs/decompiler/flash/exporters/commonshape/SVGExporter.java +++ b/trunk/src/com/jpexs/decompiler/flash/exporters/commonshape/SVGExporter.java @@ -107,7 +107,7 @@ public class SVGExporter { Element style = _svg.createElement("style"); _svgStyle = _svg.createCDATASection(""); style.appendChild(_svgStyle); - _svgDefs.appendChild(style); + getDefs().appendChild(style); } return _svgStyle; } @@ -215,10 +215,10 @@ public class SVGExporter { value += " font-family: \"" + fontFace + "\";" + Helper.newLine; switch (mode) { case TTF: - value += " src: url('data:font/truetype;base64,[" + base64Data + "]') format(\"truetype\");" + Helper.newLine; + value += " src: url('data:font/truetype;base64," + base64Data + "') format(\"truetype\");" + Helper.newLine; break; case WOFF: - value += " src: url('data:font/woff;base64,[" + base64Data + "]') format(\"woff\");" + Helper.newLine; + value += " src: url('data:font/woff;base64," + base64Data + "') format(\"woff\");" + Helper.newLine; break; } value += " }" + Helper.newLine; diff --git a/trunk/src/com/jpexs/decompiler/flash/exporters/modes/TextExportMode.java b/trunk/src/com/jpexs/decompiler/flash/exporters/modes/TextExportMode.java index 3d484b1b0..fc84a3750 100644 --- a/trunk/src/com/jpexs/decompiler/flash/exporters/modes/TextExportMode.java +++ b/trunk/src/com/jpexs/decompiler/flash/exporters/modes/TextExportMode.java @@ -23,5 +23,6 @@ package com.jpexs.decompiler.flash.exporters.modes; public enum TextExportMode { PLAIN, - FORMATTED + FORMATTED, + SVG } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/locales/ExportDialog.properties b/trunk/src/com/jpexs/decompiler/flash/gui/locales/ExportDialog.properties index 10883e4c9..4f635c3b4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/locales/ExportDialog.properties +++ b/trunk/src/com/jpexs/decompiler/flash/gui/locales/ExportDialog.properties @@ -20,6 +20,7 @@ shapes.canvas = HTML5 Canvas texts = Texts texts.plain = Plain text texts.formatted = Formatted text +texts.svg = SVG images = Images images.png_jpeg = PNG/JPEG diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/base/TextTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/base/TextTag.java index d80e2c917..a5ea45b16 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/base/TextTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/base/TextTag.java @@ -418,6 +418,15 @@ public abstract class TextTag extends CharacterTag implements BoundedTag, Drawab textElement.setAttribute("font-size", Double.toString(rat * 1024)); textElement.setAttribute("font-family", font.getFontName()); textElement.setTextContent(text.toString()); + + if (textColor != null) { + RGBA colorA = new RGBA(textColor); + textElement.setAttribute("fill", colorA.toHexRGB()); + if (colorA.alpha != 255) { + textElement.setAttribute("fill-opacity", Float.toString(colorA.getAlphaFloat())); + } + } + exporter.addToGroup(textElement); FontExportMode fontExportMode = FontExportMode.TTF; // todo: change this to WOFF exporter.addStyle(font.getFontName(), new FontExporter().exportFont(font, fontExportMode), fontExportMode); diff --git a/trunk/testdata/as2/as2.fla b/trunk/testdata/as2/as2.fla index 94cc33a4b..d4300d033 100644 Binary files a/trunk/testdata/as2/as2.fla and b/trunk/testdata/as2/as2.fla differ diff --git a/trunk/testdata/as2/as2.swf b/trunk/testdata/as2/as2.swf index 3067a9781..f4c213a6f 100644 Binary files a/trunk/testdata/as2/as2.swf and b/trunk/testdata/as2/as2.swf differ