fix: fix load font from ByteBuffer
@@ -31,7 +31,6 @@ import java.util.*;
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.stb.STBTruetype.*;
import static org.lwjgl.system.MemoryStack.stackPush;
-import static org.lwjgl.system.MemoryUtil.memUTF8;
public final class TTFontHelper implements FontHelper {
@@ -304,10 +303,8 @@ public final class TTFontHelper implements FontHelper {
throw new IllegalStateException("Failed in initializing ttf font info");
}
- String family = memUTF8(stbtt_GetFontNameString(fontInfo, STBTT_PLATFORM_ID_MICROSOFT, STBTT_MS_EID_UNICODE_BMP, STBTT_MS_LANG_ENGLISH, 1)
- .order(ByteOrder.BIG_ENDIAN));
- String style = memUTF8(stbtt_GetFontNameString(fontInfo, STBTT_PLATFORM_ID_MICROSOFT, STBTT_MS_EID_UNICODE_BMP, STBTT_MS_LANG_ENGLISH, 2)
- .order(ByteOrder.BIG_ENDIAN));
+ String family = stbtt_GetFontNameString(fontInfo, STBTT_PLATFORM_ID_MICROSOFT, STBTT_MS_EID_UNICODE_BMP, STBTT_MS_LANG_ENGLISH, 1).asCharBuffer().toString();
+ String style = stbtt_GetFontNameString(fontInfo, STBTT_PLATFORM_ID_MICROSOFT, STBTT_MS_EID_UNICODE_BMP, STBTT_MS_LANG_ENGLISH, 2).asCharBuffer().toString();
try (MemoryStack stack = stackPush()) {
IntBuffer pAscent = stack.mallocInt(1);
