pub struct TextScope { /* private fields */ }Expand description
A Text and its builder.
Implementations§
Source§impl TextScope
impl TextScope
Sourcepub fn spans(self, spans: TextSpans) -> Self
pub fn spans(self, spans: TextSpans) -> Self
Runs of different treatment inside the text: a bold phrase, a link, some code.
pub fn type_role(self, role: TypeRole) -> Self
pub fn font_size(self, sp: f32) -> Self
pub fn font_weight(self, weight: u16) -> Self
pub fn line_height(self, sp: f32) -> Self
Sourcepub fn letter_spacing(self, sp: f32) -> Self
pub fn letter_spacing(self, sp: f32) -> Self
Extra space between letters, in sp. 0 draws no extra spacing; NaN, like never calling this, takes the type role’s spacing.
pub fn color(self, paint: Paint) -> Self
pub fn text_align(self, align: TextAlign) -> Self
pub fn max_lines(self, lines: u32) -> Self
pub fn overflow(self, overflow: TextOverflow) -> Self
Sourcepub fn font(self, font: FontRefs) -> Self
pub fn font(self, font: FontRefs) -> Self
The fonts to try, in order. Only text with TypeRole::None takes its own fonts;
text with a role is set in the theme’s font for that role.
Sourcepub fn font_feature_settings(self, features: &[FontFeature]) -> Self
pub fn font_feature_settings(self, features: &[FontFeature]) -> Self
OpenType features of the font the text is set in, such as
FontFeature::TABULAR_NUMS for digits of one width. Compose’s
TextStyle.fontFeatureSettings, CSS’s font-feature-settings.
Taken with or without a type role: a feature picks one of the forms the font already
has and does not change the font. A tag given twice takes the later value, an empty
list is no features, and at most MAX_FONT_FEATURES (16) are taken. A font without
the feature draws as it would have.
Sourcepub fn word_break(self, word_break: WordBreak) -> Self
pub fn word_break(self, word_break: WordBreak) -> Self
Where a line may break inside a word. CSS word-break.
Sourcepub fn overflow_wrap(self, overflow_wrap: OverflowWrap) -> Self
pub fn overflow_wrap(self, overflow_wrap: OverflowWrap) -> Self
Whether a token too long for its line, such as a path or a URL, may break inside
itself. CSS overflow-wrap. With Anywhere such a token breaks between its letters
even under WordBreak::KeepAll; tokens that fit keep the breaking rule they had.
Source§impl TextScope
impl TextScope
Sourcepub fn on_pointer(
self,
kinds: PointerKinds,
handler: impl FnMut(PointerEvent) + 'static,
) -> Self
pub fn on_pointer( self, kinds: PointerKinds, handler: impl FnMut(PointerEvent) + 'static, ) -> Self
Subscribes the node to the kinds of pointer input in kinds. The handler runs
on the same call as the input; calling consume on the event keeps it from
the nearest subscribed ancestor and from the Renderer’s own handling.
A node that never calls this has no pointer input at all, and costs nothing.