diff --git a/lib-numberxd/src/main/love/distributedrebirth/numberxd/base2t/type/V009Tyte.java b/lib-numberxd/src/main/love/distributedrebirth/numberxd/base2t/type/V009Tyte.java index c354a8d5..7860ec1f 100644 --- a/lib-numberxd/src/main/love/distributedrebirth/numberxd/base2t/type/V009Tyte.java +++ b/lib-numberxd/src/main/love/distributedrebirth/numberxd/base2t/type/V009Tyte.java @@ -31,6 +31,20 @@ public final class V009Tyte implements BaseNumberTyte { values[2] = valueLow; } + public short getValueNumber() { + short result = 0; + result += (getValue(T03PartTrit.PART_1).BȍőnRangTelNul() << 0); + result += (getValue(T03PartTrit.PART_2).BȍőnRangTelNul() << 3); + result += (getValue(T03PartTrit.PART_3).BȍőnRangTelNul() << 6); + return result; + } + + public void setValueNumber(short number) { + setValue(T03PartTrit.PART_1, T08PartOctal.values()[(number >> 0) & 0b111]); + setValue(T03PartTrit.PART_2, T08PartOctal.values()[(number >> 3) & 0b111]); + setValue(T03PartTrit.PART_3, T08PartOctal.values()[(number >> 6) & 0b111]); + } + public T08PartOctal getValue(T03PartTrit part) { return values[part.ordinal()]; } diff --git a/lib-numberxd/src/main/love/distributedrebirth/numberxd/base2t/type/V018Tord.java b/lib-numberxd/src/main/love/distributedrebirth/numberxd/base2t/type/V018Tord.java index 50346400..5049af9c 100644 --- a/lib-numberxd/src/main/love/distributedrebirth/numberxd/base2t/type/V018Tord.java +++ b/lib-numberxd/src/main/love/distributedrebirth/numberxd/base2t/type/V018Tord.java @@ -36,6 +36,18 @@ public final class V018Tord implements BaseNumberTyte { setValue(T02PartBinary.PART_2, valueLow); } + public int getValueNumber() { + int result = 0; + result += (getValue(T02PartBinary.PART_1).getValueNumber() << 0); + result += (getValue(T02PartBinary.PART_2).getValueNumber() << 9); + return result; + } + + public void setValueNumber(int number) { + getValue(T02PartBinary.PART_1).setValueNumber((short) ((number >> 0) & 0b111111111)); + getValue(T02PartBinary.PART_2).setValueNumber((short) ((number >> 9) & 0b111111111)); + } + public V009Tyte getValue(T02PartBinary part) { return values[part.ordinal()]; } diff --git a/lib-numberxd/src/main/love/distributedrebirth/numberxd/base2t/type/V036Teger.java b/lib-numberxd/src/main/love/distributedrebirth/numberxd/base2t/type/V036Teger.java index f2b14da5..3b8ac33a 100644 --- a/lib-numberxd/src/main/love/distributedrebirth/numberxd/base2t/type/V036Teger.java +++ b/lib-numberxd/src/main/love/distributedrebirth/numberxd/base2t/type/V036Teger.java @@ -35,6 +35,18 @@ public final class V036Teger implements BaseNumberTyte { setValue(T02PartBinary.PART_2, valueLow); } + public long getValueNumber() { + int result = 0; + result += (getValue(T02PartBinary.PART_1).getValueNumber() << 0); + result += (getValue(T02PartBinary.PART_2).getValueNumber() << 18); + return result; + } + + public void setValueNumber(long number) { + getValue(T02PartBinary.PART_1).setValueNumber((int) ((number >> 0) & 0b111111111111111111)); + getValue(T02PartBinary.PART_2).setValueNumber((int) ((number >> 18) & 0b111111111111111111)); + } + public V018Tord getValue(T02PartBinary part) { return values[part.ordinal()]; } diff --git a/lib-numberxd/src/main/love/distributedrebirth/numberxd/glyph/BaseGlyphSet.java b/lib-numberxd/src/main/love/distributedrebirth/numberxd/glyph/BaseGlyphSet.java index c6bdbe92..b00707db 100644 --- a/lib-numberxd/src/main/love/distributedrebirth/numberxd/glyph/BaseGlyphSet.java +++ b/lib-numberxd/src/main/love/distributedrebirth/numberxd/glyph/BaseGlyphSet.java @@ -105,13 +105,13 @@ public enum BaseGlyphSet implements DefaultEnumSetᴶᴹˣ T10PartDecimal.PART_1.BãßVoorElk(x -> v.add(x.BȍőnChinaKey()))), null, @@ -122,7 +122,7 @@ public enum BaseGlyphSet implements DefaultEnumSetᴶᴹˣ - diff --git a/lib-unicodezd/src/main/love/distributedrebirth/unicode4d/CodePointCommandᶻᴰ.java b/lib-unicodezd/src/main/love/distributedrebirth/unicode4d/CodePointCommandᶻᴰ.java new file mode 100644 index 00000000..6894045b --- /dev/null +++ b/lib-unicodezd/src/main/love/distributedrebirth/unicode4d/CodePointCommandᶻᴰ.java @@ -0,0 +1,20 @@ +package love.distributedrebirth.unicode4d; + +import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; + +@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") +public enum CodePointCommandᶻᴰ { + NOP, + START, // PART_1 = modifier, PART_2 = direction + UNICODE, + NUMBER, + ADVANCE, + XY_MIN, + XY_MAX, + XY_COLOR, // PART_1 = 64 colors, PART_2 = 5 contrast levels + XY_ON_CURVE_START, + XY_OFF_CURVE_START, + XY_ON_CURVE, + XY_OFF_CURVE, + XY_SPACE +} diff --git a/lib-unicodezd/src/main/love/distributedrebirth/unicode4d/CodePointᶻᴰ.java b/lib-unicodezd/src/main/love/distributedrebirth/unicode4d/CodePointᶻᴰ.java index f21686f6..da51c9d3 100644 --- a/lib-unicodezd/src/main/love/distributedrebirth/unicode4d/CodePointᶻᴰ.java +++ b/lib-unicodezd/src/main/love/distributedrebirth/unicode4d/CodePointᶻᴰ.java @@ -1,69 +1,68 @@ package love.distributedrebirth.unicode4d; -import love.distributedrebirth.numberxd.base2t.type.V072Tong; +import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; +import love.distributedrebirth.numberxd.base2t.part.T02PartBinary; +import love.distributedrebirth.numberxd.base2t.type.V036Teger; -public class CodePointᶻᴰ { - - private final V072Tong value; +@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") +public enum CodePointᶻᴰ { - public CodePointᶻᴰ(V072Tong value) { - this.value = value; + INSTANCE; + + private static final int MASK_CMD = 0b111000000000000000; + private static final int MASK_ARGU = 0b000111111111111111; + + public static final int MODIFIER_STRIKE_HIGH = 0b000000000000000001; + public static final int MODIFIER_STRIKE_MID = 0b000000000000000010; + public static final int MODIFIER_STRIKE_LOW = 0b000000000000000100; + public static final int MODIFIER_STRIKE_UNDER = 0b000000000000001000; + public static final int MODIFIER_ITALIC_LR = 0b000000000000010000; + public static final int MODIFIER_ITALIC_RL = 0b000000000000100000; + public static final int MODIFIER_SCRIPT_TOP = 0b000000000001000000; + public static final int MODIFIER_SCRIPT_SUB = 0b000000000010000000; + public static final int MODIFIER_ENVELOP = 0b000000000100000000; + + public int getArgument(V036Teger teger, T02PartBinary part) { + return teger.getValue(part).getValueNumber() & MASK_ARGU; } - enum TegerSplitMode { - NOP, - UNICODE, // + direction - ADVANCE, - XY_SET, - - XY_MIN, - XY_MAX, - NUMBER, - MOD_COLOR, // color = 4b+2b + mod 2x2b darker - // MODIFIER; - // STRIKE_HIGH, - // STRIKE_MID, - // STRIKE_LOW, - // STRIKE_UNDER, - // ITALIC_LR, - // ITALIC_RL, - // SCRIPT_TOP, - // SCRIPT_SUB, - // INVISIBLE - - FREE_B4, // envelop - FREE_B3, - FREE_B2, - FREE_B1, - - FREE_A4, - FREE_A3, - FREE_A2, - FREE_A1, + public void setArgument(V036Teger teger, T02PartBinary part, int number) { + int value = teger.getValue(part).getValueNumber(); + teger.getValue(part).setValueNumber((value & MASK_CMD) + (number & MASK_ARGU)); } - /** - * 72 bits (8x tyte) - * - * - * V036Teger is point: x+y of 4 digits + sign + boolean - * x=2xtyte=tord=18bit - * y=tord-3=15b + mode - * - * V072Tong - 0 - * cmd0 unicode="011000" - * cmd1 advanceWidth="183" leftSideBearing="10" - * - * V072Tong - 1 - * cmd0 xMin="10" yMin="480" - * cmd1 xMax="134" yMax="616" - * - * V072Tong - 2 - * cmd0 x="10" y="548" onCurve="true" start - * cmd1 color select - * - * V072Tong - 3 - * cmd0 x="10" y="548" onCurve="true" end - * cmd1 nop padding. - */ + public int getArgumentUnicode(V036Teger teger) { + int unicode = 0; + unicode += teger.getValue(T02PartBinary.PART_1).getValueNumber(); + unicode += teger.getValue(T02PartBinary.PART_2).getValueNumber() << 18; + return unicode; + } + + public void setArgumentUnicode(V036Teger teger, int unicode) { + teger.getValue(T02PartBinary.PART_1).setValueNumber(unicode); + teger.getValue(T02PartBinary.PART_2).setValueNumber(unicode >> 18); + } + + public long getArgumentNumber(V036Teger teger) { + return teger.getValueNumber(); + } + + public void setArgumentNumber(V036Teger teger, long number) { + teger.setValueNumber(number); + } + + public CodePointCommandᶻᴰ getCommand(V036Teger teger) { + int mode = 0; + mode += ((teger.getValue(T02PartBinary.PART_1).getValueNumber() >> 15) & 0b111) << 0; + mode += ((teger.getValue(T02PartBinary.PART_2).getValueNumber() >> 15) & 0b111) << 3; + return CodePointCommandᶻᴰ.values()[mode]; + } + + public void setCommand(V036Teger teger, CodePointCommandᶻᴰ command) { + int mode = command.ordinal(); + int value1 = teger.getValue(T02PartBinary.PART_1).getValueNumber(); + int value2 = teger.getValue(T02PartBinary.PART_2).getValueNumber(); + teger.getValue(T02PartBinary.PART_1).setValueNumber((value1 & MASK_ARGU) + (((mode >> 0) & 0b111) << 15)); + teger.getValue(T02PartBinary.PART_2).setValueNumber((value2 & MASK_ARGU) + (((mode >> 3) & 0b111) << 15)); + } } diff --git a/lib-unicodezd/src/main/love/distributedrebirth/unicode4d/Stringᶻᴰ.java b/lib-unicodezd/src/main/love/distributedrebirth/unicode4d/Stringᶻᴰ.java index 4062a1f0..b34a9402 100644 --- a/lib-unicodezd/src/main/love/distributedrebirth/unicode4d/Stringᶻᴰ.java +++ b/lib-unicodezd/src/main/love/distributedrebirth/unicode4d/Stringᶻᴰ.java @@ -1,5 +1,50 @@ package love.distributedrebirth.unicode4d; +import java.util.ArrayList; +import java.util.List; + +import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; +import love.distributedrebirth.numberxd.base2t.part.T02PartBinary; +import love.distributedrebirth.numberxd.base2t.type.V036Teger; +import love.distributedrebirth.numberxd.base2t.type.V072Tong; + +@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") public class Stringᶻᴰ { + private List string; + + public Stringᶻᴰ(List tongs) { + this.string = tongs; + } + + public int codePointSize() { + return string.size() * 2; + } + + public V036Teger getCodePointByIndex(int index) { + V072Tong tong = string.get(index >> 1); + if ((index & 1) == 0) { + return tong.getValue(T02PartBinary.PART_1); + } else { + return tong.getValue(T02PartBinary.PART_2); + } + } + + public int charSize() { + int result = 0; + for (V072Tong points:string) { + CodePointCommandᶻᴰ cmd = CodePointᶻᴰ.INSTANCE.getCommand(points.getValue(T02PartBinary.PART_1)); + if (cmd == CodePointCommandᶻᴰ.START) { + result++; + } + } + return result; + } + + public Stringᶻᴰ concat(Stringᶻᴰ argu) { + List data = new ArrayList<>(string.size()); + data.addAll(string); + data.addAll(argu.string); + return new Stringᶻᴰ(data); + } } diff --git a/lib-unicodezd/src/main/love/distributedrebirth/unicode4d/base/UnicodePlane.java b/lib-unicodezd/src/main/love/distributedrebirth/unicode4d/base/UnicodePlane.java new file mode 100644 index 00000000..0a983d72 --- /dev/null +++ b/lib-unicodezd/src/main/love/distributedrebirth/unicode4d/base/UnicodePlane.java @@ -0,0 +1,35 @@ +package love.distributedrebirth.unicode4d.base; + +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; + +@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") +public class UnicodePlane { + + private Map planes = new HashMap<>(); + + public UnicodePlane() { + } + + public UnicodePlaneBase getPlaneByName(String name) { + return planes.get(name); + } + + public Collection getPlanes() { + return planes.values(); + } + + public void setPlanes(List planes) { + for (UnicodePlaneBase plane:planes) { + addPlane(plane); + } + } + + public void addPlane(UnicodePlaneBase plane) { + this.planes.put(plane.getName(), plane); + } +} diff --git a/lib-unicodezd/src/main/love/distributedrebirth/unicode4d/base/UnicodePlaneBase.java b/lib-unicodezd/src/main/love/distributedrebirth/unicode4d/base/UnicodePlaneBase.java new file mode 100644 index 00000000..a4d02abe --- /dev/null +++ b/lib-unicodezd/src/main/love/distributedrebirth/unicode4d/base/UnicodePlaneBase.java @@ -0,0 +1,44 @@ +package love.distributedrebirth.unicode4d.base; + +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; + +@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") +public class UnicodePlaneBase { + + private String name; + private Map baseGlyphs = new HashMap<>(); + + public UnicodePlaneBase() { + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public UnicodePlaneBaseGlyph getBaseGlyphByUnicode(String unicode) { + return baseGlyphs.get(unicode); + } + + public Collection getBaseGlyphs() { + return baseGlyphs.values(); + } + + public void setBaseGlyphs(List baseGlyphs) { + for (UnicodePlaneBaseGlyph baseGlyph:baseGlyphs) { + addBaseGlyph(baseGlyph); + } + } + + public void addBaseGlyph(UnicodePlaneBaseGlyph baseGlyph) { + this.baseGlyphs.put(baseGlyph.getUnicode(),baseGlyph); + } +} diff --git a/lib-unicodezd/src/main/love/distributedrebirth/unicode4d/base/UnicodePlaneBaseGlyph.java b/lib-unicodezd/src/main/love/distributedrebirth/unicode4d/base/UnicodePlaneBaseGlyph.java new file mode 100644 index 00000000..b546f571 --- /dev/null +++ b/lib-unicodezd/src/main/love/distributedrebirth/unicode4d/base/UnicodePlaneBaseGlyph.java @@ -0,0 +1,64 @@ +package love.distributedrebirth.unicode4d.base; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Base64; +import java.util.List; + +import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; +import love.distributedrebirth.numberxd.base2t.Base2Terminator; +import love.distributedrebirth.numberxd.base2t.type.V072Tong; + +@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") +public class UnicodePlaneBaseGlyph { + + private String unicode; + private List glyph = new ArrayList<>(); + + public UnicodePlaneBaseGlyph() { + } + + public String getUnicode() { + return unicode; + } + + public void setUnicode(String unicode) { + this.unicode = unicode; + } + + public List getGlyph() { + return glyph; + } + + public void setGlyph(List glyph) { + this.glyph = glyph; + } + + public void addGlyph(V072Tong glyph) { + this.glyph.add(glyph); + } + + public String getBase64() { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try { + Base2Terminator.INSTANCE.Bãß2WriteTong(glyph, baos); + } catch (IOException e) { + throw new RuntimeException(e); + } + return Base64.getEncoder().encodeToString(baos.toByteArray()); + } + + public void setBase64(String base64) { + byte[] decodedBytes = Base64.getDecoder().decode(base64); + ByteArrayInputStream bais = new ByteArrayInputStream(decodedBytes); + try { + List result = new ArrayList<>(); + Base2Terminator.INSTANCE.Bãß2ReadTong(bais, result); + glyph = result; + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/lib-unicodezd/src/main/love/distributedrebirth/unicode4d/base/UnicodePlaneDriver.java b/lib-unicodezd/src/main/love/distributedrebirth/unicode4d/base/UnicodePlaneDriver.java new file mode 100644 index 00000000..2040ee38 --- /dev/null +++ b/lib-unicodezd/src/main/love/distributedrebirth/unicode4d/base/UnicodePlaneDriver.java @@ -0,0 +1,27 @@ +package love.distributedrebirth.unicode4d.base; + +import org.x4o.xml.X4ODriver; +import org.x4o.xml.X4ODriverManager; + +import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; + +@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") +public class UnicodePlaneDriver extends X4ODriver { + + static final public String LANGUAGE_NAME = "unicode-plane"; + static final public String[] LANGUAGE_VERSIONS = new String[]{X4ODriver.DEFAULT_LANGUAGE_VERSION}; + + @Override + public String getLanguageName() { + return LANGUAGE_NAME; + } + + @Override + public String[] getLanguageVersions() { + return LANGUAGE_VERSIONS; + } + + static public UnicodePlaneDriver newInstance() { + return (UnicodePlaneDriver)X4ODriverManager.getX4ODriver(LANGUAGE_NAME); + } +} diff --git a/lib-unicodezd/src/main/love/distributedrebirth/unicode4d/base/UnicodePlaneᶻᴰ.java b/lib-unicodezd/src/main/love/distributedrebirth/unicode4d/base/UnicodePlaneᶻᴰ.java new file mode 100644 index 00000000..7403725f --- /dev/null +++ b/lib-unicodezd/src/main/love/distributedrebirth/unicode4d/base/UnicodePlaneᶻᴰ.java @@ -0,0 +1,373 @@ +package love.distributedrebirth.unicode4d.base; + +import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; + +@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") +public enum UnicodePlaneᶻᴰ { + + // =========== PLANE 0 + + BASIC_LATIN(0x0000, 0x007F), + LATIN1_SUPPLEMENT(0x080,0x00FF), + LATIN_EXTENDED_A(0x0100,0x017F), + LATIN_EXTENDED_B(0x0180,0x024F), + IPA_EXTENSIONS(0x0250,0x02AF), + SPACING_MODIFIER_LETTERS(0x02B0,0x02FF), + COMBINING_DIACRITICAL_MARKS(0x0300,0x036F), + GREEK_AND_COPTIC(0x0370,0x03FF), + CYRILLIC(0x0400,0x04FF), + CYRILLIC_SUPPLEMENT(0x0500,0x052F), + ARMENIAN(0x0530,0x058F), + + HEBREW(0x0590,0x05FF), + ARABIC(0x0600,0x06FF), + SYRIAC(0x0700,0x074F), + ARABIC_SUPPLEMENT(0x0750,0x077F), + THAANA(0x0780,0x07BF), + NKO(0x07C0,0x07FF), + SAMARITAN(0x0800,0x083F), + MANDAIC(0x0840,0x085F), + SYRIAC_SUPPLEMENT(0x0860,0x086F), + ARABIC_EXTENDED_B(0x0870,0x089F), + ARABIV_EXTENDED_A(0x08A0,0x08FF), + + DEVANAGARI(0x0900,0x097F), + BENGALI(0x0980,0x09FF), + GURMUKHI(0x0A00,0x0A7F), + GUJARATI(0x0A80,0x0AFF), + ORIYA(0x0B00,0x0B7F), + TAMIL(0x0B80,0x0BFF), + TELUGU(0x0C00,0x0C7F), + KANNADA(0x0C80,0x0CFF), + MALAYALAM(0x0D00,0x0D7F), + SINHALA(0x0D80,0x0DFF), + THAI(0x0E00,0x0E7F), + LAO(0x0E80,0x0EFF), + TIBETAN(0x0F00,0x0FFF), + MYANMAR(0x1000,0x109F), + + GEORGIAN(0x10A0,0x10FF), + HANGUL_JAMO(0x1100,0x11FF), + ETHIOPIC(0x1200,0x137F), + ETHIOPIC_SUPPLEMENT(0x1380,0x139F), + CHEROKEE(0x13A0,0x13FF), + UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS(0x1400,0x167F), + OGHAM(0x1680,0x169F), + RUNIC(0x16A0,0x16FF), + + TAGALOG (0x1700,0x171F), + HANUNOO (0x1720,0x173F), + BUHID (0x1740,0x175F), + TAGBANWA (0x1760,0x177F), + + KHMER (0x1780,0x17FF), + MONGOLIAN (0x1800,0x18AF), + UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS_EXTENDED(0x18B0,0x18FF), + LIMBU(0x1900,0x194F), + + TAI_LE (0x1950,0x197F), + NEW_TAI_LUE (0x1980,0x19DF), + KHMER_SYMBOLS (0x19E0,0x19FF), + BUGINESE (0x1A00,0x1A1F), + TAI_THAM (0x1A20,0x1AAF), + + COMBINING_DIACRITICAL_MARKS_EXTENDED(0x1AB0,0x1AFF), + BALINESE (0x1B00,0x1B7F), + SUNDANESE (0x1B80,0x1BBF), + BATAK (0x1BC0,0x1BFF), + LEPCHA (0x1C00,0x1C4F), + OL_CHIKI (0x1C50,0x1C7F), + CYRILLIC_EXTENDED_C (0x1C80,0x1C8F), + GEORGIAN_EXTENDED (0x1C90,0x1CBF), + SUNDANESE_SUPPLEMENT (0x1CC0,0x1CCF), + VEDIC_EXTENSIONS (0x1CD0,0x1CFF), + + PHONETIC_EXTENSIONS (0x1D00,0x1D7F), + PHONETIC_EXTENSIONS_SUPPLEMENT (0x1D80,0x1DBF), + COMBINING_DIACRITICAL_MARKS_SUPPLEMENT (0x1DC0,0x1DFF), + LATIN_EXTENDED_ADDITINAL (0x1E00,0x1EFF), + GREEK_EXTENDED (0x1F00,0x1FFF), + + GENERAL_PUNCTUATION (0x2000,0x206F), + SUPERSCRIPTS_AND_SUBSCRIPTS (0x2070,0x209F), + CURRENCY_SYMBOLS (0x20A0,0x20CF), + COMBINING_DIACRITICAL_MARKS_FOR_SYMBOLS (0x20D0,0x20FF), + LETTERLIKE_SYMBOLS (0x2100,0x214F), + NUMBER_FORMS (0x2150,0x218F), + ARROWS (0x2190,0x21FF), + MATHEMATICAL_OPERATORS (0x2200,0x22FF), + MISCELLANEOUS_TECHNICAL (0x2300,0x23FF), + CONTROL_PICTURES (0x2400,0x243F), + OPTICAL_CHARACTER_RECOGNITION (0x2440,0x245F), + ENCLOSED_ALPHANUMERICS (0x2460,0x24FF), + BOX_DRAWING (0x2500,0x257F), + BLOCK_ELEMENTS (0x2580,0x259F), + GEOMETRIC_SHAPES (0x25A0,0x25FF), + MISCELLANEOUS_SYMBOLS (0x2600,0x26FF), + DINGBATS (0x2700,0x27BF), + MISCELLANEOUS_MATHEMATICAL_SYMBOLS_A (0x27C0,0x27EF), + SUPPLEMENTAL_ARROWS_A (0x27F0,0x27FF), + BRAILLE_PATTERNS (0x2800,0x28FF), + SUPPLEMENTAL_ARROWS_B (0x2900,0x297F), + MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B (0x2980,0x29FF), + SUPPLEMENTAL_MATHEMATICAL_OPERATORS (0x2A00,0x2AFF), + MISCELLANEOUS_SYMBOLS_AND_ARROWS (0x2B00,0x2BFF), + + GLAGOLITIC (0x2C00,0x2C5F), + LATIN_EXTENDED_C (0x2C60,0x2C7F), + COPTIC (0x2C80,0x2CFF), + GEORGIAN_SUPPLEMENT (0x2D00,0x2D2F), + TIFINAGH (0x2D30,0x2D7F), + ETHIOPIC_EXTENDED (0x2D80,0x2DDF), + CYRILLIC_EXTENDED_A (0x2DE0,0x2DFF), + SUPPLEMENTAL_PUNCTUATION (0x2E00,0x2E7F), + + CJK_RADICALS_SUPPLEMENT (0x2E80,0x2EFF), + KANGXI_RADICALS (0x2F00,0x2FDF), + IDEOGRAPHIC_DESCRIPTION_CHARACTERS (0x2FF0,0x2FFF), + CJK_SYMBOLS_AND_PUNCTUATION (0x3000,0x303F), + HIRAGANA (0x3040,0x309F), + KATAKANA (0x30A0,0x30FF), + BOPOMOFO (0x3100,0x312F), + HANGUL_COMPATIBILITY_JAMO (0x3130,0x318F), + KANBUN (0x3190,0x319F), + BOPOMOFO_EXTENDED (0x31A0,0x31BF), + CJK_STROKES (0x31C0,0x31EF), + KATAKANA_PHONETIC_EXTENSIONS (0x31F0,0x31FF), + ENCLOSED_CJK_LETTERS_AND_MONTHS (0x3200,0x32FF), + CJK_COMPATIBILITY (0x3300,0x33FF), + CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A (0x3400,0x4DBF), + YIJING_HEXAGRAM_SYMBOLS (0x4DC0,0x4DFF), + CJK_UNIFIED_IDEOGRAPHS (0x4E00,0x9FFF), + + YI_SYLLABLES (0xA000,0xA48F), + YI_RADICALS (0xA490,0xA4CF), + LISU (0xA4D0,0xA4FF), + VAI (0xA500,0xA63F), + CYRILLIC_EXTENDED_B (0xA640,0xA69F), + BAMUM (0xA6A0,0xA6FF), + MODIFIER_TONE_LETTERS (0xA700,0xA71F), + LATIN_EXTENDED_D (0xA720,0xA7FF), + SYLOTI_NAGRI (0xA800,0xA82F), + COMMON_INDIC_NUMBER_FORMS (0xA830,0xA83F), + PHAGS_PA (0xA840,0xA87F), + SAURASHTRA (0xA880,0xA8DF), + DEVANAGARI_EXTENDED (0xA8E0,0xA8FF), + KAYAH_LI (0xA900,0xA92F), + REJANG (0xA930,0xA95F), + HANGUL_JAMO_EXTENDED_A (0xA960,0xA97F), + JAVANESE (0xA980,0xA9DF), + MYANMAR_EXTENDED_B (0xA9E0,0xA9FF), + CHAM (0xAA00,0xAA5F), + MYANMAR_EXTENDED_A (0xAA60,0xAA7F), + TAI_VIET (0xAA80,0xAADF), + MEETEI_MAYEK_EXTENSIONS (0xAAE0,0xAAFF), + ETHIOPIC_EXTENDED_A (0xAB00,0xAB2F), + LATIN_EXTENDED_E (0xAB30,0xAB6F), + CHEROKEE_SUPPLEMENT (0xAB70,0xABBF), + MEETEI_MAYEK (0xABC0,0xABFF), + HANGUL_SYLLABLES (0xAC00,0xD7AF), + HANGUL_JAMO_EXTENDED_B (0xD7B0,0xD7FF), + + HIGH_SURROGATES (0xD800,0xDB7F), + HIGH_PRIVATE_USE_SURROGATES (0xDB80,0xDBFF), + LOW_SURROGATES (0xDC00,0xDFFF), + + PRIVATE_USE_AREA (0xE000,0xF8FF), + CJK_COMPATIBILITY_IDEOGRAPHS (0xF900,0xFAFF), + ALPHABETIC_PRESENTATION_FORMS (0xFB00,0xFB4F), + ARABIC_PRESENTATION_FORMS_A (0xFB50,0xFDFF), + VARIATION_SELECTORS (0xFE00,0xFE0F), + VERTICAL_FORMS (0xFE10,0xFE1F), + COMBINING_HALF_MARKS (0xFE20,0xFE2F), + CJK_COMPATIBILITY_FORMS (0xFE30,0xFE4F), + SMALL_FORM_VARIANTS (0xFE50,0xFE6F), + ARABIC_PRESENTATION_FORMS_B (0xFE70,0xFEFF), + HALFWIDTH_AND_FULLWIDTH_FORMS (0xFF00,0xFFEF), + SPECIALS (0xFFF0,0xFFFF), + + // =========== PLANE 1 + + LINEAR_B_SYLLABARY (0x10000,0x1007F), + LINEAR_B_IDEOGRAMS (0x10080,0x100FF), + AEGEAN_NUMBERS (0x10100,0x1013F), + ANCIENT_GREEK_NUMBERS (0x10140,0x1018F), + ANCIENT_SYMBOLS (0x10190,0x101CF), + PHAISTOS_DISC (0x101D0,0x101FF), + LYCIAN (0x10280,0x1029F), + CARIAN (0x102A0,0x102DF), + COPTIC_EPACT_NUMBERS (0x102E0,0x102FF), + OLD_ITALIC (0x10300,0x1032F), + GOTHIC (0x10330,0x1034F), + OLD_PERMIC (0x10350,0x1037F), + UGARITIC (0x10380,0x1039F), + OLD_PERSIAN (0x103A0,0x103DF), + DESERET (0x10400,0x1044F), + SHAVIAN (0x10450,0x1047F), + OSMANYA (0x10480,0x104AF), + OSAGE (0x104B0,0x104FF), + ELBASAN (0x10500,0x1052F), + CAUCASIAN_ALBANIAN (0x10530,0x1056F), + VITHKUQI (0x10570,0x105BF), + LINEAR_A (0x10600,0x1077F), + LATIN_EXTENDED_F (0x10780,0x107BF), + + CYPRIOT_SYLLABARY (0x10800,0x1083F), + IMPERIAL_ARAMAIC (0x10840,0x1085F), + PALMYRENE (0x10860,0x1087F), + NABATAEAN (0x10880,0x108AF), + HATRAN (0x108E0,0x108FF), + PHOENICIAN (0x10900,0x1091F), + LYDIAN (0x10920,0x1093F), + MEROITIC_HIEROGLYPHS (0x10980,0x1099F), + MEROITIC_CURSIVE (0x109A0,0x109FF), + KHAROSHTHI (0x10A00,0x10A5F), + OLD_SOUTH_ARABIAN (0x10A60,0x10A7F), + OLD_NORTH_ARABIAN (0x10A80,0x10A9F), + MANICHAEAN (0x10AC0,0x10AFF), + AVESTAN (0x10B00,0x10B3F), + INSCRIPTIONAL_PARTHIAN (0x10B40,0x10B5F), + INSCRIPTIONAL_PAHLAVI (0x10B60,0x10B7F), + PSALTER_PAHLAVI (0x10B80,0x10BAF), + OLD_TURKIC (0x10C00,0x10C4F), + OLD_HUNGARIAN (0x10C80,0x10CFF), + HANIFI_ROHINGYA (0x10D00,0x10D3F), + RUMI_NUMERAL_SYMBOLS (0x10E60,0x10E7F), + YEZIDI (0x10E80,0x10EBF), + OLD_SOGDIAN (0x10F00,0x10F2F), + SOGDIAN (0x10F30,0x10F6F), + OLD_UYGHUR (0x10F70,0x10FAF), + CHORASMIAN (0x10FB0,0x10FDF), + ELYMAIC (0x10FE0,0x10FFF), + + BRAHMI (0x11000,0x1107F), + KAITHI (0x11080,0x110CF), + SORA_SOMPENG (0x110D0,0x110FF), + CHAKMA (0x11100,0x1114F), + MAHAJANI (0x11150,0x1117F), + SHARADA (0x11180,0x111DF), + SINHALA_ARCHAIC_NUMBERS (0x111E0,0x111FF), + KHOJKI (0x11200,0x1124F), + MULTANI (0x11280,0x112AF), + KHUDAWADI (0x112B0,0x112FF), + GRANTHA (0x11300,0x1137F), + NEWA (0x11400,0x1147F), + TIRHUTA (0x11480,0x114DF), + SIDDHAM (0x11580,0x115FF), + MODI (0x11600,0x1165F), + MONGOLIAN_SUPPLEMENT (0x11660,0x1167F), + TAKRI (0x11680,0x116CF), + AHOM (0x11700,0x1174F), + DOGRA (0x11800,0x1184F), + WARANG_CITI (0x118A0,0x118FF), + DIVES_AKURU (0x11900,0x1195F), + NANDINAGARI (0x119A0,0x119FF), + ZANABAZAR_SQUARE (0x11A00,0x11A4F), + SOYOMBO (0x11A50,0x11AAF), + + UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS_EXTENDED_A (0X11AB0,0X11ABF), + + PAU_CIN_HAU (0X11AC0,0X11AFF), + BHAIKSUKI (0X11C00,0X11C6F), + MARCHEN (0X11C70,0X11CBF), + MASARAM_GONDI (0X11D00,0X11D5F), + GUNJALA_GONDI (0X11D60,0X11DAF), + MAKASAR (0X11EE0,0X11EFF), + + LISU_SUPPLEMENT (0X11FB0,0X11FBF), + TAMIL_SUPPLEMENT (0X11FC0,0X11FFF), + CUNEIFORM (0X12000,0X123FF), + CUNEIFORM_NUMBERS_AND_PUNCTUATION (0X12400,0X1247F), + EARLY_DYNASTIC_CUNEIFORM (0X12480,0X1254F), + CYPRO_MINOAN (0X12F90,0X12FFF), + EGYPTIAN_HIEROGLYPHS (0X13000,0X1342F), + EGYPTIAN_HIEROGLYPH_FORMAT_CONTROLS (0X13430,0X1343F), + ANATOLIAN_HIEROGLYPHS (0X14400,0X1467F), + BAMUM_SUPPLEMENT (0X16800,0X16A3F), + MRO (0X16A40,0X16A6F), + TANGSA (0X16A70,0X16ACF), + BASSA_VAH (0X16AD0,0X16AFF), + PAHAWH_HMONG (0X16B00,0X16B8F), + MEDEFAIDRIN (0X16E40,0X16E9F), + MIAO (0X16F00,0X16F9F), + IDEOGRAPHIC_SYMBOLS_AND_PUNCTUATION (0X16FE0,0X16FFF), + TANGUT (0X17000,0X187FF), + TANGUT_COMPONENTS (0X18800,0X18AFF), + KHITAN_SMALL_SCRIPT (0X18B00,0X18CFF), + TANGUT_SUPPLEMENT (0X18D00,0X18D7F), + KANA_EXTENDED_B (0X1AFF0,0X1AFFF), + KANA_SUPPLEMENT (0X1B000,0X1B0FF), + KANA_EXTENDED_A (0X1B100,0X1B12F), + SMALL_KANA_EXTENSION (0X1B130,0X1B16F), + NUSHU (0X1B170,0X1B2FF), + DUPLOYAN (0X1BC00,0X1BC9F), + SHORTHAND_FORMAT_CONTROLS (0X1BCA0,0X1BCAF), + + ZNAMENNY_MUSICAL_NOTATION (0X1CF00,0X1CFCF), + BYZANTINE_MUSICAL_SYMBOLS (0X1D000,0X1D0FF), + MUSICAL_SYMBOLS (0X1D100,0X1D1FF), + ANCIENT_GREEK_MUSICAL_NOTATION (0X1D200,0X1D24F), + MAYAN_NUMERALS (0X1D2E0,0X1D2FF), + TAI_XUAN_JING_SYMBOLS (0X1D300,0X1D35F), + COUNTING_ROD_NUMERALS (0X1D360,0X1D37F), + MATHEMATICAL_ALPHANUMERIC_SYMBOLS (0X1D400,0X1D7FF), + SUTTON_SIGNWRITING (0X1D800,0X1DAAF), + + LATIN_EXTENDED_G (0X1DF00,0X1DFFF), + GLAGOLITIC_SUPPLEMENT (0X1E000,0X1E02F), + NYIAKENG_PUACHUE_HMONG (0X1E100,0X1E14F), + TOTO (0X1E290,0X1E2BF), + WANCHO (0X1E2C0,0X1E2FF), + ETHIOPIC_EXTENDED_B (0X1E7E0,0X1E7FF), + MENDE_KIKAKUI (0X1E800,0X1E8DF), + ADLAM (0X1E900,0X1E95F), + INDIC_SIYAQ_NUMBERS (0X1EC70,0X1ECBF), + OTTOMAN_SIYAQ_NUMBERS (0X1ED00,0X1ED4F), + ARABIC_MATHEMATICAL_ALPHABETIC_SYMBOLS (0X1EE00,0X1EEFF), + + MAHJONG_TILES (0X1F000,0X1F02F), + DOMINO_TILES (0X1F030,0X1F09F), + PLAYING_CARDS (0X1F0A0,0X1F0FF), + + ENCLOSED_ALPHANUMERIC_SUPPLEMENT (0X1F100,0X1F1FF), + ENCLOSED_IDEOGRAPHIC_SUPPLEMENT (0X1F200,0X1F2FF), + MISCELLANEOUS_SYMBOLS_AND_PICTOGRAPHS (0X1F300,0X1F5FF), + EMOTICONS (0X1F600,0X1F64F), + ORNAMENTAL_DINGBATS (0X1F650,0X1F67F), + TRANSPORT_AND_MAP_SYMBOLS (0X1F680,0X1F6FF), + ALCHEMICAL_SYMBOLS (0X1F700,0X1F77F), + GEOMETRIC_SHAPES_EXTENDED (0X1F780,0X1F7FF), + SUPPLEMENTAL_ARROWS_C (0X1F800,0X1F8FF), + SUPPLEMENTAL_SYMBOLS_AND_PICTOGRAPHS (0X1F900,0X1F9FF), + CHESS_SYMBOLS (0X1FA00,0X1FA6F), + SYMBOLS_AND_PICTOGRAPHS_EXTENDED_A (0X1FA70,0X1FAFF), + SYMBOLS_FOR_LEGACY_COMPUTING (0X1FB00,0X1FBFF), + + UNKNOWN(0X1FC00,0XFFFFF) + ; + + private final int start; + private final int stop; + + private UnicodePlaneᶻᴰ(int start, int stop) { + this.start = start; + this.stop = stop; + } + + public int getStart() { + return start; + } + + public int getStop() { + return stop; + } + + public static UnicodePlaneᶻᴰ valueOfUnicode(int unicode) { + for (UnicodePlaneᶻᴰ value:values()) { + if (unicode >= value.getStart() && unicode <= value.getStop()) { + return value; + } + } + return UnicodePlaneᶻᴰ.UNKNOWN; + } +} diff --git a/lib-unicodezd/src/resources/META-INF/unicode-plane/unicode-plane-lang.eld b/lib-unicodezd/src/resources/META-INF/unicode-plane/unicode-plane-lang.eld new file mode 100644 index 00000000..85c4118c --- /dev/null +++ b/lib-unicodezd/src/resources/META-INF/unicode-plane/unicode-plane-lang.eld @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/lib-unicodezd/src/resources/META-INF/unicode-plane/unicode-plane-modules.xml b/lib-unicodezd/src/resources/META-INF/unicode-plane/unicode-plane-modules.xml new file mode 100644 index 00000000..70accdd3 --- /dev/null +++ b/lib-unicodezd/src/resources/META-INF/unicode-plane/unicode-plane-modules.xml @@ -0,0 +1,10 @@ + + + + unicode-plane-lang.eld + + diff --git a/lib-unicodezd/src/resources/META-INF/x4o-drivers.xml b/lib-unicodezd/src/resources/META-INF/x4o-drivers.xml new file mode 100644 index 00000000..11957498 --- /dev/null +++ b/lib-unicodezd/src/resources/META-INF/x4o-drivers.xml @@ -0,0 +1,8 @@ + + + + diff --git a/lib-unicodezd/src/test/love/distributedrebirth/unicode4d/TestConvFont.java b/lib-unicodezd/src/test/love/distributedrebirth/unicode4d/TestConvFont.java new file mode 100644 index 00000000..a21b403c --- /dev/null +++ b/lib-unicodezd/src/test/love/distributedrebirth/unicode4d/TestConvFont.java @@ -0,0 +1,292 @@ +package love.distributedrebirth.unicode4d; + +import java.io.File; +import java.io.FileInputStream; +import java.util.ArrayList; +import java.util.List; + +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; + +import org.xml.sax.Attributes; +import org.xml.sax.ContentHandler; +import org.xml.sax.InputSource; +import org.xml.sax.Locator; +import org.xml.sax.SAXException; +import org.xml.sax.XMLReader; + +import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; +import love.distributedrebirth.numberxd.base2t.part.T02PartBinary; +import love.distributedrebirth.numberxd.base2t.type.V072Tong; +import love.distributedrebirth.unicode4d.base.UnicodePlane; +import love.distributedrebirth.unicode4d.base.UnicodePlaneBase; +import love.distributedrebirth.unicode4d.base.UnicodePlaneBaseGlyph; +import love.distributedrebirth.unicode4d.base.UnicodePlaneDriver; +import love.distributedrebirth.unicode4d.base.UnicodePlaneᶻᴰ; + +@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") +public class TestConvFont { + + public static void main(String[] args) { + TestConvFont tcf = new TestConvFont(); + tcf.run(); + } + + public void run() { + UnicodePlane unicodePlane = new UnicodePlane(); + + try { + List results = new ArrayList<>(); + + // NOTE: Are in order like the FontAtlas of ImGui + results.add(conf(unicodePlane, new File("../conv-font/bin/code-2000.xml"))); + results.add(conf(unicodePlane, new File("../conv-font/bin/code-2001.xml"))); + results.add(conf(unicodePlane, new File("../conv-font/bin/code-2002.xml"))); + results.add(conf(unicodePlane, new File("../conv-font/bin/free-sans.xml"))); + results.add(conf(unicodePlane, new File("../conv-font/bin/new-gardiner-bmp.xml"))); + results.add(conf(unicodePlane, new File("../conv-font/bin/fa-solid-900.xml"))); + results.add(conf(unicodePlane, new File("../conv-font/bin/noto-sans-brahmi.xml"))); + + int totalChars = 0; + for (FontContentResult result:results) { + totalChars += result.getGlyphCounter(); + } + System.out.println("Writing export unicode4d with characters: "+totalChars); + + UnicodePlaneDriver.newInstance().createWriter().writeFile(unicodePlane, "../main-gdxapp/assets/font/unicode4d.xml"); + + for (FontContentResult result:results) { + System.out.println("Glyphs import: "+result.getGlyphCounter()+" dropped: "+result.getGlyphDropped()+" from: "+result.getInputName()); + } + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public FontContentResult conf(UnicodePlane unicodePlane, File input) throws Exception { + System.out.println("START WITH: "+input); + SAXParserFactory factory = SAXParserFactory.newInstance(); + SAXParser parser = factory.newSAXParser(); + XMLReader reader = parser.getXMLReader(); + FontContentHandler fontContentHandler = new FontContentHandler(unicodePlane, input.getName()); + reader.setContentHandler(fontContentHandler); + + InputSource inputSource = new InputSource(new FileInputStream(input)); + reader.parse(inputSource); + return fontContentHandler.getResult(); + } + + class FontContentResult { + private final String inputName; + private int glyphCounter = 0; + private int glyphDropped = 0; + + public FontContentResult(String inputName) { + this.inputName = inputName; + } + + public String getInputName() { + return inputName; + } + + public int getGlyphCounter() { + return glyphCounter; + } + + public void incGlyphCounter() { + this.glyphCounter++; + } + + public int getGlyphDropped() { + return glyphDropped; + } + + public void incGlyphDropped() { + this.glyphDropped++; + } + } + + class FontContentHandler implements ContentHandler { + + private final UnicodePlane unicodePlane; + private final FontContentResult result; + private List glyph; + private boolean startPoint = false; + private V072Tong point = null; + private int unicode = -1; + + + public FontContentHandler(UnicodePlane unicodePlane, String inputName) { + this.unicodePlane = unicodePlane; + this.result = new FontContentResult(inputName); + } + + public FontContentResult getResult() { + return result; + } + + @Override + public void characters(char[] arg0, int arg1, int arg2) throws SAXException { + } + + @Override + public void endDocument() throws SAXException { + } + + @Override + public void endElement(String namespaceURI, String localName, String qName) throws SAXException { + if ("opentype".equals(qName)) { + + } else if ("glyph".equals(qName)) { + + if (CodePointCommandᶻᴰ.NOP != CodePointᶻᴰ.INSTANCE.getCommand(point.getValue(T02PartBinary.PART_1))) { + glyph.add(point); + } + UnicodePlaneᶻᴰ plane = UnicodePlaneᶻᴰ.valueOfUnicode(unicode); + + UnicodePlaneBase planeBase = unicodePlane.getPlaneByName(plane.name()); + if (planeBase == null) { + planeBase = new UnicodePlaneBase(); + planeBase.setName(plane.name()); + unicodePlane.addPlane(planeBase); + } + String unicodeHex = Integer.toHexString(unicode); + UnicodePlaneBaseGlyph baseGlyph = planeBase.getBaseGlyphByUnicode(unicodeHex); + if (baseGlyph != null) { + //System.out.println("============== DUP unicode: "+unicodeHex); + result.incGlyphDropped(); + return; + } + result.incGlyphCounter(); + baseGlyph = new UnicodePlaneBaseGlyph(); + baseGlyph.setUnicode(unicodeHex); + baseGlyph.setGlyph(glyph); + planeBase.addBaseGlyph(baseGlyph); + + //try { + //FileOutputStream out = new FileOutputStream("../conv-font/bin/test/"+unicode+".u4d"); + //Base2Terminator.INSTANCE.Bãß2WriteTong(glyph, out); + //} catch (Exception e) { + // throw new SAXException(e); + //} + + } else if ("contour".equals(qName)) { + + } + } + + @Override + public void endPrefixMapping(String arg0) throws SAXException { + } + + @Override + public void ignorableWhitespace(char[] arg0, int arg1, int arg2) throws SAXException { + } + + @Override + public void processingInstruction(String arg0, String arg1) throws SAXException { + } + + @Override + public void setDocumentLocator(Locator arg0) { + } + + @Override + public void skippedEntity(String arg0) throws SAXException { + } + + @Override + public void startDocument() throws SAXException { + } + + @Override + public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { + + if ("opentype".equals(qName)) { + + } else if ("glyph".equals(qName)) { + glyph = new ArrayList<>(); + point = new V072Tong(); + CodePointᶻᴰ.INSTANCE.setCommand(point.getValue(T02PartBinary.PART_1), CodePointCommandᶻᴰ.NOP); + CodePointᶻᴰ.INSTANCE.setCommand(point.getValue(T02PartBinary.PART_2), CodePointCommandᶻᴰ.NOP); + + unicode = Integer.parseInt(atts.getValue("unicode"), 16); + int xMax = Integer.parseInt(atts.getValue("xMax")); + int yMax = Integer.parseInt(atts.getValue("yMax")); + int xMin = Integer.parseInt(atts.getValue("xMin")); + int yMin = Integer.parseInt(atts.getValue("yMin")); + int advanceWidth = Integer.parseInt(atts.getValue("advanceWidth")); + int leftSideBearing = Integer.parseInt(atts.getValue("leftSideBearing")); + + V072Tong v0 = new V072Tong(); + V072Tong v1 = new V072Tong(); + V072Tong v2 = new V072Tong(); + + CodePointᶻᴰ.INSTANCE.setCommand(v0.getValue(T02PartBinary.PART_1), CodePointCommandᶻᴰ.START); + + CodePointᶻᴰ.INSTANCE.setCommand(v0.getValue(T02PartBinary.PART_2), CodePointCommandᶻᴰ.UNICODE); + CodePointᶻᴰ.INSTANCE.setArgumentUnicode(v0.getValue(T02PartBinary.PART_2), unicode); + + CodePointᶻᴰ.INSTANCE.setCommand(v1.getValue(T02PartBinary.PART_1), CodePointCommandᶻᴰ.XY_MAX); + CodePointᶻᴰ.INSTANCE.setArgument(v1.getValue(T02PartBinary.PART_1), T02PartBinary.PART_1, xMax); + CodePointᶻᴰ.INSTANCE.setArgument(v1.getValue(T02PartBinary.PART_1), T02PartBinary.PART_2, yMax); + + CodePointᶻᴰ.INSTANCE.setCommand(v1.getValue(T02PartBinary.PART_2), CodePointCommandᶻᴰ.XY_MIN); + CodePointᶻᴰ.INSTANCE.setArgument(v1.getValue(T02PartBinary.PART_2), T02PartBinary.PART_1, xMin); + CodePointᶻᴰ.INSTANCE.setArgument(v1.getValue(T02PartBinary.PART_2), T02PartBinary.PART_2, yMin); + + CodePointᶻᴰ.INSTANCE.setCommand(v2.getValue(T02PartBinary.PART_1), CodePointCommandᶻᴰ.ADVANCE); + CodePointᶻᴰ.INSTANCE.setArgument(v2.getValue(T02PartBinary.PART_1), T02PartBinary.PART_1, advanceWidth); + CodePointᶻᴰ.INSTANCE.setArgument(v2.getValue(T02PartBinary.PART_1), T02PartBinary.PART_2, leftSideBearing); + + CodePointᶻᴰ.INSTANCE.setCommand(v2.getValue(T02PartBinary.PART_2), CodePointCommandᶻᴰ.NOP); + + glyph.add(v0); + glyph.add(v1); + glyph.add(v2); + + } else if ("contour".equals(qName)) { + startPoint = true; + + } else if ("point".equals(qName)) { + boolean onCurve = Boolean.parseBoolean(atts.getValue("onCurve")); + int x = (int) Float.parseFloat(atts.getValue("x")); + int y = (int) Float.parseFloat(atts.getValue("y")); + + T02PartBinary part = T02PartBinary.PART_1; + if (CodePointCommandᶻᴰ.NOP != CodePointᶻᴰ.INSTANCE.getCommand(point.getValue(T02PartBinary.PART_1))) { + part = T02PartBinary.PART_2; + } + if (onCurve) { + if (startPoint) { + CodePointᶻᴰ.INSTANCE.setCommand(point.getValue(part), CodePointCommandᶻᴰ.XY_ON_CURVE_START); + } else { + CodePointᶻᴰ.INSTANCE.setCommand(point.getValue(part), CodePointCommandᶻᴰ.XY_ON_CURVE); + } + } else { + if (startPoint) { + CodePointᶻᴰ.INSTANCE.setCommand(point.getValue(part), CodePointCommandᶻᴰ.XY_OFF_CURVE_START); + } else { + CodePointᶻᴰ.INSTANCE.setCommand(point.getValue(part), CodePointCommandᶻᴰ.XY_OFF_CURVE); + } + } + CodePointᶻᴰ.INSTANCE.setArgument(point.getValue(part), T02PartBinary.PART_1, x); + CodePointᶻᴰ.INSTANCE.setArgument(point.getValue(part), T02PartBinary.PART_2, y); + if (part == T02PartBinary.PART_2) { + glyph.add(point); + point = new V072Tong(); + CodePointᶻᴰ.INSTANCE.setCommand(point.getValue(T02PartBinary.PART_1), CodePointCommandᶻᴰ.NOP); + CodePointᶻᴰ.INSTANCE.setCommand(point.getValue(T02PartBinary.PART_2), CodePointCommandᶻᴰ.NOP); + } + if (startPoint) { + startPoint = false; + } + } + } + + @Override + public void startPrefixMapping(String arg0, String arg1) throws SAXException { + } + } +} diff --git a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/GDXAppMain.java b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/GDXAppMain.java index e21f98a0..c11ca811 100644 --- a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/GDXAppMain.java +++ b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/GDXAppMain.java @@ -43,6 +43,8 @@ import love.distributedrebirth.numberxd.base2t.Base2PartsFactory; import love.distributedrebirth.numberxd.base2t.Base2Terminator; import love.distributedrebirth.numberxd.base2t.part.warp.TOSWarpCore; import love.distributedrebirth.numberxd.glyph.BaseGlyphSet; +import love.distributedrebirth.unicode4d.base.UnicodePlane; +import love.distributedrebirth.unicode4d.base.UnicodePlaneDriver; import love.distributedrebirth.warpme.TOSWarpCoreDriver; import love.distributedrebirth.warpme.core.WaterBucket; import net.spookygames.gdx.nativefilechooser.NativeFileChooser; @@ -64,6 +66,7 @@ public enum GDXAppMain implements DefaultEnumInstanceᴶᴹˣ,Screen> screens; private DeskTopScreenMenu screenMenu; @@ -111,6 +114,9 @@ public enum GDXAppMain implements DefaultEnumInstanceᴶᴹˣ