FC18: Redone binary number encodings

This commit is contained in:
Willem Cazander 2025-09-01 01:11:23 +02:00
parent 46d305b5aa
commit e790e89dd7
18 changed files with 1271 additions and 914 deletions

View file

@ -23,8 +23,12 @@
package org.x4o.fc18.cake2.pie9;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.PrimitiveIterator;
import java.util.Set;
import java.util.stream.Collectors;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@ -32,10 +36,10 @@ import org.x4o.fc18.FourCornerUnicodeDisplay;
import org.x4o.fc18.cake2.FourCornerDotCake;
public class FCDotPIE9Test {
String pieChars;
String cakeChars;
public FCDotPIE9Test() {
int pieStart = FourCornerDotCake.FC_PIE9C_01.getStart();
int pieStop = FourCornerDotCake.FC_PIE9D_27.getStop();
@ -52,7 +56,7 @@ public class FCDotPIE9Test {
}
cakeChars = disp.renderFromInt18(cakePoints);
}
@Test
public void testUnusedUnicodeMath() throws Exception {
int totalMissing = 0;
@ -60,27 +64,21 @@ public class FCDotPIE9Test {
String testChar = new StringBuilder().appendCodePoint(i).toString();
if (!pieChars.contains(testChar)) {
totalMissing++;
//System.out.println(totalMissing + ":missing-test-chr: " + testChar);
// System.out.println(totalMissing + ":missing-test-chr: " + testChar);
}
}
Assertions.assertTrue(totalMissing < 128, "To many math chars missing....");
}
@Test
public void testUnusedKuTen1And2() throws Exception {
// see: https://www.msx.org/wiki/KuTen_-_JIS_-_SJIS_Code_Conversion_Tables
String kuTenPage1 = "、 。 , . ・ : ; ? ! ゛ ゜ ´ ` ¨"+
"^  ̄ _ ヽ ヾ ゝ ゞ 〃 仝 々 〆 〇 ー ― ‐ / " +
"\ ~ ∥ | … ‥ ‘ ’ “ ” ( ) 〔 〕 [ ]" +
" } 〈 〉 《 》 「 」 『 』 【 】 + - ± ×" +
"÷ = ≠ < > ≦ ≧ ∞ ∴ ♂ ♀ ° ′ ″ ℃ ¥" +
"$ ¢ £ % # & * @ § ☆ ★ ○ ● ◎ ◇ ";
String kuTenPage2 = "◆ □ ■ △ ▲ ▽ ▼ ※ 〒 → ← ↑ ↓ 〓" +
"∈ ∋ ⊆ ⊇ ⊂ ⊃" +
"∪ ∩ ∧ ∨ ¬ ⇒ ⇔ ∀ " +
"∃ ∠ ⊥ ⌒ ∂ " +
"∇ ≡ ≒ ≪ ≫ √ ∽ ∝ ∵ ∫ ∬" +
"Å ‰ ♯ ♭ ♪ † ‡ ¶ ◯";
String kuTenPage1 = "、。,.・:;?!゛゜´`¨" + "^ ̄_ヽヾゝゞ〃仝々〆〇ー―‐/"
+ "\~∥|…‥‘’“”()〔〕[]" + "}〈〉《》「」『』【】+-±×"
+ "÷=≠<>≦≧∞∴♂♀°′″℃¥" + "$¢£%#&*@§☆★○●◎◇";
String kuTenPage2 = "◆□■△▲▽▼※〒→←↑↓〓" + "∈∋⊆⊇⊂⊃"
+ "∪∩∧∨¬⇒⇔∀" + "∃∠⊥⌒∂"
+ "∇≡≒≪≫√∽∝∵∫∬" + "ʼn♯♭♪†‡¶◯";
String kuTen = (kuTenPage1 + kuTenPage2).replaceAll("\t", "").replaceAll(" ", "");
int totalMissing = 0;
PrimitiveIterator.OfInt charCheck = kuTen.codePoints().iterator();
@ -88,37 +86,57 @@ public class FCDotPIE9Test {
String testChar = new StringBuilder().appendCodePoint(charCheck.next()).toString();
if (!cakeChars.contains(testChar)) {
totalMissing++;
//System.out.println(totalMissing + ":missing-test-chr: " + testChar);
// System.out.println(totalMissing + ":missing-test-chr: " + testChar);
}
}
Assertions.assertTrue(totalMissing < 128, "To many kuten chars missing....");
}
@Test
public void testUnusedVGATempleOS() throws Exception {
// see: https://github.com/rendello/templeos_font/blob/master/Convert/chars.txt
String vgaTOSChars = " !\"#$%&'()*+,-./"+
"0123456789:;<=>?" +
"@ABCDEFGHIJKLMNO" +
"PQRSTUVWXYZ[\\]^_" +
"`abcdefghijklmno" +
"pqrstuvwxyz{|}~ " +
"çüéâäàȧ êëèïîìÄȦ" +
"ÉæÆôöòûùÿÖÜ¢£¥ 𝑓" +
"áíóú ¿ ½¼¡«»" +
"░▒▓│┤╡╢╖╕╣║╗╝╜╛┐" +
"└┴┬├─┼╞╟╚╔╩╦╠═╬╧" +
"╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀" +
"αβΓπΣσμτΦθΩδ∞ ε " +
"≡±≤≥ ÷≈ √ⁿ² " +
"ВГЁЖЗИЙЛПУФЧШЪЫЭ" +
"ЮЯбвгёжзийклмнпт" +
"чшъыьэюя „”№ " +
" ⅠⅡ↑↓⭰⭲ " +
"ДЦЩдф щ ij🔔 " +
" ⅓ ¾ §¶ ";
String vgaTOSChars = " !\"#$%&'()*+,-./" + "0123456789:;<=>?" + "@ABCDEFGHIJKLMNO" + "PQRSTUVWXYZ[\\]^_" + "`abcdefghijklmno" + "pqrstuvwxyz{|}~ "
+ "çüéâäàȧ êëèïîìÄȦ" + "ÉæÆôöòûùÿÖÜ¢£¥ 𝑓" + "áíóú ¿ ½¼¡«»" + "░▒▓│┤╡╢╖╕╣║╗╝╜╛┐" + "└┴┬├─┼╞╟╚╔╩╦╠═╬╧" + "╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀"
+ "αβΓπΣσμτΦθΩδ∞ ε " + "≡±≤≥ ÷≈ √ⁿ² " + "ВГЁЖЗИЙЛПУФЧШЪЫЭ" + "ЮЯбвгёжзийклмнпт" + "чшъыьэюя „”№ " + " ⅠⅡ↑↓⭰⭲ "
+ "ДЦЩдф щ ij🔔 " + " ⅓ ¾ §¶ ";
int totalMissing = 0;
PrimitiveIterator.OfInt charCheck = vgaTOSChars.codePoints().iterator();
while (charCheck.hasNext()) {
String testChar = new StringBuilder().appendCodePoint(charCheck.next()).toString();
if (!cakeChars.contains(testChar)) {
totalMissing++;
// System.out.println(totalMissing + ":missing-test-chr: " + testChar);
}
}
Assertions.assertTrue(totalMissing < 128, "To many temple os chars missing....");
}
@Test
public void testRussianLCGUnification() throws Exception {
String russianAlphabetString = "АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеёжзийклмнопрстуфхцчшщъыьэюя";
Set<Character> russianSet = new HashSet<>();
for (char c : russianAlphabetString.toCharArray()) {
russianSet.add(c);
}
// todo missing: Ш (russian) -> W (upper latin W)
// todo missing: ш (russian) -> w (small latin w)
List<Character> latin = Arrays.asList('А', 'В', 'Е', 'К', 'М', 'Н', 'О', 'Р', 'С', 'Т', 'У', 'Х', 'а', 'е', 'о', 'р', 'с', 'у', 'х');
// todo missing: к (russian) -> κ (small greek k)
// todo missing: т (russian) -> τ (small greek t)
List<Character> greek = Arrays.asList( 'Ф', 'ф', 'П', 'п', 'Л');
List<Character> brascii = Arrays.asList( 'Ё', 'ё');
russianSet.removeAll( new HashSet<>(latin));
russianSet.removeAll( new HashSet<>(greek)); // 42
russianSet.removeAll( new HashSet<>(brascii));
Assertions.assertEquals(40, russianSet.size()); // need 44
String russianLCG = russianSet.stream().map(v -> new StringBuilder().append(v)).collect(Collectors.joining());
// System.out.println("russianLCG="+russianLCG);
// fixme: move some pair to lua like: Йй, Яя, Жж, Ээ, Дд and left over in pie slice
// fixme2: move dec27 to end, add one lua more, thus have space for 27 + 17 candy
int totalMissing = 0;
PrimitiveIterator.OfInt charCheck = russianLCG.codePoints().iterator();
while (charCheck.hasNext()) {
String testChar = new StringBuilder().appendCodePoint(charCheck.next()).toString();
if (!cakeChars.contains(testChar)) {
@ -126,6 +144,6 @@ public class FCDotPIE9Test {
//System.out.println(totalMissing + ":missing-test-chr: " + testChar);
}
}
Assertions.assertTrue(totalMissing < 128, "To many temple os chars missing....");
Assertions.assertTrue(totalMissing < 128, "To many russian chars missing....");
}
}