Added Export DefineFont4 to OpenType CFF file

This commit is contained in:
Jindra Petřík
2023-10-01 18:21:38 +02:00
parent dabcaea2ec
commit c7f4aaddfb
8 changed files with 220 additions and 2 deletions
@@ -214,7 +214,10 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import com.jpexs.decompiler.flash.Bundle;
import com.jpexs.decompiler.flash.exporters.DualPdfGraphics2D;
import com.jpexs.decompiler.flash.exporters.Font4Exporter;
import com.jpexs.decompiler.flash.exporters.commonshape.ExportRectangle;
import com.jpexs.decompiler.flash.exporters.modes.Font4ExportMode;
import com.jpexs.decompiler.flash.exporters.settings.Font4ExportSettings;
import com.jpexs.decompiler.flash.gui.translator.Translator;
import com.jpexs.decompiler.flash.importers.MovieImporter;
import com.jpexs.decompiler.flash.importers.SoundImporter;
@@ -350,6 +353,7 @@ public class CommandLineArgumentParser {
out.println(" morphshape - MorphShapes (Default format: SVG)");
out.println(" movie - Movies (Default format: FLV without sound)");
out.println(" font - Fonts (Default format: TTF)");
out.println(" font4 - DefineFont4 (Default format: CFF)");
out.println(" frame - Frames (Default format: PNG)");
out.println(" sprite - Sprites (Default format: PNG)");
out.println(" button - Buttons (Default format: PNG)");
@@ -410,6 +414,7 @@ public class CommandLineArgumentParser {
out.println(" sound:flv - FLV format for Sounds");
out.println(" font:ttf - TTF format for Fonts");
out.println(" font:woff - WOFF format for Fonts");
out.println(" font4:cff - CFF format for DefineFont4");
out.println(" fla:<flaversion> or xfl:<flaversion> - Specify FLA format version");
out.println(" - values for <flaversion>: cs5,cs5.5,cs6,cc");
out.println(" You can set multiple formats at once using comma (,)");
@@ -2258,6 +2263,7 @@ public class CommandLineArgumentParser {
"morphshape",
"movie",
"font",
"font4",
"frame",
"sprite",
"button",
@@ -2434,6 +2440,11 @@ public class CommandLineArgumentParser {
new FontExporter().exportFonts(handler, outDir + (multipleExportTypes ? File.separator + FontExportSettings.EXPORT_FOLDER_NAME : ""), new ReadOnlyTagList(extags), new FontExportSettings(enumFromStr(formats.get("font"), FontExportMode.class)), evl);
}
if (exportAll || exportFormats.contains("font4")) {
System.out.println("Exporting DefineFont4s...");
new Font4Exporter().exportFonts(handler, outDir + (multipleExportTypes ? File.separator + FontExportSettings.EXPORT_FOLDER_NAME : ""), new ReadOnlyTagList(extags), new Font4ExportSettings(enumFromStr(formats.get("font4"), Font4ExportMode.class)), evl);
}
if (exportAll || exportFormats.contains("sound")) {
System.out.println("Exporting sounds...");
new SoundExporter().exportSounds(handler, outDir + (multipleExportTypes ? File.separator + SoundExportSettings.EXPORT_FOLDER_NAME : ""), new ReadOnlyTagList(extags), new SoundExportSettings(enumFromStr(formats.get("sound"), SoundExportMode.class)), evl);
@@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.abc.ScriptPack;
import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.exporters.modes.BinaryDataExportMode;
import com.jpexs.decompiler.flash.exporters.modes.ButtonExportMode;
import com.jpexs.decompiler.flash.exporters.modes.Font4ExportMode;
import com.jpexs.decompiler.flash.exporters.modes.FontExportMode;
import com.jpexs.decompiler.flash.exporters.modes.FrameExportMode;
import com.jpexs.decompiler.flash.exporters.modes.ImageExportMode;
@@ -33,6 +34,7 @@ import com.jpexs.decompiler.flash.exporters.modes.SymbolClassExportMode;
import com.jpexs.decompiler.flash.exporters.modes.TextExportMode;
import com.jpexs.decompiler.flash.gui.tagtree.TagTreeModel;
import com.jpexs.decompiler.flash.tags.DefineBinaryDataTag;
import com.jpexs.decompiler.flash.tags.DefineFont4Tag;
import com.jpexs.decompiler.flash.tags.DefineSpriteTag;
import com.jpexs.decompiler.flash.tags.DefineVideoStreamTag;
import com.jpexs.decompiler.flash.tags.base.ASMSource;
@@ -84,6 +86,7 @@ public class ExportDialog extends AppDialog {
TagTreeModel.FOLDER_SPRITES,
TagTreeModel.FOLDER_BUTTONS,
TagTreeModel.FOLDER_FONTS,
"fonts4",
TagTreeModel.FOLDER_MORPHSHAPES,
"symbolclass"
};
@@ -101,6 +104,7 @@ public class ExportDialog extends AppDialog {
{Frame.class},
{ButtonTag.class},
{FontTag.class},
{DefineFont4Tag.class},
{MorphShapeTag.class},
{SymbolClassTypeTag.class}
};
@@ -118,6 +122,7 @@ public class ExportDialog extends AppDialog {
SpriteExportMode.class,
ButtonExportMode.class,
FontExportMode.class,
Font4ExportMode.class,
MorphShapeExportMode.class,
SymbolClassExportMode.class
};
@@ -46,6 +46,7 @@ import com.jpexs.decompiler.flash.configuration.SwfSpecificCustomConfiguration;
import com.jpexs.decompiler.flash.dumpview.DumpInfo;
import com.jpexs.decompiler.flash.dumpview.DumpInfoSwfNode;
import com.jpexs.decompiler.flash.exporters.BinaryDataExporter;
import com.jpexs.decompiler.flash.exporters.Font4Exporter;
import com.jpexs.decompiler.flash.exporters.FontExporter;
import com.jpexs.decompiler.flash.exporters.FrameExporter;
import com.jpexs.decompiler.flash.exporters.ImageExporter;
@@ -59,6 +60,7 @@ import com.jpexs.decompiler.flash.exporters.TextExporter;
import com.jpexs.decompiler.flash.exporters.commonshape.Matrix;
import com.jpexs.decompiler.flash.exporters.modes.BinaryDataExportMode;
import com.jpexs.decompiler.flash.exporters.modes.ButtonExportMode;
import com.jpexs.decompiler.flash.exporters.modes.Font4ExportMode;
import com.jpexs.decompiler.flash.exporters.modes.FontExportMode;
import com.jpexs.decompiler.flash.exporters.modes.FrameExportMode;
import com.jpexs.decompiler.flash.exporters.modes.ImageExportMode;
@@ -74,6 +76,7 @@ import com.jpexs.decompiler.flash.exporters.script.AS2ScriptExporter;
import com.jpexs.decompiler.flash.exporters.script.AS3ScriptExporter;
import com.jpexs.decompiler.flash.exporters.settings.BinaryDataExportSettings;
import com.jpexs.decompiler.flash.exporters.settings.ButtonExportSettings;
import com.jpexs.decompiler.flash.exporters.settings.Font4ExportSettings;
import com.jpexs.decompiler.flash.exporters.settings.FontExportSettings;
import com.jpexs.decompiler.flash.exporters.settings.FrameExportSettings;
import com.jpexs.decompiler.flash.exporters.settings.ImageExportSettings;
@@ -1872,6 +1875,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
List<Tag> binaryData = new ArrayList<>();
Map<Integer, List<Integer>> frames = new HashMap<>();
List<Tag> fonts = new ArrayList<>();
List<Tag> fonts4 = new ArrayList<>();
List<Tag> symbolNames = new ArrayList<>();
for (TreeItem d : sel) {
@@ -1925,7 +1929,9 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
if (nodeType == TreeNodeType.TEXT) {
texts.add((Tag) d);
}
if (nodeType == TreeNodeType.FONT) {
if (d instanceof DefineFont4Tag) {
fonts4.add((Tag)d);
} else if (nodeType == TreeNodeType.FONT) {
fonts.add((Tag) d);
}
if (nodeType == TreeNodeType.OTHER_TAG) {
@@ -2008,6 +2014,11 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
new FontExportSettings(export.getValue(FontExportMode.class)), evl));
}
if (export.isOptionEnabled(Font4ExportMode.class)) {
ret.addAll(new Font4Exporter().exportFonts(handler, selFile2 + File.separator + Font4ExportSettings.EXPORT_FOLDER_NAME, new ReadOnlyTagList(fonts4),
new Font4ExportSettings(export.getValue(Font4ExportMode.class)), evl));
}
if (export.isOptionEnabled(SymbolClassExportMode.class)) {
ret.addAll(new SymbolClassExporter().exportNames(handler, selFile2 + File.separator + SymbolClassExportSettings.EXPORT_FOLDER_NAME, new ReadOnlyTagList(symbolNames),
new SymbolClassExportSettings(export.getValue(SymbolClassExportMode.class)), evl));
@@ -5035,6 +5046,8 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
swf.addTag(showFrameTag);
showFrameTag.setTimelined(swf);
previewPanel.showImagePanel(swf, swf, 0, true, true, !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false);
} else if (treeItem instanceof DefineFont4Tag) {
previewPanel.showGenericTagPanel((Tag)treeItem);
} else {
previewPanel.showEmpty();
}
@@ -100,4 +100,8 @@ symbolclass = Symbol-Class mapping
symbolclass.csv = CSV
#after 18.0.0
images.png_gif_jpeg_alpha = PNG/GIF/JPEG+alpha
images.png_gif_jpeg_alpha = PNG/GIF/JPEG+alpha
#after 18.5.0
fonts4 = DefineFont4
fonts4.cff = CFF