Open fschutt opened 3 years ago
I don't understand the reasoning behind this crate's dependency on Rc/RefCell. What is it used for?
I don't understand the reasoning behind this crate's dependency on Rc/RefCell. What is it used for?
It's used for caching during shaping: https://github.com/yeslogic/allsorts/blob/6f44fc4fefdb94f3441c10054449c98deea89e39/src/layout.rs#L2964
One of the main features missing is the ability to shape / decode the font once on load - right now the entire crate is riddled with
Rc<RefCell<...>>
, which makes it impossible to shape words in parallel. I'd like to use this crate for my graphics framework, but shaping words synchronously is very slow. Ideally it should be possible to parse the entire font upfront (even if that takes hundreds of milliseconds) instead of decoding on-the-fly. Thegpos::apply()
andgsub::apply()
functions currently take types likeLayoutCache
that don't implementSend
, so it's not possible to shape words in parallel.Right now the only thing I can do is to parse the
glyf
table upfront in parallel:The only problem is that I can't do this with font shaping, i.e. this doesn't work:
In GUI frameworks it's often necessary to shape characters many times, so it would be nice to decode the kerning / positioning / substitution tables upfront. Right now, font shaping is the heaviest part of the entire layout step (4 out of 5 ms for layout are spent on text shaping alone), so parallelizing text shaping on a per-word basis would be great.