Skip to main content

TextShapingKey

Struct TextShapingKey 

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

DPI- and wrap-width-independent lookup key identifying shaped glyph advances for a text run.

Implementations§

Source§

impl TextShapingKey

Construction and fast-hashing helpers for TextShapingKey.

Source

pub fn hash_bytes_128(bytes: &[u8]) -> (u64, u64)

Computes dual 64-bit FNV-1a hashes over bytes to form a 128-bit collision-resistant digest.

§Arguments
  • &[u8] - Input UTF-8 byte slice.
§Returns
  • (u64, u64) - Dual 64-bit hash pair (hash_a, hash_b).
Source

pub fn from_text( text: &str, style: TextStyle, locale: &str, rtl: bool, font_chain_revision: u64, ) -> Self

Builds a DPI- and wrap-width-independent TextShapingKey from text, style, locale, direction, and font-chain revision.

§Arguments
  • &str - Source UTF-8 text content.
  • TextStyle - Typography style (color, alignment, and overflow are intentionally excluded).
  • &str - Active BCP-47 locale identifier.
  • bool - Whether right-to-left base direction is enabled.
  • u64 - Active font fallback chain revision.
§Returns
  • Self - Constructed shaping cache key.
Source

pub fn from_text_hash( text_hash: u64, text_len: u32, style: TextStyle, locale_hash: u64, rtl: bool, font_chain_revision: u64, ) -> Self

Builds a TextShapingKey from a single precomputed 64-bit text_hash without re-hashing text bytes.

§Arguments
  • u64 - Precomputed 64-bit text content hash (for example stored on a scene node).
  • u32 - UTF-8 byte length of the source text.
  • TextStyle - Typography style parameters.
  • u64 - Precomputed locale hash.
  • bool - Whether right-to-left base direction is enabled.
  • u64 - Active font fallback chain revision.
§Returns
  • Self - Zero-rehash shaping cache key.
Source

pub fn from_prehashed( text_hash_a: u64, text_hash_b: u64, text_len: u32, style: TextStyle, locale_hash: u64, rtl: bool, font_chain_revision: u64, ) -> Self

Builds a TextShapingKey from precomputed 128-bit text hashes and precomputed locale hash.

§Arguments
  • u64 - Primary 64-bit text hash.
  • u64 - Secondary 64-bit text hash.
  • u32 - UTF-8 byte length of the source text.
  • TextStyle - Typography style parameters.
  • u64 - Precomputed locale hash.
  • bool - Whether right-to-left base direction is enabled.
  • u64 - Active font fallback chain revision.
§Returns
  • Self - Constructed shaping cache key.
Source

pub fn fast_hash(&self) -> u64

Computes a single-pass FxHash digest of all fields for single-probe flat table lookup.

§Arguments
  • &Self - Shaping key reference.
§Returns
  • u64 - Mixed 64-bit avalanche hash.
Source

pub fn line_break_key( &self, max_width: Option<f32>, style: TextStyle, ) -> LineBreakKey

Builds a paired LineBreakKey binding this shaping key to max_width, line_height, and overflow.

§Arguments
  • &Self - Base shaping key.
  • Option<f32> - Optional logical wrap width limit.
  • TextStyle - Typography style providing line_height and overflow.
§Returns
  • LineBreakKey - Line-break cache key independent of DPI scale and text color.
Source§

impl TextShapingKey

Source

pub fn get_text_hash_a(&self) -> u64

Source

pub fn get_mut_text_hash_a(&mut self) -> &mut u64

Source

pub fn set_text_hash_a(&mut self, val: u64) -> &mut Self

Source

pub fn get_text_hash_b(&self) -> u64

Source

pub fn get_mut_text_hash_b(&mut self) -> &mut u64

Source

pub fn set_text_hash_b(&mut self, val: u64) -> &mut Self

Source

pub fn get_text_len(&self) -> u32

Source

pub fn get_mut_text_len(&mut self) -> &mut u32

Source

pub fn set_text_len(&mut self, val: u32) -> &mut Self

Source

pub fn get_font_size_bits(&self) -> u32

Source

pub fn get_mut_font_size_bits(&mut self) -> &mut u32

Source

pub fn set_font_size_bits(&mut self, val: u32) -> &mut Self

Source

pub fn get_family(&self) -> FontFamily

Source

pub fn get_mut_family(&mut self) -> &mut FontFamily

Source

pub fn set_family(&mut self, val: FontFamily) -> &mut Self

Source

pub fn get_weight(&self) -> FontWeight

Source

pub fn get_mut_weight(&mut self) -> &mut FontWeight

Source

pub fn set_weight(&mut self, val: FontWeight) -> &mut Self

Source

pub fn get_italic(&self) -> bool

Source

pub fn get_mut_italic(&mut self) -> &mut bool

Source

pub fn set_italic(&mut self, val: bool) -> &mut Self

Source

pub fn get_letter_spacing_bits(&self) -> u32

Source

pub fn get_mut_letter_spacing_bits(&mut self) -> &mut u32

Source

pub fn set_letter_spacing_bits(&mut self, val: u32) -> &mut Self

Source

pub fn get_locale_hash(&self) -> u64

Source

pub fn get_mut_locale_hash(&mut self) -> &mut u64

Source

pub fn set_locale_hash(&mut self, val: u64) -> &mut Self

Source

pub fn get_rtl(&self) -> bool

Source

pub fn get_mut_rtl(&mut self) -> &mut bool

Source

pub fn set_rtl(&mut self, val: bool) -> &mut Self

Source

pub fn get_font_chain_revision(&self) -> u64

Source

pub fn get_mut_font_chain_revision(&mut self) -> &mut u64

Source

pub fn set_font_chain_revision(&mut self, val: u64) -> &mut Self

Trait Implementations§

Source§

impl Clone for TextShapingKey

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for TextShapingKey

Source§

impl Debug for TextShapingKey

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TextShapingKey

Source§

fn default() -> Self

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

impl Eq for TextShapingKey

Source§

impl Hash for TextShapingKey

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for TextShapingKey

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for TextShapingKey

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.