rustybuzz icon indicating copy to clipboard operation
rustybuzz copied to clipboard

Using `Face` with multiple font sizes

Open mahkoh opened this issue 4 years ago • 2 comments

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 {

mahkoh avatar Sep 30 '21 00:09 mahkoh

Yes, I guess it makes sense.

RazrFalcon avatar Sep 30 '21 12:09 RazrFalcon

struct FaceConfig {
    pub pixels_per_em: Option<(u16, u16)>,
    pub points_per_em: Option<f32>,
}

We call them Font in HarfBuzz.

behdad avatar Sep 30 '21 13:09 behdad