pub struct ShapeOptions<'a> {
plan: Option<&'a ShapePlan>,
scale: Option<(i32, i32)>,
point_size: Option<f32>,
features: &'a [Feature],
font_funcs: Option<&'a mut (dyn FontFuncs + 'a)>,
}Expand description
Options which can be used to configure shaping.
Fields§
§plan: Option<&'a ShapePlan>§scale: Option<(i32, i32)>§point_size: Option<f32>§features: &'a [Feature]§font_funcs: Option<&'a mut (dyn FontFuncs + 'a)>Implementations§
Source§impl<'a> ShapeOptions<'a>
impl<'a> ShapeOptions<'a>
Sourcepub fn plan(self, plan: Option<&'a ShapePlan>) -> Self
pub fn plan(self, plan: Option<&'a ShapePlan>) -> Self
Sets the plan to use for shaping.
The shape plan must be compatible with the properties of the buffer passed to shaping.
Sourcepub fn scale(self, scale: Option<i32>) -> Self
pub fn scale(self, scale: Option<i32>) -> Self
Sets the scale factor to use during shaping.
The font scale is a number related to, but not the same as, font size. Typically the client establishes a scale factor to be used between the two. For example, 64, or 256, which would be the fractional-precision part of the font scale. This is necessary because position and metric values are integer types and you need to leave room for fractional values in there.
For example, to set the font size to 20, with 64 levels of fractional
precision you would call provide a scale of 20 * 64.
In the example above, even what font size 20 means is up to you. It might be 20 pixels, or 20 points, or 20 millimeters. HarfRust does not care about that.
The choice of scale is yours but needs to be consistent between what you set here, and what you expect as output as well as the values returned by font functions.
This defaults to None which means that no scale is applied– positions
and metrics will be returned in font units.
Sourcepub fn scale_separate(self, scale: Option<(i32, i32)>) -> Self
pub fn scale_separate(self, scale: Option<(i32, i32)>) -> Self
Sets separate x- and y-scale factors to use during shaping.
Each axis uses the same semantics as scale.
Sourcepub fn point_size(self, point_size: Option<f32>) -> Self
pub fn point_size(self, point_size: Option<f32>) -> Self
Sets the size used for application of the tracking table.
Sourcepub fn features(self, features: &'a [Feature]) -> Self
pub fn features(self, features: &'a [Feature]) -> Self
Sets the features to apply during shaping.
Sourcepub fn font_funcs(self, funcs: Option<&'a mut (dyn FontFuncs + 'a)>) -> Self
pub fn font_funcs(self, funcs: Option<&'a mut (dyn FontFuncs + 'a)>) -> Self
Sets optional font functions used for shaping.