diff --git a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/FourCornerUnicodeDisplay.java b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/FourCornerUnicodeDisplay.java index 9c3f140..e4f791f 100644 --- a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/FourCornerUnicodeDisplay.java +++ b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/FourCornerUnicodeDisplay.java @@ -70,21 +70,27 @@ import org.x4o.o2o.octal.PrimordialOctalOrangeJuiceCord; public class FourCornerUnicodeDisplay { private boolean renderHiddenControls = false; + private boolean renderLookup = true; private String renderSeperator = null; private final Map> int18To21 = new HashMap<>(); - private FourCornerUnicodeDisplay(boolean renderHiddenControls, String renderSeperator) { + private FourCornerUnicodeDisplay(boolean renderHiddenControls, boolean renderLookup, String renderSeperator) { this.renderHiddenControls = renderHiddenControls; + this.renderLookup = renderLookup; this.renderSeperator = renderSeperator; mapPoints(); } static FourCornerUnicodeDisplay text() { - return text(false); + return text(false, true); } - static FourCornerUnicodeDisplay text(boolean renderHiddenControls) { - return new FourCornerUnicodeDisplay(renderHiddenControls, null); + static FourCornerUnicodeDisplay raw() { + return text(true, false); + } + + static FourCornerUnicodeDisplay text(boolean renderHiddenControls, boolean renderLookup) { + return new FourCornerUnicodeDisplay(renderHiddenControls, renderLookup, null); } // static FourCornerUnicodeDisplay mixedᐧEskimo() { @@ -201,13 +207,20 @@ public class FourCornerUnicodeDisplay { } else { 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()) { - cdcPoint = numberMode; // print char - numberMode = null; // illegal number mode + if (renderLookup) { + if (numberMode != null && numberMode < FCDotCDC1604DashP6.NX01_A.ordinal()) { + cdcPoint = numberMode; // print char + numberMode = null; // illegal number mode + } else { + continue; + } } else { - continue; + cdcPoint = numberMode; // print char + numberMode = null; // disable lookup } } @@ -315,6 +328,9 @@ public class FourCornerUnicodeDisplay { if (!renderHiddenControls) { buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotCDC1604DashP6.__ESC6.ordinal())); } + if (!renderLookup) { + return checkChr; + } FCDotPIE9CDash26 lowCode = FCDotPIE9CDash26.values()[idx]; Arrays.stream(lowCode.codePoints()).forEach(v -> buf.appendCodePoint(v)); return null; diff --git a/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/FourCornerUnicodeDisplayTest.java b/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/FourCornerUnicodeDisplayTest.java index f1521da..ac3e4f2 100644 --- a/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/FourCornerUnicodeDisplayTest.java +++ b/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/FourCornerUnicodeDisplayTest.java @@ -82,7 +82,7 @@ public class FourCornerUnicodeDisplayTest { cdc.add(FCDotCDC1604DashP6.NX15_O); 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