Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upWeb Assembly port #155
Web Assembly port #155
Comments
This comment has been minimized.
This comment has been minimized.
|
Yes please! |
This comment has been minimized.
This comment has been minimized.
|
There might be a bit of work getting the multithreaded story sorted out, it would be nice if we could use post message rather than SharedArrayBuffer for communication. |
This comment has been minimized.
This comment has been minimized.
|
Web Assembly is one of the reasons behind the Executor and RenderCommandListener abstractions. (The other one is WebRender, which is hesitant to add any more threads, at least in Gecko.) Core Pathfinder no longer spawns any threads. For a single-threaded workload you would buffer RenderCommands into a vector, then send them to a Renderer all at once instead of using a SceneProxy. This is likely what a Web Assembly port will want to do. |
This comment has been minimized.
This comment has been minimized.
|
I'd love to help with this. I need some project to find out how ready the wasm ecosystem is and this seems like it could be that project. @pcwalton do you have a list of items to work on? |
This comment has been minimized.
This comment has been minimized.
|
@est31 Here are the remaining blockers:
|
This comment has been minimized.
This comment has been minimized.
|
@pcwalton thanks for the list. I'm not sure I want to do the HarfBuzz/Freetype parts because I don't want to attempt installing emscripten again. It's very tedious to install and set up. The js embedding for wasi right now seems to build on emscripten itself :/. So maybe I should work on #164 first?
Instead of the C API, I'd have used wasm-bindgen instead. It allows you to expose rust-y APIs to javascript. |
This comment has been minimized.
This comment has been minimized.
|
Any and all help is appreciated! I'll probably get to FreeType and HB if someone else doesn't do it first. As for the C API, we need it for other reasons, for example @toolness' Unity plugin, so I figured we might as well use it for the wasm port as well. But I don't feel strongly about it either way. |
This comment has been minimized.
This comment has been minimized.
|
Hmm yeah I just realized that #164 is larger than I thought. It requires changes in font-kit as well as skribo or requires replacing skribo use entirely both of which is probably involved and it's probably easier for you given you know both much better than me. I'd love to help though after #164 is resolved! Of course, only if you haven't done WASM support by then already :). |
This comment has been minimized.
This comment has been minimized.
|
FreeType and Harfbuzz compile without any modification via emscripten. We'd have to compile the whole thing via |
This comment has been minimized.
This comment has been minimized.
|
Also, won't SIMD be a problem? |
This comment has been minimized.
This comment has been minimized.
|
@jrowny feel free to take this issue :) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
I would like to report success! Modified pathfinder repo: https://github.com/s3bk/pathfinder I am using vector to draw things and font to parse fonts and draw text. |
This comment has been minimized.
This comment has been minimized.
|
Wow! |
This comment has been minimized.
This comment has been minimized.
|
Excellent ! |
This comment has been minimized.
This comment has been minimized.
|
@boulabiar I plan to support right to left scripts eventually. The pdf viewer using the font crate renders Arabic text correct. |
This comment has been minimized.
This comment has been minimized.
|
Upon request from #rust-offtopic, here is the PDF viewer running in wasm: https://pdf-rs.github.io/view-wasm/ (use ◁ and ▷ keys to navigate) I moved the code to display a scene here: https://github.com/s3bk/pathfinder_view |
It would be nice to have a Web Assembly port, like Google's CanvasKit for Skia.