Added full cake dot name support to reuse the internal enum naming

This commit is contained in:
Willem Cazander 2025-01-20 15:59:10 +01:00
parent ad864152ed
commit 158bb0c6f4
8 changed files with 61 additions and 51 deletions

View file

@ -33,7 +33,6 @@ import org.x4o.fc18.cake2.FourCornerX00PetitVide;
import org.x4o.fc18.cake2.FourCornerX06BaklavaPointSequence; import org.x4o.fc18.cake2.FourCornerX06BaklavaPointSequence;
import org.x4o.fc18.cake2.FourCornerX08MuffinPointSequence; import org.x4o.fc18.cake2.FourCornerX08MuffinPointSequence;
import org.x4o.fc18.cake2.FourCornerX18CakePointSequence; import org.x4o.fc18.cake2.FourCornerX18CakePointSequence;
import org.x4o.fc18.cake2.FourCornerX18CakeWord;
import org.x4o.fc18.cake2.zero33.FCDotCDC1604DashP6; import org.x4o.fc18.cake2.zero33.FCDotCDC1604DashP6;
import org.x4o.fc18.zion7.FourCornerZion7Candlelier; import org.x4o.fc18.zion7.FourCornerZion7Candlelier;
import org.x4o.fc18.zion7.FourCornerZionStenoLexer; import org.x4o.fc18.zion7.FourCornerZionStenoLexer;
@ -172,14 +171,15 @@ public class FourCornerUnicodeDisplay {
output.append(value); output.append(value);
} else { } else {
FourCornerX00PetitVide videPoint = videPoints[offset]; FourCornerX00PetitVide videPoint = videPoints[offset];
if (videPoint instanceof FourCornerX18CakeWord) { if (videPoint.kaasX18CakeDotName().isPresent()) {
FourCornerX18CakeWord cakeWord = FourCornerX18CakeWord.class.cast(videPoint); List<FourCornerX18CakePointSequence> nameX18 = videPoint.kaasX18CakeDotName().get().nameX18();
FourCornerX18CakePointSequence[] wordDefault = cakeWord.nameDefault(); for (FourCornerX18CakePointSequence letter : nameX18) {
for (FourCornerX18CakePointSequence letter : wordDefault) {
letter.kaasX21CodeSequence().ifPresent(v -> { letter.kaasX21CodeSequence().ifPresent(v -> {
v.codePointSequence().forEach(vv -> output.appendCodePoint(vv)); v.codePointSequence().forEach(vv -> output.appendCodePoint(vv));
}); });
} }
// should be equal to
//output.append(videPoint.kaasX18CakeDotName().get().name());
} }
} }
if (renderSeperator != null && wasExternalWord) { if (renderSeperator != null && wasExternalWord) {

View file

@ -25,8 +25,6 @@ package org.x4o.fc18.cake2;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import org.x4o.fc18.FourCornerUnicodeImport;
/** /**
* Glue for clock speech token support. * Glue for clock speech token support.
* *
@ -34,9 +32,7 @@ import org.x4o.fc18.FourCornerUnicodeImport;
* @author Willem Cazander * @author Willem Cazander
* @version 1.0 Dec 30, 2024 * @version 1.0 Dec 30, 2024
*/ */
public interface FourCornerDotColleCLK extends FourCornerX18CakeWord { public interface FourCornerDotColleCLK extends FourCornerX18CakePointDotIndex {
String name();
FourCornerDotColleCLKParler[] clockParlers(); FourCornerDotColleCLKParler[] clockParlers();
@ -49,10 +45,6 @@ public interface FourCornerDotColleCLK extends FourCornerX18CakeWord {
return Optional.empty(); return Optional.empty();
} }
default FourCornerX18CakePointSequence[] nameDefault() {
return FourCornerUnicodeImport.strict().convertToX18(name()).toArray(new FourCornerX18CakePointSequence[] {});
}
@Override @Override
default List<Integer> cakePointSequence() { default List<Integer> cakePointSequence() {
return List.of(cakePointDotIndex()); return List.of(cakePointDotIndex());

View file

@ -46,6 +46,10 @@ public interface FourCornerX00PetitVide {
return this instanceof FourCornerX18CakePointDotIndex?Optional.of(FourCornerX18CakePointDotIndex.class.cast(this)):Optional.empty(); return this instanceof FourCornerX18CakePointDotIndex?Optional.of(FourCornerX18CakePointDotIndex.class.cast(this)):Optional.empty();
} }
default Optional<FourCornerX18CakePointDotName> kaasX18CakeDotName() {
return this instanceof FourCornerX18CakePointDotName?Optional.of(FourCornerX18CakePointDotName.class.cast(this)):Optional.empty();
}
default Optional<FourCornerX18CakePointSequence> kaasX18CakeSequence() { default Optional<FourCornerX18CakePointSequence> kaasX18CakeSequence() {
return this instanceof FourCornerX18CakePointSequence?Optional.of(FourCornerX18CakePointSequence.class.cast(this)):Optional.empty(); return this instanceof FourCornerX18CakePointSequence?Optional.of(FourCornerX18CakePointSequence.class.cast(this)):Optional.empty();
} }

View file

@ -26,7 +26,7 @@ package org.x4o.fc18.cake2;
/// ///
/// @author Willem Cazander /// @author Willem Cazander
/// @version 1.0 Jan 19, 2025 /// @version 1.0 Jan 19, 2025
public interface FourCornerX18CakePointDotIndex extends FourCornerX18CakePointSequence { public interface FourCornerX18CakePointDotIndex extends FourCornerX18CakePointSequence, FourCornerX18CakePointDotName {
/// One cake piece weights 800 gram /// One cake piece weights 800 gram
int cakePointDotIndex(); int cakePointDotIndex();

View file

@ -22,12 +22,19 @@
*/ */
package org.x4o.fc18.cake2; package org.x4o.fc18.cake2;
/// Fall back word provider. import java.util.List;
import org.x4o.fc18.FourCornerUnicodeImport;
/// Access to the internal dot cake point glyph name.
/// ///
/// @author Willem Cazander /// @author Willem Cazander
/// @version 1.0 Jan 11, 2025 /// @version 1.0 Jan 11, 2025
public interface FourCornerX18CakeWord extends FourCornerX18CakePointDotIndex { public interface FourCornerX18CakePointDotName extends FourCornerX00PetitVide {
/// Default word provider String name(); // copy name from internal enum value
FourCornerX18CakePointSequence[] nameDefault();
default List<FourCornerX18CakePointSequence> nameX18() {
return FourCornerUnicodeImport.strict().convertToX18(name());
}
} }

View file

@ -50,7 +50,8 @@ import org.x4o.o2o.tdoc.dom.ApiDocWriteEvent;
*/ */
public class FCDocSegmentWriterCakeSlice implements FCDocSegmentWriter { public class FCDocSegmentWriterCakeSlice implements FCDocSegmentWriter {
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.DETAIL, targetClasses={TDocCakeSlice.class}, nodeBodyOrders=20) // NOTE: Table are not allowed in details
// @ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.DETAIL, targetClasses={TDocCakeSlice.class}, nodeBodyOrders=20)
public void writeDefaultSummary(ApiDocWriteEvent<ApiDocNode> event) throws IOException { public void writeDefaultSummary(ApiDocWriteEvent<ApiDocNode> event) throws IOException {
// NOTE: copyed from defaultWriteSummary as that only called with zero summaries + changes name end in; Words // NOTE: copyed from defaultWriteSummary as that only called with zero summaries + changes name end in; Words
ApiDocContentWriter writer = event.getWriter(); ApiDocContentWriter writer = event.getWriter();
@ -72,7 +73,7 @@ public class FCDocSegmentWriterCakeSlice implements FCDocSegmentWriter {
} }
writer.docTableEnd(); writer.docTableEnd();
} }
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY, targetClasses={TDocCakeSlice.class}, nodeBodyOrders=1) @ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY, targetClasses={TDocCakeSlice.class}, nodeBodyOrders=1)
public void writeCakeSliceDetails(ApiDocWriteEvent<ApiDocNode> event) throws IOException { public void writeCakeSliceDetails(ApiDocWriteEvent<ApiDocNode> event) throws IOException {
ApiDocContentWriter writer = event.getWriter(); ApiDocContentWriter writer = event.getWriter();
@ -84,6 +85,7 @@ public class FCDocSegmentWriterCakeSlice implements FCDocSegmentWriter {
writer.docTableRow("Size", Integer.toString(slice.getLength())); writer.docTableRow("Size", Integer.toString(slice.getLength()));
writer.docTableRow("External word", Boolean.toString(slice.isExternWord())); writer.docTableRow("External word", Boolean.toString(slice.isExternWord()));
} }
writeDefaultSummary(event);
// } // }
// //
// @ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY, targetClasses={FourCornerDotCake.class}, nodeBodyOrders=10) // @ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY, targetClasses={FourCornerDotCake.class}, nodeBodyOrders=10)

View file

@ -29,6 +29,7 @@ import java.util.Optional;
import org.x4o.fc18.cake2.FourCornerX00PetitVideCoinCarne; import org.x4o.fc18.cake2.FourCornerX00PetitVideCoinCarne;
import org.x4o.fc18.cake2.FourCornerX06BaklavaPointSequence; import org.x4o.fc18.cake2.FourCornerX06BaklavaPointSequence;
import org.x4o.fc18.cake2.FourCornerX08MuffinPointSequence; import org.x4o.fc18.cake2.FourCornerX08MuffinPointSequence;
import org.x4o.fc18.cake2.FourCornerX18CakePointDotName;
import org.x4o.fc18.cake2.FourCornerX18CakePointSequence; import org.x4o.fc18.cake2.FourCornerX18CakePointSequence;
import org.x4o.fc18.cake2.FourCornerX21CodePointSequence; import org.x4o.fc18.cake2.FourCornerX21CodePointSequence;
import org.x4o.fc18.cake2.FourCornerX00PetitVide; import org.x4o.fc18.cake2.FourCornerX00PetitVide;
@ -54,26 +55,43 @@ public class FCDocSegmentWriterCakeWord implements FCDocSegmentWriter {
TDocCakeWord word = event.getEventObject().toUserData(TDocCakeWord.class); TDocCakeWord word = event.getEventObject().toUserData(TDocCakeWord.class);
FourCornerX00PetitVide[] videPoints = word.getSlice().getVidePoints(); FourCornerX00PetitVide[] videPoints = word.getSlice().getVidePoints();
if (videPoints.length == 0) { if (videPoints.length == 0) {
writer.printTagStart(Tag.pre);
writer.printCharacters("None PetitVide for: " + word.toString());
writer.printTagEnd(Tag.pre);
return; return;
} }
writer.docTableStart("Points Summary", "Encode point for all systems.",ApiDocContentCss.overviewSummary);
writer.docTableHeader("System", "Point Sequence");
FourCornerX00PetitVide videPoint = videPoints[word.getOffset()]; FourCornerX00PetitVide videPoint = videPoints[word.getOffset()];
Optional<FourCornerX21CodePointSequence> x21CodeDisplay = videPoint.kaasX21CodeSequence(); Optional<FourCornerX21CodePointSequence> x21CodeDisplay = videPoint.kaasX21CodeSequence();
Optional<FourCornerX06BaklavaPointSequence> x06BaklavaSequence = videPoint.kaasX06BaklavaSequence(); Optional<FourCornerX06BaklavaPointSequence> x06BaklavaSequence = videPoint.kaasX06BaklavaSequence();
Optional<FourCornerX08MuffinPointSequence> x08MuffinSequence = videPoint.kaasX08MuffinSequence(); Optional<FourCornerX08MuffinPointSequence> x08MuffinSequence = videPoint.kaasX08MuffinSequence();
Optional<FourCornerX18CakePointSequence> x18CakeSequence = videPoint.kaasX18CakeSequence(); Optional<FourCornerX18CakePointSequence> x18CakeSequence = videPoint.kaasX18CakeSequence();
if (x06BaklavaSequence.isPresent()) { Optional<FourCornerX18CakePointDotName> x18DotName = videPoint.kaasX18CakeDotName();
writeSequence(writer, "X06", 2, x06BaklavaSequence.get().baklavaPointSequence());
} writer.docTableStart("Glyph Summary", "The cake point as unicode glyph.",ApiDocContentCss.overviewSummary);
if (x08MuffinSequence.isPresent()) { writer.docTableHeader("Glyph", "Value");
writeSequence(writer, "X08", 2, x08MuffinSequence.get().muffinPointSequence()); String name = word.toString();
} String value = name;
if (x18CakeSequence.isPresent()) { if (x18DotName.isPresent()) {
writeSequence(writer, "X18", 6, x18CakeSequence.get().cakePointSequence()); name = x18DotName.get().name();
} }
if (x21CodeDisplay.isPresent()) { if (x21CodeDisplay.isPresent()) {
writeSequence(writer, "X21", 6, x21CodeDisplay.get().codePointSequence()); StringBuilder buf = new StringBuilder();
x21CodeDisplay.get().codePointSequence().forEach(v -> buf.appendCodePoint(v));
value = buf.toString();
}
writer.docTableRow(name, value);
if (x06BaklavaSequence.isPresent()) {
writeSequence(writer, "Sequence-X06", 2, x06BaklavaSequence.get().baklavaPointSequence());
}
if (x08MuffinSequence.isPresent()) {
writeSequence(writer, "Sequence-X08", 2, x08MuffinSequence.get().muffinPointSequence());
}
if (x18CakeSequence.isPresent()) {
writeSequence(writer, "Sequence-X18", 6, x18CakeSequence.get().cakePointSequence());
}
if (x21CodeDisplay.isPresent()) {
writeSequence(writer, "Sequence-X21", 6, x21CodeDisplay.get().codePointSequence());
} }
writer.docTableEnd(); writer.docTableEnd();
// } // }
@ -90,7 +108,7 @@ public class FCDocSegmentWriterCakeWord implements FCDocSegmentWriter {
// FourCornerX00PetitVide videPoint = videPoints[word.getOffset()]; // FourCornerX00PetitVide videPoint = videPoints[word.getOffset()];
Optional<FourCornerX00PetitVideCoinCarne> x00CoinCarne = videPoint.kaasX00CoinCarne(); Optional<FourCornerX00PetitVideCoinCarne> x00CoinCarne = videPoint.kaasX00CoinCarne();
writer.docTableStart("Kerning Summary", "Kerning all pattern displays.",ApiDocContentCss.overviewSummary); writer.docTableStart("Kerning Summary", "Kerning all pattern displays.",ApiDocContentCss.overviewSummary);
writer.docTableHeader("Location", "Corner indents"); writer.docTableHeader("Location", "Corner dents");
if (x00CoinCarne.isPresent()) { if (x00CoinCarne.isPresent()) {
FourCornerX00PetitVideCoinCarne cornerKerning = x00CoinCarne.get(); FourCornerX00PetitVideCoinCarne cornerKerning = x00CoinCarne.get();
writer.docTableRow("Top", cornerKerning.coinCarneFrapper().kerningTop().name()); writer.docTableRow("Top", cornerKerning.coinCarneFrapper().kerningTop().name());
@ -99,6 +117,7 @@ public class FCDocSegmentWriterCakeWord implements FCDocSegmentWriter {
writer.docTableEnd(); writer.docTableEnd();
} }
private void writeSequence(ApiDocContentWriter writer, String system, int minHex, List<Integer> sequence) throws IOException { private void writeSequence(ApiDocContentWriter writer, String system, int minHex, List<Integer> sequence) throws IOException {
String displayFormat = "0x%0" + minHex + "X"; String displayFormat = "0x%0" + minHex + "X";
StringBuilder buf = new StringBuilder(); StringBuilder buf = new StringBuilder();
@ -112,22 +131,4 @@ public class FCDocSegmentWriterCakeWord implements FCDocSegmentWriter {
} }
writer.docTableRow(system, buf.toString()); writer.docTableRow(system, buf.toString());
} }
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.DETAIL,targetClasses={TDocCakeWord.class})
public void writeCakeWordDetail(ApiDocWriteEvent<ApiDocNode> event) throws IOException {
ApiDocContentWriter writer = event.getWriter();
TDocCakeWord word = event.getEventObject().toUserData(TDocCakeWord.class);
FourCornerX00PetitVide[] videPoints = word.getSlice().getVidePoints();
if (videPoints.length == 0) {
return;
}
FourCornerX00PetitVide letter = videPoints[word.getOffset()];
StringBuilder buf = new StringBuilder();
letter.kaasX21CodeSequence().ifPresent(v -> {
v.codePointSequence().forEach(vv -> buf.appendCodePoint(vv));
});
writer.printTagStart(Tag.pre);
writer.printCharacters(buf.toString());
writer.printTagEnd(Tag.pre);
}
} }

View file

@ -49,4 +49,8 @@ public class TDocCakeWord {
public int getOffset() { public int getOffset() {
return offset; return offset;
} }
public String toString() {
return String.format("%s.0x%06X", slice.name(), slice.getStart() + offset);
}
} }