Added dirty raw mode code in unicode display methods
This commit is contained in:
parent
4122e24ad4
commit
d528e8dd8c
|
@ -70,21 +70,27 @@ import org.x4o.o2o.octal.PrimordialOctalOrangeJuiceCord;
|
||||||
public class FourCornerUnicodeDisplay {
|
public class FourCornerUnicodeDisplay {
|
||||||
|
|
||||||
private boolean renderHiddenControls = false;
|
private boolean renderHiddenControls = false;
|
||||||
|
private boolean renderLookup = true;
|
||||||
private String renderSeperator = null;
|
private String renderSeperator = null;
|
||||||
private final Map<Integer, List<Integer>> int18To21 = new HashMap<>();
|
private final Map<Integer, List<Integer>> int18To21 = new HashMap<>();
|
||||||
|
|
||||||
private FourCornerUnicodeDisplay(boolean renderHiddenControls, String renderSeperator) {
|
private FourCornerUnicodeDisplay(boolean renderHiddenControls, boolean renderLookup, String renderSeperator) {
|
||||||
this.renderHiddenControls = renderHiddenControls;
|
this.renderHiddenControls = renderHiddenControls;
|
||||||
|
this.renderLookup = renderLookup;
|
||||||
this.renderSeperator = renderSeperator;
|
this.renderSeperator = renderSeperator;
|
||||||
mapPoints();
|
mapPoints();
|
||||||
}
|
}
|
||||||
|
|
||||||
static FourCornerUnicodeDisplay text() {
|
static FourCornerUnicodeDisplay text() {
|
||||||
return text(false);
|
return text(false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static FourCornerUnicodeDisplay text(boolean renderHiddenControls) {
|
static FourCornerUnicodeDisplay raw() {
|
||||||
return new FourCornerUnicodeDisplay(renderHiddenControls, null);
|
return text(true, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
static FourCornerUnicodeDisplay text(boolean renderHiddenControls, boolean renderLookup) {
|
||||||
|
return new FourCornerUnicodeDisplay(renderHiddenControls, renderLookup, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// static FourCornerUnicodeDisplay mixedᐧEskimo() {
|
// static FourCornerUnicodeDisplay mixedᐧEskimo() {
|
||||||
|
@ -201,13 +207,20 @@ public class FourCornerUnicodeDisplay {
|
||||||
} else {
|
} else {
|
||||||
buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotCDC1604DashP6.__PIN.ordinal()));
|
buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotCDC1604DashP6.__PIN.ordinal()));
|
||||||
}
|
}
|
||||||
buf.appendCodePoint(FCDotCDC1604DashP6.indexOf(numberMode).codePoints()[0]);
|
if (renderLookup) { // is already printed when disabled
|
||||||
|
buf.appendCodePoint(FCDotCDC1604DashP6.indexOf(numberMode).codePoints()[0]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (numberMode < FCDotCDC1604DashP6.NX01_A.ordinal()) {
|
if (renderLookup) {
|
||||||
cdcPoint = numberMode; // print char
|
if (numberMode != null && numberMode < FCDotCDC1604DashP6.NX01_A.ordinal()) {
|
||||||
numberMode = null; // illegal number mode
|
cdcPoint = numberMode; // print char
|
||||||
|
numberMode = null; // illegal number mode
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
continue;
|
cdcPoint = numberMode; // print char
|
||||||
|
numberMode = null; // disable lookup
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,6 +328,9 @@ public class FourCornerUnicodeDisplay {
|
||||||
if (!renderHiddenControls) {
|
if (!renderHiddenControls) {
|
||||||
buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotCDC1604DashP6.__ESC6.ordinal()));
|
buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotCDC1604DashP6.__ESC6.ordinal()));
|
||||||
}
|
}
|
||||||
|
if (!renderLookup) {
|
||||||
|
return checkChr;
|
||||||
|
}
|
||||||
FCDotPIE9CDash26 lowCode = FCDotPIE9CDash26.values()[idx];
|
FCDotPIE9CDash26 lowCode = FCDotPIE9CDash26.values()[idx];
|
||||||
Arrays.stream(lowCode.codePoints()).forEach(v -> buf.appendCodePoint(v));
|
Arrays.stream(lowCode.codePoints()).forEach(v -> buf.appendCodePoint(v));
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -82,7 +82,7 @@ public class FourCornerUnicodeDisplayTest {
|
||||||
cdc.add(FCDotCDC1604DashP6.NX15_O);
|
cdc.add(FCDotCDC1604DashP6.NX15_O);
|
||||||
|
|
||||||
Assertions.assertEquals("ab B␃cD.jklmO", FourCornerUnicodeDisplay.text().renderFromX06(cdc));
|
Assertions.assertEquals("ab B␃cD.jklmO", FourCornerUnicodeDisplay.text().renderFromX06(cdc));
|
||||||
Assertions.assertEquals("␁Za␁Zb B␃cD.␁Zjklm␃␃O", FourCornerUnicodeDisplay.text(true).renderFromX06(cdc));
|
Assertions.assertEquals("␁ZA␁ZB B␃CD.␁ZJKLM␃␃O", FourCornerUnicodeDisplay.raw().renderFromX06(cdc));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in a new issue