mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-25 05:21:09 +00:00
Allow to ignore missing characters.
This commit is contained in:
@@ -344,18 +344,25 @@ public class DefineText2Tag extends TextTag {
|
||||
throw new TextParseException("Font not defined", lexer.yyline());
|
||||
}
|
||||
|
||||
StringBuilder txtSb = new StringBuilder();
|
||||
for (int i = 0; i < txt.length(); i++) {
|
||||
char c = txt.charAt(i);
|
||||
|
||||
if (!font.containsChar(c)) {
|
||||
if (!missingCharHandler.handle(font, c)) {
|
||||
return false;
|
||||
if (!missingCharHandler.handle(this, font, c)) {
|
||||
if (!missingCharHandler.getIgnoreMissingCharacters()) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return setFormattedText(missingCharHandler, formattedText, texts);
|
||||
}
|
||||
|
||||
return setFormattedText(missingCharHandler, formattedText, texts);
|
||||
} else {
|
||||
txtSb.append(c);
|
||||
}
|
||||
}
|
||||
|
||||
txt = txtSb.toString();
|
||||
|
||||
TEXTRECORD tr = new TEXTRECORD();
|
||||
textRecords.add(tr);
|
||||
if (fontId > -1) {
|
||||
|
||||
@@ -350,18 +350,25 @@ public class DefineTextTag extends TextTag {
|
||||
throw new TextParseException("Font not defined", lexer.yyline());
|
||||
}
|
||||
|
||||
StringBuilder txtSb = new StringBuilder();
|
||||
for (int i = 0; i < txt.length(); i++) {
|
||||
char c = txt.charAt(i);
|
||||
|
||||
if (!font.containsChar(c)) {
|
||||
if (!missingCharHandler.handle(font, c)) {
|
||||
return false;
|
||||
if (!missingCharHandler.handle(this, font, c)) {
|
||||
if (!missingCharHandler.getIgnoreMissingCharacters()) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return setFormattedText(missingCharHandler, formattedText, texts);
|
||||
}
|
||||
|
||||
return setFormattedText(missingCharHandler, formattedText, texts);
|
||||
} else {
|
||||
txtSb.append(c);
|
||||
}
|
||||
}
|
||||
|
||||
txt = txtSb.toString();
|
||||
|
||||
TEXTRECORD tr = new TEXTRECORD();
|
||||
textRecords.add(tr);
|
||||
if (fontId > -1) {
|
||||
|
||||
+5
-1
@@ -25,7 +25,11 @@ import java.util.Map;
|
||||
*/
|
||||
public class MissingCharacterHandler {
|
||||
|
||||
public boolean handle(FontTag font, char character) {
|
||||
public boolean getIgnoreMissingCharacters() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean handle(TextTag textTag, FontTag font, char character) {
|
||||
String fontName = font.getFontNameIntag();
|
||||
if (!FontTag.installedFontsByFamily.containsKey(fontName)) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user