diff --git a/buildSrc/src/main/kotlin/tool/generator/api/jni_content.kt b/buildSrc/src/main/kotlin/tool/generator/api/jni_content.kt index 0a34fac9..975838cd 100644 --- a/buildSrc/src/main/kotlin/tool/generator/api/jni_content.kt +++ b/buildSrc/src/main/kotlin/tool/generator/api/jni_content.kt @@ -540,7 +540,7 @@ private fun createFieldGetContent(field: CtField<*>): List { getArray.setType(f.createTypeParam("$arrayType[]")) when (arrayType) { - "boolean", "short", "int", "float", "double", "long" -> { + "boolean", "byte", "short", "int", "float", "double", "long" -> { getArray.setBody( f.createCodeSnippet( """ @@ -569,7 +569,7 @@ private fun createFieldGetContent(field: CtField<*>): List { result += getArray.prettyprint(false) when (arrayType) { - "boolean", "short", "int", "float", "double", "long" -> { + "boolean", "byte", "short", "int", "float", "double", "long" -> { val getArrayIdx = getArray.clone() getArrayIdx.addParameter(f.createParameter().apply { setType(f.createTypeParam("int")) @@ -625,7 +625,7 @@ private fun createFieldSetContent(field: CtField<*>): List { setArray.setSimpleName("nSet${field.simpleName}") when (arrayType) { - "boolean", "short", "int", "float", "double", "long" -> { + "boolean", "byte", "short", "int", "float", "double", "long" -> { setArray.setBody( f.createCodeSnippet( """ @@ -649,7 +649,7 @@ private fun createFieldSetContent(field: CtField<*>): List { result += setArray.prettyprint(false) when (arrayType) { - "boolean", "short", "int", "float", "double", "long" -> { + "boolean", "byte", "short", "int", "float", "double", "long" -> { val setArrayIdx = setArray.clone() setArrayIdx.parameters.clear() setArrayIdx.addParameter(f.createParameter().apply { diff --git a/imgui-binding/src/generated/java/imgui/ImFontConfig.java b/imgui-binding/src/generated/java/imgui/ImFontConfig.java index e8a447c0..02f56511 100644 --- a/imgui-binding/src/generated/java/imgui/ImFontConfig.java +++ b/imgui-binding/src/generated/java/imgui/ImFontConfig.java @@ -27,7 +27,22 @@ protected long create() { return (intptr_t)cfg; */ - // TODO: FontData + /** + * TTF/OTF data + */ + public native byte[] getFontData(); /* + int size = THIS->FontDataSize; + jbyteArray jBuf = env->NewByteArray(size); + env->SetByteArrayRegion(jBuf, 0, size, (jbyte*)THIS->FontData); + return jBuf; + */ + + /** + * TTF/OTF data + */ + public native void setFontData(byte[] fontData); /* + THIS->FontData = &fontData[0]; + */ /** * TTF/OTF data size @@ -313,7 +328,28 @@ public void setGlyphOffset(final float valueX, final float valueY) { THIS->GlyphOffset = value; */ - // TODO: GlyphRanges + private short[] glyphRanges; + + /** + * Pointer to a user-provided list of Unicode range (2 value per range, values are inclusive, zero-terminated list). + * THE ARRAY DATA NEEDS TO PERSIST AS LONG AS THE FONT IS ALIVE. + */ + public short[] getGlyphRanges() { + return glyphRanges; + } + + /** + * Pointer to a user-provided list of Unicode range (2 value per range, values are inclusive, zero-terminated list). + * THE ARRAY DATA NEEDS TO PERSIST AS LONG AS THE FONT IS ALIVE. + */ + public void setGlyphRanges(final short[] glyphRanges) { + this.glyphRanges = glyphRanges; + nSetGlyphRanges(glyphRanges); + } + + private native void nSetGlyphRanges(short[] glyphRanges); /* + THIS->GlyphRanges = glyphRanges != NULL ? (ImWchar*)&glyphRanges[0] : NULL; + */ /** * Minimum AdvanceX for glyphs, set Min to align font icons, set both Min/Max to enforce mono-space font diff --git a/imgui-binding/src/main/java/imgui/ImFontConfig.java b/imgui-binding/src/main/java/imgui/ImFontConfig.java index 8ad51553..8231353c 100644 --- a/imgui-binding/src/main/java/imgui/ImFontConfig.java +++ b/imgui-binding/src/main/java/imgui/ImFontConfig.java @@ -30,7 +30,22 @@ protected long create() { return (intptr_t)cfg; */ - // TODO: FontData + /** + * TTF/OTF data + */ + public native byte[] getFontData(); /* + int size = THIS->FontDataSize; + jbyteArray jBuf = env->NewByteArray(size); + env->SetByteArrayRegion(jBuf, 0, size, (jbyte*)THIS->FontData); + return jBuf; + */ + + /** + * TTF/OTF data + */ + public native void setFontData(byte[] fontData); /* + THIS->FontData = &fontData[0]; + */ /** * TTF/OTF data size @@ -90,7 +105,28 @@ protected long create() { @BindingField public ImVec2 GlyphOffset; - // TODO: GlyphRanges + private short[] glyphRanges; + + /** + * Pointer to a user-provided list of Unicode range (2 value per range, values are inclusive, zero-terminated list). + * THE ARRAY DATA NEEDS TO PERSIST AS LONG AS THE FONT IS ALIVE. + */ + public short[] getGlyphRanges() { + return glyphRanges; + } + + /** + * Pointer to a user-provided list of Unicode range (2 value per range, values are inclusive, zero-terminated list). + * THE ARRAY DATA NEEDS TO PERSIST AS LONG AS THE FONT IS ALIVE. + */ + public void setGlyphRanges(final short[] glyphRanges) { + this.glyphRanges = glyphRanges; + nSetGlyphRanges(glyphRanges); + } + + private native void nSetGlyphRanges(short[] glyphRanges); /* + THIS->GlyphRanges = glyphRanges != NULL ? (ImWchar*)&glyphRanges[0] : NULL; + */ /** * Minimum AdvanceX for glyphs, set Min to align font icons, set both Min/Max to enforce mono-space font