FontTag.addCustomFont

Fix for
SEVERE: Uncaught exception in thread: main
java.lang.NullPointerException
        at com.jpexs.decompiler.flash.tags.base.FontTag.getFontKerningPairs(FontTag.java:541)
        at com.jpexs.decompiler.flash.tags.DefineFont3Tag.addCharacter(DefineFont3Tag.java:532)
        at com.jpexs.decompiler.flash.console.CommandLineArgumentParser.parseReplace(CommandLineArgumentParser.java:3137)
        at com.jpexs.decompiler.flash.console.CommandLineArgumentParser.parseArgumentsInternal(CommandLineArgumentParser.java:728)
        at com.jpexs.decompiler.flash.console.CommandLineArgumentParser.parseArguments(CommandLineArgumentParser.java:474)
        at com.jpexs.decompiler.flash.gui.Main.main(Main.java:3276)
        at com.jpexs.decompiler.flash.cli.CommandlineInterface.main(CommandlineInterface.java:32)

as in GUI version
This commit is contained in:
Ravoit
2025-10-20 23:13:19 +03:00
committed by GitHub
parent 0dc7fbf366
commit 9d980ffa41

View File

@@ -3109,7 +3109,9 @@ public class CommandLineArgumentParser {
Set<Character> selChars = new HashSet<>();
Font font;
try {
font = Font.createFont(Font.TRUETYPE_FONT, new File(repFile));
File fontFile = new File(repFile);
font = Font.createFont(Font.TRUETYPE_FONT, fontFile);
FontTag.addCustomFont(font, fontFile);
List<Character> required = Arrays.asList((char) 0x01, (char) 0x00, (char) 0x0D, (char) 0x20);
for (char c = 0; c < Character.MAX_VALUE; c++) {
if (required.contains(c)) {