pub struct TextMeasure {Show 16 fields
pub content: String,
pub size_px: f32,
pub alignment: Alignment,
pub italic: bool,
pub font_family: Option<String>,
pub line_height: f32,
pub weight: f32,
pub max_lines: Option<usize>,
pub ellipsis: bool,
pub underline: bool,
pub strikethrough: bool,
pub spans: Option<Vec<TextSpan>>,
pub letter_spacing: f32,
pub word_spacing: f32,
pub no_wrap: bool,
pub overflow_wrap: bool,
}Expand description
Datos de un nodo-hoja de texto necesarios para medirlo (shaping +
line-break) sin volver a tocar el View. Lo consume el runtime en la
función de medición que le pasa a LayoutTree::compute_with_measure.
Fields§
§content: String§size_px: f32§alignment: Alignment§italic: bool§font_family: Option<String>§line_height: f32§weight: f32§max_lines: Option<usize>§ellipsis: bool§underline: boolIdem TextSpec::underline. Se replica en la medida porque parley
no cambia de ancho con decoración (no toca el shaping); pero la clave
del caché de shaping sí cambia, y queremos que medida y pintado
peguen la misma entrada del caché.
strikethrough: boolIdem TextSpec::strikethrough. Mismo razonamiento que underline.
spans: Option<Vec<TextSpan>>Idem TextSpec::spans. La medida usa el mismo
Typesetter::layout_spans que el pintado, así taffy reserva el alto
real considerando overrides de size_px por span (un <h1> inline
dentro de un párrafo agranda esa línea). None/vacío = medir con
layout_clamped (camino uniforme).
letter_spacing: f32Idem TextSpec::letter_spacing. Entra en la medida porque cambia el
ancho del shaping (y la clave del caché).
word_spacing: f32Idem TextSpec::word_spacing. Mismo razonamiento que letter_spacing.
no_wrap: boolIdem TextSpec::no_wrap. Entra en la medida porque cambia el ancho
reservado: con no_wrap el texto se mide en una sola línea (ancho
completo) en vez de envolver al available.
overflow_wrap: boolIdem TextSpec::overflow_wrap. Entra en la medida porque parte la
palabra larga: con el flag, el ancho mínimo del bloque deja de estar
fijado por el token más ancho.
Trait Implementations§
Source§impl Clone for TextMeasure
impl Clone for TextMeasure
Source§fn clone(&self) -> TextMeasure
fn clone(&self) -> TextMeasure
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for TextMeasure
impl RefUnwindSafe for TextMeasure
impl Send for TextMeasure
impl Sync for TextMeasure
impl Unpin for TextMeasure
impl UnsafeUnpin for TextMeasure
impl UnwindSafe for TextMeasure
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.