pub struct TextRuntime { /* private fields */ }Expand description
文本运行时的配置快照。句柄可通过 Rc 在应用装配层与窗口之间共享。
Implementations§
Source§impl TextRuntime
impl TextRuntime
Sourcepub fn new() -> TextRuntimeHandle
pub fn new() -> TextRuntimeHandle
创建默认运行时:默认字体栈、行高 1.2、DPR 1.0。
Sourcepub fn with_config(
font_stack: impl Into<String>,
line_height: f32,
) -> TextRuntimeHandle
pub fn with_config( font_stack: impl Into<String>, line_height: f32, ) -> TextRuntimeHandle
创建显式配置的运行时。空字体栈回落到 DEFAULT_FONT_STACK。
pub fn set_font_stack(&self, stack: impl Into<String>)
pub fn font_stack(&self) -> String
Sourcepub fn set_line_height(&self, line_height: f32)
pub fn set_line_height(&self, line_height: f32)
设置字号倍数行高;≤0 或非有限值回落到 1.2。值未变化时 generation 不动。
pub fn line_height(&self) -> f32
pub fn dpr(&self) -> f32
Sourcepub fn style_generation(&self) -> u64
pub fn style_generation(&self) -> u64
字体栈/行高变化计数;进入 shaped-line 与富文本缓存 key。
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for TextRuntime
impl !RefUnwindSafe for TextRuntime
impl !Sync for TextRuntime
impl Forget for TextRuntime
impl Move for TextRuntime
impl Send for TextRuntime
impl Unpin for TextRuntime
impl UnsafeUnpin for TextRuntime
impl UnwindSafe for TextRuntime
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