SpaiR / imgui-java

JNI based binding for Dear ImGui
MIT License
606 stars 91 forks source link

ImFontGlyphRangesBuilder.addRanges should be char #108

Closed immetoo2 closed 2 years ago

immetoo2 commented 2 years ago

When adding chinese and tone letters it overflows the short type and should be char instead;

    public static final short[] glyphRangesToneLetters0 = new short[]{0x02E5, 0x02E9, 0};
    public static final char[] glyphRangesToneLetters1 = new char[]{0xA708, 0xA716};

When adding the range via addText as an workaround it works;

        rangesBuilder.addText("@Ω仙⁴ ˧꜏⋇꜊꜔ ⁴ﷲΩ@");
        rangesBuilder.addText("©Δ∞ 仙上主天");

imgui-java-unicode

It almost renders correct, see the text version; @Ω仙⁴ ˧꜏⋇꜊꜔ ⁴ﷲΩ@
©Δ∞ 仙上主天
בְּרֵאשִׁית :o: יְסוֺד :o: יִשְׂרָאֵל Welcome to the matrix. encoder1=EW₁T5D⁴ 91=˩˥˧˧˩˥

immetoo2 commented 2 years ago

As background i'm trying to render the matrix. (to have unlimited minecraft world space)

Absolute coordinate system   ˧˥˩ ________ ˧˥˦   |\       :\   | \      : \   |  \     :  \   |   ˧˥˥---------˧˦˦   |   :    :     :   ˧˩˥ ___ :____˧˩˨    :   \   :      \   :    \  :       \  :     \ :        \ :      \˧˩˩_________˧˨˨

Relative coordinate system

    ˩˩˧   ˥˦˧   ˦˦˧     \ | /      \|/     ˩˥˧-- O --˥˩˧      /|\     / | \     ˨˨˧   ˩˨˧    ˥˥˧ 

Exponential WordQᵤ₈ₑ Tone⋇Kali Darthᵛᴬᴰᴰᴱᴿ

EW₁T5D⁴ = Startrek HEX ˧˥˩˧˩˥˧˥˦˧˩˨˧˦˦˧˨˨˧˥˥˧˩˩˥˩˧˩˥˧˥˦˧˩˨˧˦˦˧˨˨˧˥˥˧˩˩˧

EW₂T5D⁴ = Dīpāvalī Routing ˧˥˩⁰˧˩˥¹˧˥˦²˧˩˨³˧˦˦⁴˧˨˨⁵˧˥˥⁶˧˩˩⁷˥˩˧⁸˩˥˧⁹˥˦˧ᵃ˩˨˧ᵇ˦˦˧ᶜ˨˨˧ᵈ˥˥˧ᵉ˩˩˧ᶠ

EW₃T5D⁴ = 3Dᵛᴼˣᴱˡ Numbers ˧˥˩⁰˧˩˥¹˧˥˦²˧˩˨³˧˦˦⁴˧˨˨⁵˧˥˥⁶˧˩˩⁷˥˩˧⁸˩˥˧⁹˥˦˧ᵃ˩˨˧ᵇ˦˦˧ᶜ˨˨˧ᵈ˥˥˧ᵉ˩˩˧ᶠ = red ˧˥˩₀˧˩˥₁˧˥˦₂˧˩˨₃˧˦˦₄˧˨˨₅˧˥˥₆˧˩˩₇˥˩˧₈˩˥˧₉˥˦˧ₐ˩˨˧₆˦˦˧꜀˨˨˧ₔ˥˥˧ₑ˩˩˧բ = blue OR ⁰˧˥˩₀¹˧˩˥₁²˧˥˦₂³˧˩˨₃⁴˧˦˦₄⁵˧˨˨₅⁶˧˥˥₆⁷˧˩˩₇⁸˥˩˧₈⁹˩˥˧₉ᵃ˥˦˧ₐᵇ˩˨˧₆ᶜ˦˦˧꜀ᵈ˨˨˧ₔᵉ˥˥˧ₑᶠ˩˩˧բ

That is the basis for relative or unlimited voxel math in 3D space.

immetoo2 commented 2 years ago

This is duplicate #70 Have replace all my ranges code,with a call to the following workaround code;

    private static void addRangeUnicodePlane0(ImFontGlyphRangesBuilder fontBuilder) {
        for (int c=0x0100;c<=0xFFEF;c++) {
            StringBuilder buf = new StringBuilder();
            buf.append(""+(char)c);
            fontBuilder.addText(buf.toString());
        }
    }
SpaiR commented 2 years ago

duplicated #70