feat: add IMGUI_USE_WCHAR32 support, cross-compile natives, publish to mvn.mrlokop.dev
CI / Build Java (push) Has been cancelled
CI / Build Native (macos-latest - macos) (push) Has been cancelled
CI / Build Native (ubuntu-latest - linux) (push) Has been cancelled
CI / Build Native (ubuntu-latest - windows) (push) Has been cancelled
CI / Archive Natives (push) Has been cancelled
CI / Update Binaries (push) Has been cancelled
CI / Release (push) Has been cancelled
CI / Build Java (push) Has been cancelled
CI / Build Native (macos-latest - macos) (push) Has been cancelled
CI / Build Native (ubuntu-latest - linux) (push) Has been cancelled
CI / Build Native (ubuntu-latest - windows) (push) Has been cancelled
CI / Archive Natives (push) Has been cancelled
CI / Update Binaries (push) Has been cancelled
CI / Release (push) Has been cancelled
- Enable IMGUI_USE_WCHAR32 in imconfig.h (ImWchar = uint32_t) - Extend ImFontGlyphRangesBuilder, ImFontConfig, ImFontAtlas for 32-bit codepoints - Cross-compile natives for macOS universal, Linux x86_64 (glibc), Windows x86_64 - Publish as org.nnstd.imgui:...:1.90.0-wchar32+mrlokop2 to mvn.mrlokop.dev - Add BUILDING.md with full rebuild and publish instructions Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
2fcd517b3e
commit
34c40304f6
17 files changed
+439
-55
No files matched your search
@@ -347,6 +347,33 @@ public final class ImFontConfig extends ImGuiStructDestroyable {
|
||||
nSetGlyphRanges(glyphRanges);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience overload: encodes int[] codepoint pairs into WCHAR32 short[] layout and calls setGlyphRanges.
|
||||
* Expects int[] pairs [ lo, hi, lo, hi, ..., 0 ] (zero-terminated).
|
||||
* THE ARRAY DATA NEEDS TO PERSIST AS LONG AS THE FONT IS ALIVE.
|
||||
*/
|
||||
public void setGlyphRanges(final int[] codepoints) {
|
||||
// count pairs
|
||||
int pairCount = 0;
|
||||
for (int i = 0; i + 1 < codepoints.length; i += 2) {
|
||||
if (codepoints[i] == 0) break;
|
||||
pairCount++;
|
||||
}
|
||||
// each pair = 4 shorts (2 per endpoint), plus 2 terminator shorts
|
||||
final short[] encoded = new short[pairCount * 4 + 2];
|
||||
int out = 0;
|
||||
for (int i = 0; i < pairCount; i++) {
|
||||
final int lo = codepoints[i * 2];
|
||||
final int hi = codepoints[i * 2 + 1];
|
||||
encoded[out++] = (short) (lo & 0xFFFF);
|
||||
encoded[out++] = (short) ((lo >> 16) & 0xFFFF);
|
||||
encoded[out++] = (short) (hi & 0xFFFF);
|
||||
encoded[out++] = (short) ((hi >> 16) & 0xFFFF);
|
||||
}
|
||||
// terminator already zero from array initialisation
|
||||
setGlyphRanges(encoded);
|
||||
}
|
||||
|
||||
private native void nSetGlyphRanges(short[] glyphRanges); /*
|
||||
THIS->GlyphRanges = glyphRanges != NULL ? (ImWchar*)&glyphRanges[0] : NULL;
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user