pub struct ShapingKey {
pub text_hash: u64,
pub text_len: u32,
pub script: Script,
pub direction: RunDirection,
pub style_id: u64,
pub font_id: FontId,
pub size_256ths: u32,
pub features: FontFeatures,
pub generation: u64,
}Expand description
Deterministic cache key for shaped glyph output.
Captures all parameters that affect shaping results. Two identical keys
are guaranteed to produce identical ShapedRun output, enabling safe
caching.
§Key components
| Field | Purpose |
|---|---|
text_hash | FxHash of the text content |
text_len | Byte length (collision avoidance) |
script | Unicode script (affects glyph selection) |
direction | LTR/RTL (affects reordering + positioning) |
style_id | Style discriminant (bold/italic affect glyphs) |
font_id | Font face identity |
size_256ths | Font size in 1/256th point units |
features | Active OpenType features |
generation | Cache generation (invalidation epoch) |
Fields§
§text_hash: u64FxHash of the text content.
text_len: u32Byte length of the text (for collision avoidance with the hash).
script: ScriptUnicode script.
direction: RunDirectionText direction.
style_id: u64Style discriminant.
font_id: FontIdFont face identity.
size_256ths: u32Font size in 1/256th of a point (sub-pixel precision matching ftui-render).
features: FontFeaturesActive OpenType features (canonicalized for determinism).
generation: u64Cache generation epoch — entries from older generations are stale.
Implementations§
Source§impl ShapingKey
impl ShapingKey
Sourcepub fn new(
text: &str,
script: Script,
direction: RunDirection,
style_id: u64,
font_id: FontId,
size_256ths: u32,
features: &FontFeatures,
generation: u64,
) -> Self
pub fn new( text: &str, script: Script, direction: RunDirection, style_id: u64, font_id: FontId, size_256ths: u32, features: &FontFeatures, generation: u64, ) -> Self
Build a key from shaping parameters.
Trait Implementations§
Source§impl Clone for ShapingKey
impl Clone for ShapingKey
Source§fn clone(&self) -> ShapingKey
fn clone(&self) -> ShapingKey
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ShapingKey
impl Debug for ShapingKey
Source§impl Hash for ShapingKey
impl Hash for ShapingKey
Source§impl PartialEq for ShapingKey
impl PartialEq for ShapingKey
impl Eq for ShapingKey
impl StructuralPartialEq for ShapingKey
Auto Trait Implementations§
impl Freeze for ShapingKey
impl RefUnwindSafe for ShapingKey
impl Send for ShapingKey
impl Sync for ShapingKey
impl Unpin for ShapingKey
impl UnsafeUnpin for ShapingKey
impl UnwindSafe for ShapingKey
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
Mutably borrows from an owned value. Read more
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
Compare self to
key and return true if they are equal.