Commit Graph

12608 Commits

Author SHA1 Message Date
Behdad Esfahbod 65966e0c3d [wasm-api] Add font_copy_glyph_outline 2023-03-31 17:33:45 -06:00
Simon Cozens 92a57b4b4a [wasm-rust] update font_copy_table API 2023-03-31 17:33:45 -06:00
Simon Cozens db789eacb4 [wasm-rust] Docs and API update 2023-03-31 17:33:45 -06:00
Behdad Esfahbod 0d237d062e [wasm-shape] No need to set default runnint mode
It's detected automatically apparently.
2023-03-31 17:33:45 -06:00
Behdad Esfahbod 2004528cf8 [wasm-api] Change face_copy_table to return success 2023-03-31 17:33:45 -06:00
Simon Cozens 83b9c34f0b [wasm] Add rust example 2023-03-31 17:33:45 -06:00
Behdad Esfahbod 28a7c1f932 [wasm-api] Rename face_reference_table to face_copy_table 2023-03-31 17:33:45 -06:00
Behdad Esfahbod b5b577f29f [wasm-api] Make buffer_copy_contents return success 2023-03-31 17:33:45 -06:00
Behdad Esfahbod 1023a80d39 [wasm] Fix up samples 2023-03-31 17:33:45 -06:00
Behdad Esfahbod 4ad659a608 [wasm] Move wasm-graphite 2023-03-31 17:33:45 -06:00
Simon Cozens 514a8d58d8 [wasm-api] Add ergonomic Rust interface 2023-03-31 17:33:45 -06:00
Simon Cozens 74deaa9e78 [wasm-api] Restructure samples/libraries 2023-03-31 17:33:45 -06:00
Behdad Esfahbod 4bdfaeecef [wasm-shape] Set glyph flags 2023-03-31 17:33:45 -06:00
Behdad Esfahbod 77f0f3c11a [wasm-api] Make buffer_copy_contents return zero length on mem fail 2023-03-31 17:33:45 -06:00
Behdad Esfahbod 16ecb96922 [wasm-api] Return success from buffer_contents_realloc 2023-03-31 17:33:45 -06:00
Behdad Esfahbod 2568890d15 [wasm-shape] Retry shaping if out-of-memory 2023-03-31 17:33:45 -06:00
Behdad Esfahbod cb382e489d [wasm-shape] Cache wasm-shape-plan 2023-03-31 17:33:44 -06:00
Behdad Esfahbod 73de7d4d05 [wasm-api] Add shape_plan 2023-03-31 17:33:44 -06:00
Behdad Esfahbod a267249930 [wasm] Typo 2023-03-31 17:33:44 -06:00
Behdad Esfahbod 99d2dab30f [wasm] Try at autotools build 2023-03-31 17:33:44 -06:00
Behdad Esfahbod c5af08c0dc [wasm] Add to harfbuzz.cc and hb-features 2023-03-31 17:33:44 -06:00
Behdad Esfahbod aa8f9eed63 [wasm-shape] Use JIT running-modes if available
Build wasm-micro-runtime with:

$ cmake . -DWAMR_BUILD_REF_TYPES=1 -DWAMR_BUILD_FAST_JIT=1

or:

$ cmake . -DWAMR_BUILD_REF_TYPES=1 -DWAMR_BUILD_JIT=1

The latter needs llvm and is harder to get working. Still trying.
2023-03-31 17:33:44 -06:00
Behdad Esfahbod 8d960dfe68 [wasm-sample] Remove Wasm table from test.ttf again
Was added by mistake.
2023-03-31 17:33:44 -06:00
Behdad Esfahbod 1c6d640e1f [wasm-shaper] Whitespace 2023-03-31 17:33:44 -06:00
Behdad Esfahbod 9f8ad3928a [wasm-api] Bind shaper features 2023-03-31 17:33:44 -06:00
Behdad Esfahbod 2327fe9d8a [hb-wasm] Remove TODO 2023-03-31 17:33:44 -06:00
Behdad Esfahbod b130b2b331 [graphite] Simplify direction handling 2023-03-31 17:33:44 -06:00
Behdad Esfahbod ec3270c7bb [wasm-graphite] Ensure native direction here too
Binds buffer_get_script and script_get_horizontal_direction.
2023-03-31 17:33:44 -06:00
Behdad Esfahbod cbc71c56bc [graphite] Ensure native direction
Mirrored characters come out wrong. Oh well. Better than before though.
2023-03-31 17:33:44 -06:00
Behdad Esfahbod 39f8703df1 [wasm-api] Match interface and implementation signatures 2023-03-31 17:33:44 -06:00
Behdad Esfahbod fea3ffe031 [wasm-api] Beautify internal API 2023-03-31 17:33:44 -06:00
Behdad Esfahbod fe557e2f21 [wasm-api] Bind font_get_glyph_extents
Untested.
2023-03-31 17:33:44 -06:00
Behdad Esfahbod b3b6e8da86 [wasm-api] Bind buffer_reverse 2023-03-31 17:33:44 -06:00
Behdad Esfahbod 863ec70e12 [wasm-shape] Add TODO items 2023-03-31 17:33:44 -06:00
Behdad Esfahbod 1acff90b03 [wasm-api] Bind font_glyph_to_string 2023-03-31 17:33:44 -06:00
Behdad Esfahbod 7537d48f08 [wasm] Remove a few lingering hb_ 2023-03-31 17:33:44 -06:00
Behdad Esfahbod d7f76f30b0 [wasm-graphite] Memory cleanup 2023-03-31 17:33:44 -06:00
Behdad Esfahbod 5738851b1c [wasm-api] Disallow "wasm" shaper in shape_with 2023-03-31 17:33:44 -06:00
Behdad Esfahbod 2bde2f66f1 [wasm-api] Bind shape_with 2023-03-31 17:33:44 -06:00
Behdad Esfahbod a08dbf41cd [wasm-api] Bind buffer_reverse_clusters 2023-03-31 17:33:44 -06:00
Behdad Esfahbod 0a51ed31b0 [wasm-api] Bind buffer_get_direction 2023-03-31 17:33:44 -06:00
Behdad Esfahbod a5c844a1de [wasm] Rename macro 2023-03-31 17:33:44 -06:00
Behdad Esfahbod 23b58b5667 [wasm-api] Bind font_get_scale 2023-03-31 17:33:44 -06:00
Behdad Esfahbod 149199ee26 [wasm-api] Bind face_get_upem 2023-03-31 17:33:44 -06:00
Behdad Esfahbod 2d295183b8 [wasm-api] Add buffer_contents_realloc 2023-03-31 17:33:44 -06:00
Behdad Esfahbod 07ece17495 [wasm-graphite] Initial code 2023-03-31 17:33:44 -06:00
Behdad Esfahbod ae981eec8e [graphite] Remove script handling
https://github.com/harfbuzz/harfbuzz/issues/3439#issuecomment-1442650148
2023-03-31 17:33:44 -06:00
Behdad Esfahbod 5ab7f7a7d4 [wasm-sample] Make addTable take args 2023-03-31 17:33:44 -06:00
Behdad Esfahbod 551528a6e6 [wasm-sample] Remove unused prototype 2023-03-31 17:33:44 -06:00
Behdad Esfahbod 926f8a326e [wasm-sample] Actually shape text! 2023-03-31 17:33:44 -06:00
Behdad Esfahbod c1dc112121 [wasm-api] Bind buffer_set_contents 2023-03-31 17:33:44 -06:00
Simon Cozens e0fec1dda0 [wasm-api] Wrap some of hb-font 2023-03-31 17:33:44 -06:00
Behdad Esfahbod af1f41a43e [wasm-api] Clear structs in _free() 2023-03-31 17:33:44 -06:00
Behdad Esfahbod 099a0150e1 [wasm] Add HB_STRUCT_TYPE 2023-03-31 17:33:44 -06:00
Behdad Esfahbod 851ef1380a [wasm-api] Add buffer-contents-free 2023-03-31 17:33:44 -06:00
Behdad Esfahbod d38f02ab30 [wasm-api] Make ref types actual pointers on the wasm side 2023-03-31 17:33:44 -06:00
Behdad Esfahbod cbd5c554fb [wasm-api] Add blob_free 2023-03-31 17:33:44 -06:00
Behdad Esfahbod 3bec8dca1c [wasm-sample] Free blob data for now 2023-03-31 17:33:44 -06:00
Behdad Esfahbod d45a13f101 [wasm] Add wasm-sample/ 2023-03-31 17:33:44 -06:00
Behdad Esfahbod 5cecfe8659 [wasm-api] Bind buffer_copy_contents 2023-03-31 17:33:44 -06:00
Behdad Esfahbod 50b22368d0 Revert "Fix function signature"
This reverts commit d70ebf98b0c696f3c66a20b1243cb347e3e3abc8.

Nope. A struct return is not returned that way.
2023-03-31 17:33:44 -06:00
Simon Cozens 743cd2c46e Fix function signature 2023-03-31 17:33:44 -06:00
Behdad Esfahbod 3b88bd9742 [wasm-api] Make ptr_t a pointer on the wasm side 2023-03-31 17:33:44 -06:00
Behdad Esfahbod d7a6671676 [wasm-api] Add debugprint1/2/3/4 2023-03-31 17:33:44 -06:00
Behdad Esfahbod 108995bbc6 [wasm-api] Finish face_reference_table 2023-03-31 17:33:44 -06:00
Behdad Esfahbod 69b1707d82 [wasm] Return empty object when ref2obj fails 2023-03-31 17:33:44 -06:00
Behdad Esfahbod e87b1b3ec3 [wasm-api] Try to add face_reference_table 2023-03-31 17:33:44 -06:00
Behdad Esfahbod 747dcf561d [wasm] Strong typing for object references
Such that wasm cannot crash us by passing wrong object refs.

https://github.com/bytecodealliance/wasm-micro-runtime/discussions/1987

It still is unsafe if some code in the process other than HarfBuzz
registers refs with wasm-micro-runtime, since wasm_externref_ref2obj()
takes no context variable and looks up refs globally :(.

Maybe I fix that later by keeping a hash table of ref->obj-type instead.
2023-03-31 17:33:44 -06:00
Behdad Esfahbod 6b72a18c7b [wasm-api] Rename file 2023-03-31 17:33:44 -06:00
Behdad Esfahbod 42d121ae79 [wasm] Add hb-wasm-api.cc 2023-03-31 17:33:44 -06:00
Behdad Esfahbod 980706441b [wasm] Add hb-wasm-api-list.hh 2023-03-31 17:33:44 -06:00
Behdad Esfahbod 65efad6b59 [wasm] Make debugprint use debug API 2023-03-31 17:33:44 -06:00
Behdad Esfahbod bb8a04cbad [wasm] Remove the print(returnval) and use it to fail shaper 2023-03-31 17:33:44 -06:00
Simon Cozens 36dd27bf3f Just printf, don't take length 2023-03-31 17:33:44 -06:00
Behdad Esfahbod 3bc0ecf28c [wasm-api] Add ref_t 2023-03-31 17:33:44 -06:00
Behdad Esfahbod 62f3c7cf67 [wasm-api] Add macros for ref handling 2023-03-31 17:33:44 -06:00
Behdad Esfahbod 4c8a414a10 [wasm-api] Clean up debugprint 2023-03-31 17:33:44 -06:00
Behdad Esfahbod 63904538c8 [wasm-api] Use i32 instead of externref in API spec
Oh well...
2023-03-31 17:33:44 -06:00
Behdad Esfahbod bd28d01a6a [wasm-api] Add HB_WASM_INTERFACE 2023-03-31 17:33:44 -06:00
Simon Cozens ed1a70c7e8 Only export debugprint when HB_DEBUG_WASM 2023-03-31 17:33:44 -06:00
Simon Cozens 89c50b0ccb Fix debugprint format string 2023-03-31 17:33:44 -06:00
Behdad Esfahbod fd1f7f46f4 [wasm-api] Implement font_get_face 2023-03-31 17:33:44 -06:00
Behdad Esfahbod 9f4dc2e103 [wasm] Bind native API 2023-03-31 17:33:44 -06:00
Behdad Esfahbod e79a7318c4 [wasm] Start adding wasm-api 2023-03-31 17:33:44 -06:00
Behdad Esfahbod 829ba74284 [wasm] Add hb-wasm-api.h 2023-03-31 17:33:44 -06:00
Behdad Esfahbod 11c6d46086 [wasm] Pass font & buff to shape() function 2023-03-31 17:33:44 -06:00
Simon Cozens 05bf984212 Add a simple callback native function 2023-03-31 17:33:44 -06:00
Behdad Esfahbod bdbc1568ba [wasm] Port from c_api to wasm-micro-runtime wasm_runtime API 2023-03-31 17:33:44 -06:00
Behdad Esfahbod db8e51e01b [wasm] More boilerplate 2023-03-31 17:33:44 -06:00
Behdad Esfahbod fcc8be409b [wasm] Add meson build option
Autotools support missing.
2023-03-31 17:33:44 -06:00
Behdad Esfahbod 425fc7f3ee [wasm] Add wasm shaper skeleton 2023-03-31 17:33:44 -06:00
Behdad Esfahbod 04a47932a3 [paint] Remove enum trailing comma in C header
Fixes https://github.com/harfbuzz/harfbuzz/discussions/4188
2023-03-31 11:44:08 -06:00
Garret Rieger 2cd81fdfb6 [subset] fix memory leak.
Fixes fuzzer issue https://oss-fuzz.com/testcase-detail/6169920089227264
2023-03-30 16:19:41 -06:00
Behdad Esfahbod 453ded0539 [indic] Tighten up base-finding
Fixes https://github.com/harfbuzz/harfbuzz/issues/4185
2023-03-28 13:18:03 -06:00
Qunxin Liu c1acfe9966 [instancer] bug fix in TupleVariationData get_size ()
We need to iterate TupleVariationHeader when calculating the total size
2023-03-27 15:37:06 -06:00
Garret Rieger be87200106 [subset] fix buffer overflow fuzzer reported issue. 2023-03-25 10:11:46 -04:00
Garret Rieger 79ae6b657f [subset] Fix fuzzer found memory leaks. 2023-03-25 10:11:46 -04:00
Qunxin Liu fe671a5ac8 [instancer] support COLRv1 full instancing 2023-03-21 11:51:58 -06:00
Garret Rieger f0f7f22525 [subset] fix fuzzer found null deref.
https://oss-fuzz.com/testcase-detail/5844352760152064
2023-03-21 11:41:09 -06:00
Garret Rieger 79233a1492 [subset] fix incorrectly specified lock.
Lock variable must have a name or it will immediately destruct.
2023-03-16 20:30:39 -06:00