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.
impl TextShapingKey
Construction and fast-hashing helpers for TextShapingKey.
Sourcepub fn hash_bytes_128(bytes: &[u8]) -> (u64, u64)
pub fn hash_bytes_128(bytes: &[u8]) -> (u64, u64)
Sourcepub fn from_text(
text: &str,
style: TextStyle,
locale: &str,
rtl: bool,
font_chain_revision: u64,
) -> Self
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.
Sourcepub fn from_text_hash(
text_hash: u64,
text_len: u32,
style: TextStyle,
locale_hash: u64,
rtl: bool,
font_chain_revision: u64,
) -> Self
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.
Sourcepub 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
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.
Sourcepub fn line_break_key(
&self,
max_width: Option<f32>,
style: TextStyle,
) -> LineBreakKey
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 providingline_heightandoverflow.
§Returns
LineBreakKey- Line-break cache key independent of DPI scale and text color.
Source§impl TextShapingKey
impl TextShapingKey
pub fn get_text_hash_a(&self) -> u64
pub fn get_mut_text_hash_a(&mut self) -> &mut u64
pub fn set_text_hash_a(&mut self, val: u64) -> &mut Self
pub fn get_text_hash_b(&self) -> u64
pub fn get_mut_text_hash_b(&mut self) -> &mut u64
pub fn set_text_hash_b(&mut self, val: u64) -> &mut Self
pub fn get_text_len(&self) -> u32
pub fn get_mut_text_len(&mut self) -> &mut u32
pub fn set_text_len(&mut self, val: u32) -> &mut Self
pub fn get_font_size_bits(&self) -> u32
pub fn get_mut_font_size_bits(&mut self) -> &mut u32
pub fn set_font_size_bits(&mut self, val: u32) -> &mut Self
pub fn get_family(&self) -> FontFamily
pub fn get_mut_family(&mut self) -> &mut FontFamily
pub fn set_family(&mut self, val: FontFamily) -> &mut Self
pub fn get_weight(&self) -> FontWeight
pub fn get_mut_weight(&mut self) -> &mut FontWeight
pub fn set_weight(&mut self, val: FontWeight) -> &mut Self
pub fn get_italic(&self) -> bool
pub fn get_mut_italic(&mut self) -> &mut bool
pub fn set_italic(&mut self, val: bool) -> &mut Self
pub fn get_letter_spacing_bits(&self) -> u32
pub fn get_mut_letter_spacing_bits(&mut self) -> &mut u32
pub fn set_letter_spacing_bits(&mut self, val: u32) -> &mut Self
pub fn get_locale_hash(&self) -> u64
pub fn get_mut_locale_hash(&mut self) -> &mut u64
pub fn set_locale_hash(&mut self, val: u64) -> &mut Self
pub fn get_rtl(&self) -> bool
pub fn get_mut_rtl(&mut self) -> &mut bool
pub fn set_rtl(&mut self, val: bool) -> &mut Self
pub fn get_font_chain_revision(&self) -> u64
pub fn get_mut_font_chain_revision(&mut self) -> &mut u64
pub fn set_font_chain_revision(&mut self, val: u64) -> &mut Self
Trait Implementations§
Source§impl Clone for TextShapingKey
impl Clone for TextShapingKey
impl Copy for TextShapingKey
Source§impl Debug for TextShapingKey
impl Debug for TextShapingKey
Source§impl Default for TextShapingKey
impl Default for TextShapingKey
impl Eq for TextShapingKey
Source§impl Hash for TextShapingKey
impl Hash for TextShapingKey
Source§impl PartialEq for TextShapingKey
impl PartialEq for TextShapingKey
impl StructuralPartialEq for TextShapingKey
Auto Trait Implementations§
impl Forget for TextShapingKey
impl Freeze for TextShapingKey
impl Move for TextShapingKey
impl RefUnwindSafe for TextShapingKey
impl Send for TextShapingKey
impl Sync for TextShapingKey
impl Unpin for TextShapingKey
impl UnsafeUnpin for TextShapingKey
impl UnwindSafe for TextShapingKey
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