diff --git a/gdxapp4d-app-glyphdemo/src/main/java/love/distributedrebirth/gdxapp4d/app/glyphdemo/apps/DemoUnicodePlaneDeskApp.java b/gdxapp4d-app-glyphdemo/src/main/java/love/distributedrebirth/gdxapp4d/app/glyphdemo/apps/DemoUnicodePlaneDeskApp.java index eef1a1c6..1392eb55 100644 --- a/gdxapp4d-app-glyphdemo/src/main/java/love/distributedrebirth/gdxapp4d/app/glyphdemo/apps/DemoUnicodePlaneDeskApp.java +++ b/gdxapp4d-app-glyphdemo/src/main/java/love/distributedrebirth/gdxapp4d/app/glyphdemo/apps/DemoUnicodePlaneDeskApp.java @@ -3,6 +3,7 @@ package love.distributedrebirth.gdxapp4d.app.glyphdemo.apps; import java.util.ResourceBundle; import imgui.ImGui; +import imgui.flag.ImGuiStyleVar; import imgui.flag.ImGuiTableFlags; import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; import love.distributedrebirth.gdxapp4d.vrgem4.service.VrGem4Unicode4DService; @@ -60,24 +61,28 @@ public class DemoUnicodePlaneDeskApp extends AbstractDeskApp implements DeskAppR // Dear ImGui Assertion Failed: draw_list->_VtxCurrentIdx < (1 << 16) && "Too many vertices in ImDrawList using 16-bit indices. Read comment above" // Assertion Located At: /tmp/imgui/jni/imgui.cpp:4526 - DrawCharacter drawChar2 = unicode4DService.getCharacterForUnicode('?'); + ImGui.pushStyleVar(ImGuiStyleVar.ItemSpacing, 0f, 0f); + + DrawCharacter drawChar2 = unicode4DService.getCharacterForUnicode(' '); if (drawChar2 != null) { - new ImCharacter(drawChar2).render(); + ImCharacter.render(drawChar2); ImGui.sameLine(); // print before beginChild to fix height of table row } int offset = 33; ImGui.beginChild("row"+plane.name()); - for (int i=plane.getStart()+offset;i"); for (let contourIndex = 0; contourIndex < contours.length; ++contourIndex) { diff --git a/gdxapp4d-chain-font-unicode4d/src/main/nodejs/conv-font.sh b/gdxapp4d-chain-font-unicode4d/src/main/nodejs/conv-font.sh index 8a09b466..b5e78192 100755 --- a/gdxapp4d-chain-font-unicode4d/src/main/nodejs/conv-font.sh +++ b/gdxapp4d-chain-font-unicode4d/src/main/nodejs/conv-font.sh @@ -6,5 +6,7 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) for FILE in `ls $1` do - node $SCRIPT_DIR/conv-font.js $1/$FILE > $2/$FILE.xml -done \ No newline at end of file + if [[ $FILE == *.ttf ]]; then + node $SCRIPT_DIR/conv-font.js $1/$FILE > $2/$FILE.xml + fi +done diff --git a/gdxapp4d-lib-unicodezd/src/main/java/love/distributedrebirth/unicode4d/draw/ImCharacter.java b/gdxapp4d-lib-unicodezd/src/main/java/love/distributedrebirth/unicode4d/draw/ImCharacter.java index e904f865..eac58e7f 100644 --- a/gdxapp4d-lib-unicodezd/src/main/java/love/distributedrebirth/unicode4d/draw/ImCharacter.java +++ b/gdxapp4d-lib-unicodezd/src/main/java/love/distributedrebirth/unicode4d/draw/ImCharacter.java @@ -10,14 +10,8 @@ import love.distributedrebirth.unicode4d.draw.DrawGlyphPath.ImGlyphQuadCurveTo; public class ImCharacter { - private final DrawCharacter drawChar; - - public ImCharacter(DrawCharacter drawChar) { - this.drawChar = drawChar; - } - - public void render() { - ImVec2 size = new ImVec2(35f, 50f); + public static void render(DrawCharacter drawChar) { + ImVec2 size = new ImVec2(22f, 26f); ImGui.invisibleButton("canvas", size.x, size.y); ImVec2 p0 = ImGui.getItemRectMin(); ImVec2 p1 = ImGui.getItemRectMax(); // p1 = p0 + size @@ -26,12 +20,12 @@ public class ImCharacter { // draw unicode4D float xOff = p0.x; - float yOff = p0.y + 35f; + float yOff = p0.y + 19f; float yFlip = -1f; - float scale = 0.0165f; + float scale = 0.0090f; ImGlyphPathCommand first = null; ImGlyphPathCommand prev = null; - int color = ImColor.intToColor(255, 127, 63, 255); + int color = ImColor.intToColor(255, 255, 255, 255); for (ImGlyphPathCommand cmd: drawChar.getGlyphPath().getPath()) { if (cmd.isImGlyphMoveTo()) { first = cmd; @@ -72,8 +66,8 @@ public class ImCharacter { color); } } - drawList.addQuad(p0.x, p0.y, p0.x+size.x, p0.y, p1.x, p1.y, p0.x, p0.y+size.y, - ImColor.intToColor(127, 127, 255, 255), 1f); + //drawList.addQuad(p0.x, p0.y, p0.x+size.x, p0.y, p1.x, p1.y, p0.x, p0.y+size.y, + // ImColor.intToColor(127, 127, 255, 255), 1f); drawList.popClipRect(); } } \ No newline at end of file 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 a3c644c1..b678924a 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 @@ -42,7 +42,7 @@ public class TestConvFont { try { // NOTE: Are in order like the FontAtlas of ImGui String in = "../gdxapp4d-chain-font-unicode4d/target/chain2/"; - String out = "../gdxapp4d-chain-font-unicode4d/target/chain/"; + String out = "../gdxapp4d-chain-font-unicode4d/src/main/chain/"; conf("code-2000", new File(in+"plane0/code-2000.ttf.xml"), new File(out+"plane0/code-2000.ttf4d")); conf("fa-solid-900", new File(in+"plane0/fa-solid-900.ttf.xml"), new File(out+"plane0/fa-solid-900.ttf4d")); @@ -182,7 +182,11 @@ public class TestConvFont { 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); + String unicodeStr = atts.getValue("unicode"); + if (unicodeStr.startsWith("0000, ")) { + unicodeStr = unicodeStr.substring(7); + } + unicode = Integer.parseInt(unicodeStr, 16); unicodePlane2 = UnicodePlaneᶻᴰ.valueOfUnicode(unicode); int xMax = Integer.parseInt(atts.getValue("xMax")); int yMax = Integer.parseInt(atts.getValue("yMax"));