Skip to main content

SwashShaperBackend

Struct SwashShaperBackend 

Source
pub struct SwashShaperBackend { /* private fields */ }
Expand description

Swash-based shaper — delegates to crate::SwashShaper.

This adapter wraps the existing crate::SwashShaper (which has its own internal LRU cache) and exposes it via the ShapeBackend trait.

Uses std::sync::RwLock instead of Mutex so that read-only operations (e.g. ShapeBackend::supports_script) can proceed concurrently. Shape calls still acquire the write lock because the underlying crate::SwashShaper mutates its internal context on every call.

Implementations§

Source§

impl SwashShaperBackend

Source

pub fn new() -> Self

Creates a new SwashShaperBackend.

Trait Implementations§

Source§

impl Default for SwashShaperBackend

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl ShapeBackend for SwashShaperBackend

Source§

fn shape( &self, face_data: &Arc<[u8]>, text: &str, px_size: f32, ) -> Vec<ShapedGlyph>

Shape UTF-8 text using font bytes face_data at px_size pixels-per-em, returning one ShapedGlyph per output glyph.
Source§

fn shape_with_direction( &self, face_data: &Arc<[u8]>, text: &str, px_size: f32, rtl: bool, ) -> Vec<ShapedGlyph>

Shape UTF-8 text with an explicit direction hint. Read more
Source§

fn shape_with_features( &self, face_data: &Arc<[u8]>, text: &str, px_size: f32, features: &[ShapeFeature], ) -> Vec<ShapedGlyph>

Shape UTF-8 text with an explicit set of OpenType feature overrides. Read more
Source§

fn shape_with_options( &self, face_data: &Arc<[u8]>, text: &str, px_size: f32, rtl: bool, features: &[ShapeFeature], _options: &ShapeRequest<'_>, ) -> Vec<ShapedGlyph>

Shape text with extended options. Read more
Source§

fn supports_script(&self, font_data: &Arc<[u8]>, script: [u8; 4]) -> bool

Check if the font has shaping support for a given OpenType script tag. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.