From 38d9a514c84610cb64702fe79931c1b825be27c7 Mon Sep 17 00:00:00 2001 From: Willem Date: Mon, 14 Mar 2022 02:48:35 +0100 Subject: [PATCH] Fixed sign flip on shift bug --- .../numberxd/base2t/Base2Terminator.java | 18 ++++---- .../numberxd/base2t/Base2TerminatorTest.java | 9 ++-- .../unicode4d/atlas/FontAtlasStoreGlyph.java | 42 ------------------- .../unicode4d/TestConvFont.java | 9 ---- .../vrgem4/VrGem4Unicode4DServiceImpl.java | 8 ++-- .../service/VrGem4Unicode4DService.java | 2 +- 6 files changed, 18 insertions(+), 70 deletions(-) diff --git a/gdxapp4d-lib-numberxd/src/main/java/love/distributedrebirth/numberxd/base2t/Base2Terminator.java b/gdxapp4d-lib-numberxd/src/main/java/love/distributedrebirth/numberxd/base2t/Base2Terminator.java index 9954e84c..86299357 100644 --- a/gdxapp4d-lib-numberxd/src/main/java/love/distributedrebirth/numberxd/base2t/Base2Terminator.java +++ b/gdxapp4d-lib-numberxd/src/main/java/love/distributedrebirth/numberxd/base2t/Base2Terminator.java @@ -69,9 +69,9 @@ public enum Base2Terminator implements DefaultEnumInstanceᴶᴹˣ octals = Bãß2ReadOctals(v0, v1, v2); output.add(new V072Tong(new BaseIteratorOctalAdapter(octals.iterator()))); totalBytes += BLOCK_TONG_SIZE; @@ -88,12 +88,12 @@ public enum Base2Terminator implements DefaultEnumInstanceᴶᴹˣ octals = Bãß2ReadOctals(v0, v1, v2, v3, v4, v5); output.add(new V144Tocta(new BaseIteratorOctalAdapter(octals.iterator()))); totalBytes += BLOCK_TOCTA_SIZE; diff --git a/gdxapp4d-lib-numberxd/src/test/java/love/distributedrebirth/numberxd/base2t/Base2TerminatorTest.java b/gdxapp4d-lib-numberxd/src/test/java/love/distributedrebirth/numberxd/base2t/Base2TerminatorTest.java index 30990e1b..1da72096 100644 --- a/gdxapp4d-lib-numberxd/src/test/java/love/distributedrebirth/numberxd/base2t/Base2TerminatorTest.java +++ b/gdxapp4d-lib-numberxd/src/test/java/love/distributedrebirth/numberxd/base2t/Base2TerminatorTest.java @@ -19,8 +19,8 @@ public class Base2TerminatorTest { @Test public void testBytes() throws IOException { V072Tong tong = new V072Tong(); - tong.getValue(T02PartBinary.PART_1).setValueNumber(123456000); - tong.getValue(T02PartBinary.PART_2).setValueNumber(234567000); + tong.getValue(T02PartBinary.PART_1).setValueNumber(32768); + tong.getValue(T02PartBinary.PART_2).setValueNumber(689024); List tongs = new ArrayList<>(); tongs.add(tong); @@ -36,8 +36,7 @@ public class Base2TerminatorTest { V072Tong tong2 = result.get(0); Assertions.assertNotNull(tong2); - Assertions.assertEquals(123456000L, tong.getValue(T02PartBinary.PART_1).getValueNumber()); - Assertions.assertEquals(234567000L, tong.getValue(T02PartBinary.PART_2).getValueNumber()); + Assertions.assertEquals(32768, tong2.getValue(T02PartBinary.PART_1).getValueNumber()); + Assertions.assertEquals(689024, tong2.getValue(T02PartBinary.PART_2).getValueNumber()); } - } diff --git a/gdxapp4d-lib-unicodezd/src/main/java/love/distributedrebirth/unicode4d/atlas/FontAtlasStoreGlyph.java b/gdxapp4d-lib-unicodezd/src/main/java/love/distributedrebirth/unicode4d/atlas/FontAtlasStoreGlyph.java index c0871092..9f415688 100644 --- a/gdxapp4d-lib-unicodezd/src/main/java/love/distributedrebirth/unicode4d/atlas/FontAtlasStoreGlyph.java +++ b/gdxapp4d-lib-unicodezd/src/main/java/love/distributedrebirth/unicode4d/atlas/FontAtlasStoreGlyph.java @@ -9,9 +9,6 @@ import java.util.List; import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; import love.distributedrebirth.numberxd.base2t.Base2Terminator; -import love.distributedrebirth.numberxd.base2t.BaseAppenderOctal; -import love.distributedrebirth.numberxd.base2t.BaseIteratorOctalAdapter; -import love.distributedrebirth.numberxd.base2t.part.T08PartOctal; import love.distributedrebirth.numberxd.base2t.type.V072Tong; @BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") @@ -33,45 +30,6 @@ public class FontAtlasStoreGlyph { public void addTong(V072Tong glyph) { this.tongs.add(glyph); } - - public List theOct64() { - List result = new ArrayList<>(); - BaseAppenderOctal appender = new BaseAppenderOctal(result); - for (V072Tong tong: tongs) { - tong.fillOctalsByClone(appender); - } - return result; - } - - public void doOct64(List data) { - BaseIteratorOctalAdapter adapter = new BaseIteratorOctalAdapter(data.iterator()); - List result = new ArrayList<>(); - while (adapter.hasNext()) { - result.add(new V072Tong(adapter)); - } - tongs = result; - } - - public byte[] theByte64() { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - try { - Base2Terminator.INSTANCE.Bãß2WriteTong(tongs, baos); - } catch (IOException e) { - throw new RuntimeException(e); - } - return baos.toByteArray(); - } - - public void doByte64(byte[] decodedBytes) { - ByteArrayInputStream bais = new ByteArrayInputStream(decodedBytes); - try { - List result = new ArrayList<>(); - Base2Terminator.INSTANCE.Bãß2ReadTong(bais, result); - tongs = result; - } catch (IOException e) { - throw new RuntimeException(e); - } - } public String getBase64() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); diff --git a/gdxapp4d-lib-unicodezd/src/test/java/love/distributedrebirth/unicode4d/TestConvFont.java b/gdxapp4d-lib-unicodezd/src/test/java/love/distributedrebirth/unicode4d/TestConvFont.java index 09a380a8..02ccc062 100644 --- a/gdxapp4d-lib-unicodezd/src/test/java/love/distributedrebirth/unicode4d/TestConvFont.java +++ b/gdxapp4d-lib-unicodezd/src/test/java/love/distributedrebirth/unicode4d/TestConvFont.java @@ -142,15 +142,6 @@ public class TestConvFont { baseGlyph.setTongs(tongs); fontStore.addGlyph(baseGlyph); - int unicode = CodePointᶻᴰ.INSTANCE.searchUnicode(baseGlyph.getTongs()); - System.out.println("Converted: "+Integer.toHexString(unicode)); - - FontAtlasStoreGlyph baseGlyph2 = new FontAtlasStoreGlyph(); - baseGlyph2.doByte64(baseGlyph.theByte64()); - - int unicode2 = CodePointᶻᴰ.INSTANCE.searchUnicode(baseGlyph2.getTongs()); - System.out.println("Converted2: "+Integer.toHexString(unicode2)); - } else if ("contour".equals(qName)) { } diff --git a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/VrGem4Unicode4DServiceImpl.java b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/VrGem4Unicode4DServiceImpl.java index 2548e3ef..7bad3698 100644 --- a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/VrGem4Unicode4DServiceImpl.java +++ b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/VrGem4Unicode4DServiceImpl.java @@ -24,7 +24,7 @@ import love.distributedrebirth.unicode4d.atlas.FontAtlasStoreGlyph; public class VrGem4Unicode4DServiceImpl implements VrGem4Unicode4DService { private final FontAtlas masterFontAtlas; - private final Map unicodeMap; + private final Map unicodeMap; @Reference private SystemGdxLog log; @@ -54,11 +54,11 @@ public class VrGem4Unicode4DServiceImpl implements VrGem4Unicode4DService { log.info(this, "Master font atlas size: {}", masterFontAtlas.getStores().size()); for (FontAtlasStore fontStore:masterFontAtlas.getStores()) { - log.info(this,"Map unicode: {}", fontStore.getName()); + log.info(this,"Map unicode: {} size: {}", fontStore.getName(), fontStore.getGlyphs().size()); for (FontAtlasStoreGlyph glyph: fontStore.getGlyphs()) { int unicode = CodePointᶻᴰ.INSTANCE.searchUnicode(glyph.getTongs()); if (unicode > 0) { - unicodeMap.put(Character.valueOf((char) unicode), glyph); + unicodeMap.put(unicode, glyph); } } } @@ -76,7 +76,7 @@ public class VrGem4Unicode4DServiceImpl implements VrGem4Unicode4DService { } @Override - public FontAtlasStoreGlyph getGlyphForUnicode(char unicode) { + public FontAtlasStoreGlyph getGlyphForUnicode(int unicode) { return unicodeMap.get(unicode); } } diff --git a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/service/VrGem4Unicode4DService.java b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/service/VrGem4Unicode4DService.java index 3eb01680..952c1328 100644 --- a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/service/VrGem4Unicode4DService.java +++ b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/service/VrGem4Unicode4DService.java @@ -7,5 +7,5 @@ public interface VrGem4Unicode4DService { FontAtlas getMasterFontAtlas(); - FontAtlasStoreGlyph getGlyphForUnicode(char unicode); + FontAtlasStoreGlyph getGlyphForUnicode(int unicode); }