-
Notifications
You must be signed in to change notification settings - Fork 661
[wasm] WebAssembly shaper #4131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
889448b
to
e06db9d
Compare
cc @ebraminio |
meson_options.txt
Outdated
@@ -21,6 +21,8 @@ option('directwrite', type: 'feature', value: 'disabled', | |||
description: 'Enable DirectWrite shaper backend on Windows (experimental)') | |||
option('coretext', type: 'feature', value: 'disabled', | |||
description: 'Enable CoreText shaper backend on macOS') | |||
option('wasm', type: 'feature', value: 'disabled', | |||
description: 'Enable WebAssembly shaper backend') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work. Since this apparently will use a generic 'Wasm' table tag from a font maybe it can be named a 'font backend' in hope someday it gains also outline drawing / painting capabilities.
bcf92a4
to
aceea72
Compare
cc @jfkthame |
I compiled graphite to a wasm library and and integrated it with hb-wasm-api, then embedded it in CharilSIL. The CharisSIL font is 1.7MB. The Wasm table with entire graphite library in it is 110kb. It renders. cc @mhosken |
I think with a bit of polish this can actually be merged as an experimental feature, off by default. |
1da04d3
to
2f8a0f5
Compare
It does it automatically.
Or else uharfbuzz doesn't build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The API masquerades the font/face/buffer tokens as pointers, for more natural-looking representation. Any reason you explicitly talk about tokens?
You don't do that about blobs.
Maybe better to add API docs to hb-wasm-api.h and point people to that instead? |
I guess it's because they're opaque pointers which refer to memory in Harfbuzz-land, and you can't do anything with them, whereas you can dereference and use the blob data. I've no objection to calling them pointers if you prefer.
I wrote this because I received complaints that "read the header file" was not adequate documentation. :-) |
I think I prefer that since that's what's in the API. Up to you though.
I meant documenting the API and having gtkdoc generate API docs like our normal API documentation. Thanks for this. |
Hi, |
This adds a
wasm
shaper that when called (default, when built), loads a WebAssembly program from theWasm
table of the font and calls itsbool shape(font*,buffer*)
function to shape the buffer.The API available to the wasm program is in
hb-wasm-api.h
.