pub struct ShapingCacheKey {
pub text: String,
pub backend: String,
pub font_id: u64,
pub size: u32,
pub language: Option<String>,
pub script: Option<String>,
pub features: Vec<(String, u32)>,
pub variations: Vec<(String, i32)>,
}Expand description
Key for caching shaping results
Uniquely identifies a shaping operation by its inputs: text content, font identity, size, locale settings, OpenType features, and variable font axis coordinates.
Fields§
§text: StringText content
backend: StringName of the shaper/backend
font_id: u64Font identifier (hash of font data)
size: u32Font size in points (stored as u32: size * 100 for hash stability)
language: Option<String>Language code (e.g., “en”, “ar”, “zh”)
script: Option<String>Script tag (e.g., “latn”, “arab”, “hans”)
features: Vec<(String, u32)>Enabled OpenType features with their values
variations: Vec<(String, i32)>Variable font axis coordinates (stored as i32: value * 100 for hash stability)
Implementations§
Source§impl ShapingCacheKey
impl ShapingCacheKey
Sourcepub fn new(
text: impl Into<String>,
backend: impl Into<String>,
font_data: &[u8],
size: f32,
language: Option<String>,
script: Option<String>,
features: Vec<(String, u32)>,
variations: Vec<(String, f32)>,
) -> ShapingCacheKey
pub fn new( text: impl Into<String>, backend: impl Into<String>, font_data: &[u8], size: f32, language: Option<String>, script: Option<String>, features: Vec<(String, u32)>, variations: Vec<(String, f32)>, ) -> ShapingCacheKey
Create a new cache key from shaping inputs
The font data is hashed to create a stable identifier that doesn’t require keeping the full font data in memory for cache lookups.
Variable font coordinates are included in the key to ensure different axis settings (e.g., wght=400 vs wght=700) produce different cache entries.
Trait Implementations§
Source§impl Clone for ShapingCacheKey
impl Clone for ShapingCacheKey
Source§fn clone(&self) -> ShapingCacheKey
fn clone(&self) -> ShapingCacheKey
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ShapingCacheKey
impl Debug for ShapingCacheKey
Source§impl Hash for ShapingCacheKey
impl Hash for ShapingCacheKey
Source§impl PartialEq for ShapingCacheKey
impl PartialEq for ShapingCacheKey
impl Eq for ShapingCacheKey
impl StructuralPartialEq for ShapingCacheKey
Auto Trait Implementations§
impl Freeze for ShapingCacheKey
impl RefUnwindSafe for ShapingCacheKey
impl Send for ShapingCacheKey
impl Sync for ShapingCacheKey
impl Unpin for ShapingCacheKey
impl UnsafeUnpin for ShapingCacheKey
impl UnwindSafe for ShapingCacheKey
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.