harfbuzz / harfbuzz/harfrust

Caching ShapePlan and the Wasm Module/Linker

Open
#9 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
301
Forks
26
Avg merge
10h 11m
Merged PRs (30d)
43

Description

Hello.

One of the improvement paths for ruatybuzz is to figure out how to cache the shape plan so it is used between calls.

Ive been reflecting on this and the way I think it makes sense is to somehow embed it into the `Font` (or `Face`) object. However, plans as far as I can tell are not unique per font, for example if you want to have different runs with different features turned on (including variable axis) , each feature set would require its own plan.

The other thing is the Linker/Module of the wasm shaper. I tried caching the `Linker` somehow, where I tried to embed it into the ShapePlan, as it were, but I ran into a lot of circular references, as the `Store` type is generic over an inner type which does include the Plan *and* the `Font`. [Context here](https://github.com/RazrFalcon/rustybuzz/pull/122#discussion_r1673973991).

Caching the wasm module and linker would be necessary if one were to use the module for more than the `shape` function. For example [`shape_justify`](https://github.com/harfbuzz/harfbuzz/issues/4219#issuecomment-2243716687)`

I do not think this (either caching) can be done without some architectural changes to the API and structure of the code. Are references allowed to be `'static ` ? Or should everything be embedded into the Font somehow? And if they're embedded in the font how is the circular reference solved in the wasm linker?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.