Skip to main content

TextRuntime

Struct TextRuntime 

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

文本运行时的配置快照。句柄可通过 Rc 在应用装配层与窗口之间共享。

Implementations§

Source§

impl TextRuntime

Source

pub fn new() -> TextRuntimeHandle

创建默认运行时:默认字体栈、行高 1.2、DPR 1.0。

Source

pub fn with_config( font_stack: impl Into<String>, line_height: f32, ) -> TextRuntimeHandle

创建显式配置的运行时。空字体栈回落到 DEFAULT_FONT_STACK。

Source

pub fn set_font_stack(&self, stack: impl Into<String>)

Source

pub fn font_stack(&self) -> String

Source

pub fn set_line_height(&self, line_height: f32)

设置字号倍数行高;≤0 或非有限值回落到 1.2。值未变化时 generation 不动。

Source

pub fn line_height(&self) -> f32

Source

pub fn set_dpr(&self, dpr: f32)

DPR 只影响栅格分辨率,已进入 shaped-line/raster key,不推进样式 generation。

Source

pub fn dpr(&self) -> f32

Source

pub fn style_generation(&self) -> u64

字体栈/行高变化计数;进入 shaped-line 与富文本缓存 key。

Trait Implementations§

Source§

impl Debug for TextRuntime

Source§

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

Formats the value using the given formatter. Read more

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> ErasedDestructor for T
where T: 'static,

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, 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.