fixed stb_truetype
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Tue, 14 Dec 2021 00:20:11 +0000 (18:20 -0600)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Tue, 14 Dec 2021 00:20:11 +0000 (18:20 -0600)
lib/stb_truetype.c
lib/stb_truetype.onyx
run_tree/assets/calibri.ttf [new file with mode: 0644]
run_tree/lib/stb_truetype.dll

index 0fb24f4ad799f8020793ea563b5268f50d39616b..37ddff898a2898c9d418609e10270a05cda11354 100644 (file)
@@ -19,7 +19,7 @@ static void *__onyx_heap_alloc_wrapper(int size, void* userdata) {
 
 static wasm_func_t* heap_free = NULL;
 static void __onyx_heap_free_wrapper(void *ptr, void* userdata) {
-    if (heap_alloc == NULL) {
+    if (heap_free == NULL) {
         wasm_extern_t *heap_free_extern = runtime->wasm_extern_lookup_by_name(runtime->wasm_module, runtime->wasm_instance, "stbtt_heap_free");
         heap_free = runtime->wasm_extern_as_func(heap_free_extern);
     }
@@ -30,7 +30,7 @@ static void __onyx_heap_free_wrapper(void *ptr, void* userdata) {
     wasm_val_vec_t results = {0,0};
     wasm_val_vec_t args_arr = WASM_ARRAY_VEC(args);
 
-    runtime->wasm_func_call(heap_alloc, &args_arr, &results);
+    runtime->wasm_func_call(heap_free, &args_arr, &results);
 }
 
 #define STBTT_malloc __onyx_heap_alloc_wrapper
index 3e5aa73d95a546ec50f05e3f4cfc99b06fbcc7bd..a40ffd9b23e58978d900130c1a07512820cbf156 100644 (file)
@@ -17,10 +17,5 @@ stbtt_packedchar :: struct #size 28 {
     stbtt_PackSetOversampling :: (ctx: ^stbtt_pack_context, h_oversample, v_oversample: i32) -> void ---
 }
 
-#export "stbtt_heap_alloc" (size: i32) -> rawptr {
-    return calloc(size);
-}
-
-#export "stbtt_heap_free" (ptr: rawptr) {
-    cfree(ptr);
-}
\ No newline at end of file
+#export "stbtt_heap_alloc" calloc
+#export "stbtt_heap_free"  cfree
\ No newline at end of file
diff --git a/run_tree/assets/calibri.ttf b/run_tree/assets/calibri.ttf
new file mode 100644 (file)
index 0000000..aac4726
Binary files /dev/null and b/run_tree/assets/calibri.ttf differ
index 04a6a9ecc18da8d36690afa6760adc10dfbef107..37e6b4578c372dcb80826b4b4ff642a70984ac60 100644 (file)
Binary files a/run_tree/lib/stb_truetype.dll and b/run_tree/lib/stb_truetype.dll differ