mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-17 19:58:08 +00:00
Fixed: Replacing existing characters in a font which has character codes unsorted
This commit is contained in:
@@ -481,15 +481,14 @@ public class DefineFont2Tag extends FontTag {
|
||||
code = 0;
|
||||
}
|
||||
|
||||
int pos = -1;
|
||||
boolean exists = false;
|
||||
for (int i = 0; i < codeTable.size(); i++) {
|
||||
if (codeTable.get(i) >= code) {
|
||||
if (codeTable.get(i) == code) {
|
||||
exists = true;
|
||||
int pos = codeTable.indexOf(code);
|
||||
boolean exists = pos != -1;
|
||||
if (!exists) {
|
||||
for (int i = 0; i < codeTable.size(); i++) {
|
||||
if (codeTable.get(i) > code) {
|
||||
pos = i;
|
||||
break;
|
||||
}
|
||||
pos = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (pos == -1) {
|
||||
@@ -551,18 +550,7 @@ public class DefineFont2Tag extends FontTag {
|
||||
@Override
|
||||
public synchronized boolean removeCharacter(char character) {
|
||||
int code = (int) character;
|
||||
int pos = -1;
|
||||
for (int i = 0; i < codeTable.size(); i++) {
|
||||
if (codeTable.get(i) >= code) {
|
||||
if (codeTable.get(i) == code) {
|
||||
pos = i;
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int pos = codeTable.indexOf(code);
|
||||
if (pos == -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -472,15 +472,14 @@ public class DefineFont3Tag extends FontTag {
|
||||
if (code == -1) { //Fixme - throw exception, etc.
|
||||
code = 0;
|
||||
}
|
||||
int pos = -1;
|
||||
boolean exists = false;
|
||||
for (int i = 0; i < codeTable.size(); i++) {
|
||||
if (codeTable.get(i) >= code) {
|
||||
if (codeTable.get(i) == code) {
|
||||
exists = true;
|
||||
int pos = codeTable.indexOf(code);
|
||||
boolean exists = pos != -1;
|
||||
if (!exists) {
|
||||
for (int i = 0; i < codeTable.size(); i++) {
|
||||
if (codeTable.get(i) > code) {
|
||||
pos = i;
|
||||
break;
|
||||
}
|
||||
pos = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (pos == -1) {
|
||||
@@ -555,17 +554,7 @@ public class DefineFont3Tag extends FontTag {
|
||||
}
|
||||
|
||||
int code = (int) character;
|
||||
int pos = -1;
|
||||
for (int i = 0; i < codeTable.size(); i++) {
|
||||
if (codeTable.get(i) >= code) {
|
||||
if (codeTable.get(i) == code) {
|
||||
pos = i;
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
int pos = codeTable.indexOf(code);
|
||||
if (pos == -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -305,20 +305,20 @@ public class DefineFontTag extends FontTag {
|
||||
boolean exists = false;
|
||||
if (fontInfoTag != null) {
|
||||
List<Integer> codeTable = fontInfoTag.getCodeTable();
|
||||
for (int i = 0; i < codeTable.size(); i++) {
|
||||
if (codeTable.get(i) >= code) {
|
||||
if (codeTable.get(i) == code) {
|
||||
exists = true;
|
||||
|
||||
pos = codeTable.indexOf(code);
|
||||
exists = pos != -1;
|
||||
if (!exists) {
|
||||
for (int i = 0; i < codeTable.size(); i++) {
|
||||
if (codeTable.get(i) > code) {
|
||||
pos = i;
|
||||
break;
|
||||
}
|
||||
|
||||
pos = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (pos == -1) {
|
||||
pos = codeTable.size();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pos = 0;
|
||||
}
|
||||
@@ -372,17 +372,8 @@ public class DefineFontTag extends FontTag {
|
||||
int code = (int) character;
|
||||
int pos = -1;
|
||||
List<Integer> codeTable = fontInfoTag.getCodeTable();
|
||||
for (int i = 0; i < codeTable.size(); i++) {
|
||||
if (codeTable.get(i) >= code) {
|
||||
if (codeTable.get(i) == code) {
|
||||
pos = i;
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
pos = codeTable.indexOf(code);
|
||||
|
||||
if (pos == -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user