yeslogic / allsorts

Font parser, shaping engine, and subsetter implemented in Rust
https://yeslogic.com/blog/allsorts-rust-font-shaping-engine/
Apache License 2.0
706 stars 23 forks source link

Streamlined shaping API #8

Closed tiffany352 closed 2 years ago

tiffany352 commented 4 years ago

Harfbuzz has a simplified API where you create an hb_buffer_t and call hb_shape() on it, while with this crate it looks like you have to write a bunch of boilerplate to apply gsub, gpos, and cmap table transformations separately. Could that code be streamlined into an API oriented around converting characters -> glyph indices? With other inputs similar to Harfbuzz, such as the language to use for shaping localized forms, and any OpenType features to apply during shaping such as smallcaps.

I could also be misunderstanding. I'm going off of the example located here: https://github.com/yeslogic/allsorts-tools/blob/master/src/shape.rs

mikeday commented 4 years ago

Yes, the characters -> glyphs mapping is still being driven by Prince at the moment but we're definitely going to push that into Allsorts in the future.

wezm commented 2 years ago

Since Allsorts 0.5 there it's now easier to shape text. The Font type has a shape method that handles most shaping concerns. Note that shape.rs in allsorts-tools is now much simpler.