I did it with the Harfbuzz shaper which now have experimental support for embedding WebAssembly programs to shape fonts.
Talk where I show it off: https://www.youtube.com/watch?v=Ms1Drb9Vw9M
Source code: https://github.com/Erk-/programmable-fonts
You can also see actual uses of this WebAssembly embedding to show that is not just for fun here: https://github.com/harfbuzz/harfbuzz-wasm-examples
repo: https://github.com/hsfzxjy/Bad-Apple-Font
youtube[1]: https://www.youtube.com/watch?v=GF2sn2DXjlA
youtube[2]: https://www.youtube.com/watch?v=qFd8vsr8nag