gdxapp4d/gdxapp4d-lib-unicodezd/src/main/java/love/distributedrebirth/unicode4d/CodePointᶻᴰ.java

141 lines
7 KiB
Java
Raw Normal View History

2022-11-15 09:51:54 +00:00
/*
* Copyright ©Δ 仙上主天
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
* even on air gaped systems, all information in the universe is owned by the pi creator.
*
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
2022-02-07 00:18:02 +00:00
package love.distributedrebirth.unicode4d;
2022-02-20 23:41:24 +00:00
import java.util.List;
2022-11-07 20:28:39 +00:00
import ᒢᐩᐩ.ᒡᒢᑊᒻᒻᓫᔿ.ᣳᣝᐤᣜᣳ.ᐪᓫᣗᔿᑊᣕᣔᐪᐤᣗ.T002ᖟ;
2022-11-28 00:12:22 +00:00
import ᒢᐩᐩ.ᒡᒢᑊᒻᒻᓫᔿ.ᣳᣝᐤᣜᣳ.ᒢᓫᑊᐣᑊ.ᔿᓫᒻᓫᓫ.V036Teger;
import ᒢᐩᐩ.ᒡᒢᑊᒻᒻᓫᔿ.ᣳᣝᐤᣜᣳ.ᒢᓫᑊᐣᑊ.ᔿᓫᒻᓫᓫ.V072Tong;
2022-11-05 12:41:48 +00:00
import ᒢᐩᐩ.ᔆʸᔆᐪᓫᔿ.ᒃᣔᒃᓫᒻ.ᑊᐣᓑᖮᐪᔆ.DuytsDocAuthor注;
2022-02-13 18:42:47 +00:00
2022-10-30 15:59:24 +00:00
@DuytsDocAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天")
public enum CodePointᶻᴰ {
INSTANCE;
private static final int MASK_CMD = 0b111000000000000000;
2022-03-18 01:10:02 +00:00
private static final int MASK_SIGN = 0b000100000000000000;
private static final int MASK_ARGU = 0b000011111111111111;
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;
2022-11-07 19:50:55 +00:00
public int getArgument(V036Teger teger, T002ᖟ part) {
2024-04-22 18:32:30 +00:00
int value = teger.legoᐧtuneᐧ(part).smurfᐧnativeᐧint();
2022-03-18 01:10:02 +00:00
int result = value & MASK_ARGU;
if ((value & MASK_SIGN) != 0) {
result |= 0xFFFFC000;
}
return result;
}
2022-11-07 19:50:55 +00:00
public void setArgument(V036Teger teger, T002ᖟ part, int number) {
2024-04-22 18:32:30 +00:00
int value = teger.legoᐧtuneᐧ(part).smurfᐧnativeᐧint();
2022-03-18 01:10:02 +00:00
int result = (value & MASK_CMD) + ((number >> 17) & MASK_SIGN) + (number & MASK_ARGU);
2024-04-22 18:32:30 +00:00
teger.legoᐧtuneᐧ(part).smurfᐧnativeᐧint(result);
}
2022-02-13 18:42:47 +00:00
public int getArgumentUnicode(V036Teger teger) {
int unicode = 0;
2024-04-22 18:32:30 +00:00
unicode += teger.legoᐧtuneᐧ(T002ᖟ.PART_1).smurfᐧnativeᐧint() & MASK_ARGU+MASK_SIGN;
unicode += (teger.legoᐧtuneᐧ(T002ᖟ.PART_2).smurfᐧnativeᐧint() & MASK_ARGU+MASK_SIGN) << 15;
return unicode;
2022-02-13 18:42:47 +00:00
}
public void setArgumentUnicode(V036Teger teger, int unicode) {
2024-04-22 18:32:30 +00:00
int value1 = teger.legoᐧtuneᐧ(T002ᖟ.PART_1).smurfᐧnativeᐧint();
int value2 = teger.legoᐧtuneᐧ(T002ᖟ.PART_2).smurfᐧnativeᐧint();
2022-03-18 01:10:02 +00:00
value1 = (value1 & MASK_CMD) + (unicode & MASK_ARGU+MASK_SIGN);
value2 = (value2 & MASK_CMD) + ((unicode >> 15) & MASK_ARGU+MASK_SIGN);
2024-04-22 18:32:30 +00:00
teger.legoᐧtuneᐧ(T002ᖟ.PART_1).smurfᐧnativeᐧint(value1);
teger.legoᐧtuneᐧ(T002ᖟ.PART_2).smurfᐧnativeᐧint(value2);
}
public CodePointCommandᶻᴰ getCommand(V036Teger teger) {
int mode = 0;
2024-04-22 18:32:30 +00:00
mode += (teger.legoᐧtuneᐧ(T002ᖟ.PART_1).smurfᐧnativeᐧint() >> 15) << 0;
mode += (teger.legoᐧtuneᐧ(T002ᖟ.PART_2).smurfᐧnativeᐧint() >> 15) << 3;
return CodePointCommandᶻᴰ.values()[mode];
}
public void setCommand(V036Teger teger, CodePointCommandᶻᴰ command) {
int mode = command.ordinal();
2024-04-22 18:32:30 +00:00
int value1 = teger.legoᐧtuneᐧ(T002ᖟ.PART_1).smurfᐧnativeᐧint();
int value2 = teger.legoᐧtuneᐧ(T002ᖟ.PART_2).smurfᐧnativeᐧint();
teger.legoᐧtuneᐧ(T002ᖟ.PART_1).smurfᐧnativeᐧint(value1 | (((mode >> 0) << 15)) & MASK_CMD);
teger.legoᐧtuneᐧ(T002ᖟ.PART_2).smurfᐧnativeᐧint(value2 | (((mode >> 3) << 15)) & MASK_CMD);
}
2022-02-20 23:41:24 +00:00
2022-08-23 14:00:34 +00:00
/**
* Provides legacy access to the unicode number definition.
*/
2022-02-20 23:41:24 +00:00
public int searchUnicode(List<V072Tong> tongs) {
for (V072Tong tong:tongs) {
2024-04-22 18:32:30 +00:00
if (CodePointCommandᶻᴰ.UNICODE.equals(CodePointᶻᴰ.INSTANCE.getCommand(tong.legoᐧtuneᐧ(T002ᖟ.PART_1)))) {
return CodePointᶻᴰ.INSTANCE.getArgumentUnicode(tong.legoᐧtuneᐧ(T002ᖟ.PART_1));
2022-02-20 23:41:24 +00:00
}
2024-04-22 18:32:30 +00:00
if (CodePointCommandᶻᴰ.UNICODE.equals(CodePointᶻᴰ.INSTANCE.getCommand(tong.legoᐧtuneᐧ(T002ᖟ.PART_2)))) {
return CodePointᶻᴰ.INSTANCE.getArgumentUnicode(tong.legoᐧtuneᐧ(T002ᖟ.PART_2));
2022-02-20 23:41:24 +00:00
}
}
return -1;
}
2022-08-23 14:00:34 +00:00
/**
* Provides number access so that 0123456789 is equal in all languages/fonts.
* TODO: Add support for the other number ranges to like: base10,base16,base27,etc.
*/
2022-02-20 23:41:24 +00:00
public int searchNumber(List<V072Tong> tongs) {
for (V072Tong tong:tongs) {
2024-04-22 18:32:30 +00:00
if (CodePointCommandᶻᴰ.NUMBER.equals(CodePointᶻᴰ.INSTANCE.getCommand(tong.legoᐧtuneᐧ(T002ᖟ.PART_1)))) {
return CodePointᶻᴰ.INSTANCE.getArgumentUnicode(tong.legoᐧtuneᐧ(T002ᖟ.PART_1));
2022-02-20 23:41:24 +00:00
}
2024-04-22 18:32:30 +00:00
if (CodePointCommandᶻᴰ.NUMBER.equals(CodePointᶻᴰ.INSTANCE.getCommand(tong.legoᐧtuneᐧ(T002ᖟ.PART_2)))) {
return CodePointᶻᴰ.INSTANCE.getArgumentUnicode(tong.legoᐧtuneᐧ(T002ᖟ.PART_2));
2022-02-20 23:41:24 +00:00
}
}
return -1;
}
2022-08-23 14:00:34 +00:00
/**
* Provides access to vocal tone expression, so "A" and "a" and many other "a"'s have an equal tone expression.
* TODO: And add support for invisible voice glue letters/commands so text-to-speech is correct.
*/
public int searchVocalTone(List<V072Tong> tongs) {
return -1;
}
2022-02-07 00:18:02 +00:00
}