Fixed Proper error message when there is no room for new characters in the font (DefineFont1)

Fixed Synchronization problems when adding characters to the font vs its display
This commit is contained in:
Jindra Petřík
2023-09-24 09:45:15 +02:00
parent c7f4aaddfb
commit ef9e80cb21
12 changed files with 92 additions and 51 deletions

View File

@@ -4059,9 +4059,7 @@ public class CommandLineArgumentParser {
return false;
}
font.addCharacter(character, f);
return true;
return font.addCharacter(character, f);
}
}, new TextImportErrorHandler() {
private String getTextTagInfo(TextTag textTag) {

View File

@@ -17,6 +17,7 @@
package com.jpexs.decompiler.flash.gui;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.ValueTooLargeException;
import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.gui.helpers.TableLayoutHelper;
import com.jpexs.decompiler.flash.tags.DefineFontTag;
@@ -192,6 +193,7 @@ public class FontPanel extends JPanel implements TagEditorPanel {
boolean yestoall = false;
boolean notoall = false;
boolean replaced = false;
int numAdded = 0;
for (int ic : selChars) {
char c = (char) ic;
if (oldchars.indexOf((int) c) > -1) {
@@ -219,7 +221,11 @@ public class FontPanel extends JPanel implements TagEditorPanel {
replaced = true;
}
f.addCharacter(c, font);
if (!f.addCharacter(c, font)) {
ViewMessages.showMessageDialog(mainPanel,AppStrings.translate("error.font.cannotaddcharacter").replace("%numchars%", "" + numAdded), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
break;
}
numAdded++;
oldchars += c;
}

View File

@@ -4105,9 +4105,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
return false;
}
font.addCharacter(character, f);
return true;
return font.addCharacter(character, f);
}
};
}

View File

@@ -1147,4 +1147,6 @@ warning.edit.headerframecount = WARNING: Editing frame count in the header does
warning.icon = Click to show related warning
button.export = Export
button.export = Export
error.font.cannotaddcharacter = ERROR: Cannot add more characters to the font.\r\nSuccessfully added characters: %numchars%.

View File

@@ -1132,4 +1132,7 @@ warning.edit.headerframecount = VAROV\u00c1N\u00cd: Editace po\u010dtu sn\u00edm
warning.icon = Klikn\u011bte pro zobrazen\u00ed souvisej\u00edc\u00edho varov\u00e1n\u00ed
button.export = Exportovat
button.export = Exportovat
error.font.cannotaddcharacter = CHYBA: Do tohoto p\u00edsma nelze ji\u017e p\u0159idat v\u00edce znak\u016f.\r\n\u00dasp\u011b\u0161n\u011b p\u0159idan\u00fdch znak\u016f: %numchars%.