pub struct Shaper<'a> { /* private fields */ }
Expand description
A configured shaper.
Implementations§
Source§impl<'a> Shaper<'a>
impl<'a> Shaper<'a>
Sourcepub fn units_per_em(&self) -> i32
pub fn units_per_em(&self) -> i32
Returns font’s units per EM.
Sourcepub fn coords(&self) -> &'a [NormalizedCoord] ⓘ
pub fn coords(&self) -> &'a [NormalizedCoord] ⓘ
Returns the currently active normalized coordinates.
Sourcepub fn shape(&self, buffer: UnicodeBuffer, features: &[Feature]) -> GlyphBuffer
pub fn shape(&self, buffer: UnicodeBuffer, features: &[Feature]) -> GlyphBuffer
Shapes the buffer content using provided font and features.
Consumes the buffer. You can then run GlyphBuffer::clear
to get the UnicodeBuffer
back
without allocating a new one.
If you plan to shape multiple strings, prefer shape_with_plan
.
This is because ShapePlan
initialization is pretty slow and should preferably
be called once for each shaping configuration.
Sourcepub fn shape_with_plan(
&self,
plan: &ShapePlan,
buffer: UnicodeBuffer,
features: &[Feature],
) -> GlyphBuffer
pub fn shape_with_plan( &self, plan: &ShapePlan, buffer: UnicodeBuffer, features: &[Feature], ) -> GlyphBuffer
Shapes the buffer content using the provided font and plan.
Consumes the buffer. You can then run GlyphBuffer::clear
to get the UnicodeBuffer
back
without allocating a new one.
It is up to the caller to ensure that the shape plan matches the properties of the provided buffer, otherwise the shaping result will likely be incorrect.
§Panics
Will panic when debugging assertions are enabled if the buffer and plan have mismatched properties.