pub trait Shaper: Send + Sync {
// Required methods
fn name(&self) -> &'static str;
fn shape(
&self,
text: &str,
font: Arc<dyn FontRef>,
params: &ShapingParams,
) -> Result<ShapingResult>;
// Provided methods
fn supports_script(&self, _script: &str) -> bool { ... }
fn clear_cache(&self) { ... }
}Expand description
Where characters learn their positions
Text shaping is where script rules, font features, and character clusters collide to produce perfectly positioned glyphs ready for rendering.
Required Methods§
Sourcefn shape(
&self,
text: &str,
font: Arc<dyn FontRef>,
params: &ShapingParams,
) -> Result<ShapingResult>
fn shape( &self, text: &str, font: Arc<dyn FontRef>, params: &ShapingParams, ) -> Result<ShapingResult>
Transform characters into positioned glyphs
Provided Methods§
Sourcefn supports_script(&self, _script: &str) -> bool
fn supports_script(&self, _script: &str) -> bool
Can you handle this script?
Returns false by default - implementations should explicitly declare support.
Sourcefn clear_cache(&self)
fn clear_cache(&self)
Flush any cached shaping data