RazrFalcon / rustybuzz

A complete harfbuzz's shaping algorithm port to Rust
MIT License
498 stars 34 forks source link

Add support for reusable ShapePlans. #88

Closed vorporeal closed 7 months ago

vorporeal commented 7 months ago

This exposes ShapePlan outside of the rustybuzz crate, and provides a new shape_with_plan function that takes in a ShapePlan instead of a list of user features.

Callers are expected to properly cache ShapePlans to avoid incorrect rendering due to mismatches between the ShapePlan and the provided buffer. To help avoid bugs due to mismatches, I added two debug_assert!() lines to verify that the plan and buffer use the same direction and script.

Given that ShapePlan is now public outside of the crate, I changed a number of pub specifiers to pub(crate) to maintain the same effective visibility.

RazrFalcon commented 7 months ago

Thanks! I will publish a new version soon.