Character sets are limited to GB2312, Shift_JIS, Unicode, and all singlebyte.

Fixed font code points - proper characters display, adding, etc.
This commit is contained in:
Jindra Petřík
2022-11-12 11:03:36 +01:00
parent c266037785
commit 4c6ccf0d63
20 changed files with 21146 additions and 34 deletions

View File

@@ -25,6 +25,7 @@ import com.jpexs.decompiler.flash.tags.base.FontTag;
import com.jpexs.decompiler.flash.tags.base.TextTag;
import com.jpexs.decompiler.flash.treeitems.TreeItem;
import com.jpexs.helpers.Helper;
import com.jpexs.helpers.utf8.Utf8Helper;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
@@ -166,6 +167,12 @@ public class FontPanel extends JPanel {
if (font.getSize() != 1024) { //Do not resize if not required so we can have single instance of custom fonts
font = font.deriveFont(f.getFontStyle(), 1024);
}
if (Utf8Helper.charToCodePoint(c, ft.getCodesCharset()) == -1) {
String msg = translate("error.charset.nocharacter").replace("%char%", "" + c);
Logger.getLogger(FontPanel.class.getName()).log(Level.SEVERE, msg);
ViewMessages.showMessageDialog(FontPanel.this, msg, translate("error"), JOptionPane.ERROR_MESSAGE);
return;
}
if (!font.canDisplay(c)) {
String msg = translate("error.font.nocharacter").replace("%char%", "" + c);
Logger.getLogger(FontPanel.class.getName()).log(Level.SEVERE, msg);