Add shape-run-cache feature, that can significantly improve shaping performance

This commit is contained in:
Jeremy Soller 2024-02-08 11:12:41 -07:00
parent 990d66ed41
commit 1eb3233373
No known key found for this signature in database
GPG key ID: D02FD439211AF56F
7 changed files with 134 additions and 2 deletions

View file

@ -32,6 +32,10 @@ pub struct FontSystem {
/// Cache for rustybuzz shape plans.
shape_plan_cache: ShapePlanCache,
/// Cache for shaped runs
#[cfg(feature = "shape-run-cache")]
pub shape_run_cache: crate::ShapeRunCache,
}
impl fmt::Debug for FontSystem {
@ -81,6 +85,8 @@ impl FontSystem {
font_cache: Default::default(),
font_matches_cache: Default::default(),
shape_plan_cache: ShapePlanCache::default(),
#[cfg(feature = "shape-run-cache")]
shape_run_cache: crate::ShapeRunCache::default(),
}
}