rustybuzz
rustybuzz copied to clipboard
Using `Face` with multiple font sizes
I'm storing a Face in an Arc that is shared across multiple threads. When I need to perform shaping, I call Face::clone and set the font size on the cloned Face. This clone is not entirely free because Face contains a Vec.
I would like for shape to take an additional argument that contains all of the mutable properties of a Face so that Face can be treated as immutable after construction. E.g.
struct FaceConfig {
pub pixels_per_em: Option<(u16, u16)>,
pub points_per_em: Option<f32>,
}
pub fn shape(face: &Face, config: &FaceConfig, features: &[Feature], buffer: UnicodeBuffer) -> GlyphBuffer {
Yes, I guess it makes sense.
struct FaceConfig { pub pixels_per_em: Option<(u16, u16)>, pub points_per_em: Option<f32>, }
We call them Font in HarfBuzz.