pub struct FormattedText {
pub shadow: InheritableVariable<bool>,
pub shadow_brush: InheritableVariable<Brush>,
pub shadow_dilation: InheritableVariable<f32>,
pub shadow_offset: InheritableVariable<Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>>,
/* private fields */
}
Fields§
§shadow: InheritableVariable<bool>
§shadow_brush: InheritableVariable<Brush>
§shadow_dilation: InheritableVariable<f32>
§shadow_offset: InheritableVariable<Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>>
Implementations§
Source§impl FormattedText
impl FormattedText
pub const FONT: &'static str = "font"
pub const TEXT: &'static str = "text"
pub const VERTICAL_ALIGNMENT: &'static str = "vertical_alignment"
pub const HORIZONTAL_ALIGNMENT: &'static str = "horizontal_alignment"
pub const BRUSH: &'static str = "brush"
pub const WRAP: &'static str = "wrap"
pub const MASK_CHAR: &'static str = "mask_char"
pub const FONT_SIZE: &'static str = "font_size"
pub const SHADOW: &'static str = "shadow"
pub const SHADOW_BRUSH: &'static str = "shadow_brush"
pub const SHADOW_DILATION: &'static str = "shadow_dilation"
pub const SHADOW_OFFSET: &'static str = "shadow_offset"
Source§impl FormattedText
impl FormattedText
pub fn nearest_valid_position(&self, start: Position) -> Position
pub fn get_relative_position_x( &self, start: Position, offset: isize, ) -> Position
pub fn get_relative_position_y( &self, start: Position, offset: isize, ) -> Position
pub fn get_line_range(&self, line: usize) -> Range<Position>
pub fn iter_line_ranges_within( &self, range: Range<Position>, ) -> impl Iterator<Item = Range<Position>>
pub fn end_position(&self) -> Position
pub fn position_range_to_char_index_range( &self, range: Range<Position>, ) -> Range<usize>
Sourcepub fn position_to_char_index_unclamped(
&self,
position: Position,
) -> Option<usize>
pub fn position_to_char_index_unclamped( &self, position: Position, ) -> Option<usize>
Maps input Position
to a linear position in character array.
The index returned is the index of the character after the position, which may be
out-of-bounds if thee position is at the end of the text.
You should check the index before trying to use it to fetch data from inner array of characters.
Sourcepub fn position_to_char_index_clamped(
&self,
position: Position,
) -> Option<usize>
pub fn position_to_char_index_clamped( &self, position: Position, ) -> Option<usize>
Maps input Position
to a linear position in character array.
The index returned is usually the index of the character after the position,
but if the position is at the end of a line then return the index of the character before the position.
In other words, the last two positions of each line are mapped to the same character index.
Output index will always be valid for fetching, if the method returned Some(index)
.
The index however cannot be used for text insertion, because it cannot point to a “place after last char”.
Sourcepub fn char_index_to_position(&self, i: usize) -> Option<Position>
pub fn char_index_to_position(&self, i: usize) -> Option<Position>
Maps linear character index (as in string) to its actual location in the text.
pub fn position_to_local( &self, position: Position, ) -> Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>
pub fn local_to_position( &self, point: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>, ) -> Position
pub fn get_glyphs(&self) -> &[TextGlyph]
pub fn get_font(&self) -> Resource<Font> ⓘ
pub fn set_font(&mut self, font: Resource<Font>) -> &mut FormattedText
pub fn font_size(&self) -> &StyledProperty<f32>
pub fn super_sampled_font_size(&self) -> f32
pub fn set_font_size( &mut self, font_size: StyledProperty<f32>, ) -> &mut FormattedText
pub fn get_lines(&self) -> &[TextLine]
pub fn set_vertical_alignment( &mut self, vertical_alignment: VerticalAlignment, ) -> &mut FormattedText
pub fn vertical_alignment(&self) -> VerticalAlignment
pub fn set_horizontal_alignment( &mut self, horizontal_alignment: HorizontalAlignment, ) -> &mut FormattedText
pub fn horizontal_alignment(&self) -> HorizontalAlignment
pub fn set_brush(&mut self, brush: Brush) -> &mut FormattedText
pub fn brush(&self) -> Brush
pub fn set_super_sampling_scale(&mut self, scale: f32) -> &mut FormattedText
pub fn set_constraint( &mut self, constraint: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>, ) -> &mut FormattedText
pub fn get_raw_text(&self) -> &[char]
pub fn text(&self) -> String
pub fn text_range(&self, range: Range<usize>) -> String
pub fn get_range_width<T>(&self, range: T) -> f32where
T: IntoIterator<Item = usize>,
pub fn set_text<P>(&mut self, text: P) -> &mut FormattedText
pub fn set_wrap(&mut self, wrap: WrapMode) -> &mut FormattedText
Sourcepub fn set_shadow(&mut self, shadow: bool) -> &mut FormattedText
pub fn set_shadow(&mut self, shadow: bool) -> &mut FormattedText
Sets whether the shadow enabled or not.
Sourcepub fn set_shadow_brush(&mut self, brush: Brush) -> &mut FormattedText
pub fn set_shadow_brush(&mut self, brush: Brush) -> &mut FormattedText
Sets desired shadow brush. It will be used to render the shadow.
Sourcepub fn set_shadow_dilation(&mut self, thickness: f32) -> &mut FormattedText
pub fn set_shadow_dilation(&mut self, thickness: f32) -> &mut FormattedText
Sets desired shadow dilation in units. Keep in mind that the dilation is absolute, not percentage-based.
Sourcepub fn set_shadow_offset(
&mut self,
offset: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>,
) -> &mut FormattedText
pub fn set_shadow_offset( &mut self, offset: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>, ) -> &mut FormattedText
Sets desired shadow offset in units.
pub fn wrap_mode(&self) -> WrapMode
pub fn insert_char(&mut self, code: char, index: usize) -> &mut FormattedText
pub fn insert_str(&mut self, str: &str, position: usize) -> &mut FormattedText
pub fn remove_range(&mut self, range: Range<usize>) -> &mut FormattedText
pub fn remove_at(&mut self, index: usize) -> &mut FormattedText
pub fn build( &mut self, ) -> Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>
Trait Implementations§
Source§impl Clone for FormattedText
impl Clone for FormattedText
Source§fn clone(&self) -> FormattedText
fn clone(&self) -> FormattedText
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for FormattedText
impl Debug for FormattedText
Source§impl Default for FormattedText
impl Default for FormattedText
Source§fn default() -> FormattedText
fn default() -> FormattedText
Source§impl Reflect for FormattedTextwhere
FormattedText: 'static,
InheritableVariable<Resource<Font>>: Reflect,
InheritableVariable<Vec<char>>: Reflect,
InheritableVariable<VerticalAlignment>: Reflect,
InheritableVariable<HorizontalAlignment>: Reflect,
InheritableVariable<Brush>: Reflect,
InheritableVariable<WrapMode>: Reflect,
InheritableVariable<Option<char>>: Reflect,
InheritableVariable<StyledProperty<f32>>: Reflect,
InheritableVariable<bool>: Reflect,
InheritableVariable<f32>: Reflect,
InheritableVariable<Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>>: Reflect,
impl Reflect for FormattedTextwhere
FormattedText: 'static,
InheritableVariable<Resource<Font>>: Reflect,
InheritableVariable<Vec<char>>: Reflect,
InheritableVariable<VerticalAlignment>: Reflect,
InheritableVariable<HorizontalAlignment>: Reflect,
InheritableVariable<Brush>: Reflect,
InheritableVariable<WrapMode>: Reflect,
InheritableVariable<Option<char>>: Reflect,
InheritableVariable<StyledProperty<f32>>: Reflect,
InheritableVariable<bool>: Reflect,
InheritableVariable<f32>: Reflect,
InheritableVariable<Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>>: Reflect,
fn source_path() -> &'static str
fn type_name(&self) -> &'static str
fn doc(&self) -> &'static str
Source§fn assembly_name(&self) -> &'static str
fn assembly_name(&self) -> &'static str
#[derive(Reflect)]
) to ensure that this method will return correct assembly
name. In other words - there’s no guarantee, that any implementation other than proc-macro
will return a correct name of the assembly. Alternatively, you can use env!("CARGO_PKG_NAME")
as an implementation.Source§fn type_assembly_name() -> &'static str
fn type_assembly_name() -> &'static str
#[derive(Reflect)]
) to ensure that this method will return correct assembly
name. In other words - there’s no guarantee, that any implementation other than proc-macro
will return a correct name of the assembly. Alternatively, you can use env!("CARGO_PKG_NAME")
as an implementation.fn fields_info(&self, func: &mut dyn FnMut(&[FieldInfo<'_, '_>]))
fn into_any(self: Box<FormattedText>) -> Box<dyn Any>
fn set( &mut self, value: Box<dyn Reflect>, ) -> Result<Box<dyn Reflect>, Box<dyn Reflect>>
fn as_any(&self, func: &mut dyn FnMut(&(dyn Any + 'static)))
fn as_any_mut(&mut self, func: &mut dyn FnMut(&mut (dyn Any + 'static)))
fn as_reflect(&self, func: &mut dyn FnMut(&(dyn Reflect + 'static)))
fn as_reflect_mut(&mut self, func: &mut dyn FnMut(&mut (dyn Reflect + 'static)))
fn fields(&self, func: &mut dyn FnMut(&[&(dyn Reflect + 'static)]))
fn fields_mut( &mut self, func: &mut dyn FnMut(&mut [&mut (dyn Reflect + 'static)]), )
fn field( &self, name: &str, func: &mut dyn FnMut(Option<&(dyn Reflect + 'static)>), )
fn field_mut( &mut self, name: &str, func: &mut dyn FnMut(Option<&mut (dyn Reflect + 'static)>), )
Source§fn set_field(
&mut self,
field: &str,
value: Box<dyn Reflect>,
func: &mut dyn FnMut(Result<Box<dyn Reflect>, Box<dyn Reflect>>),
)
fn set_field( &mut self, field: &str, value: Box<dyn Reflect>, func: &mut dyn FnMut(Result<Box<dyn Reflect>, Box<dyn Reflect>>), )
#[reflect(setter = ..)]
or falls back to
Reflect::field_mut
fn as_array(&self, func: &mut dyn FnMut(Option<&(dyn ReflectArray + 'static)>))
fn as_array_mut( &mut self, func: &mut dyn FnMut(Option<&mut (dyn ReflectArray + 'static)>), )
fn as_list(&self, func: &mut dyn FnMut(Option<&(dyn ReflectList + 'static)>))
fn as_list_mut( &mut self, func: &mut dyn FnMut(Option<&mut (dyn ReflectList + 'static)>), )
fn as_inheritable_variable( &self, func: &mut dyn FnMut(Option<&(dyn ReflectInheritableVariable + 'static)>), )
fn as_inheritable_variable_mut( &mut self, func: &mut dyn FnMut(Option<&mut (dyn ReflectInheritableVariable + 'static)>), )
fn as_hash_map( &self, func: &mut dyn FnMut(Option<&(dyn ReflectHashMap + 'static)>), )
fn as_hash_map_mut( &mut self, func: &mut dyn FnMut(Option<&mut (dyn ReflectHashMap + 'static)>), )
Source§impl Visit for FormattedTextwhere
InheritableVariable<Resource<Font>>: Visit,
InheritableVariable<Vec<char>>: Visit,
InheritableVariable<VerticalAlignment>: Visit,
InheritableVariable<HorizontalAlignment>: Visit,
InheritableVariable<Brush>: Visit,
InheritableVariable<WrapMode>: Visit,
InheritableVariable<Option<char>>: Visit,
InheritableVariable<StyledProperty<f32>>: Visit,
InheritableVariable<bool>: Visit,
InheritableVariable<f32>: Visit,
InheritableVariable<Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>>: Visit,
impl Visit for FormattedTextwhere
InheritableVariable<Resource<Font>>: Visit,
InheritableVariable<Vec<char>>: Visit,
InheritableVariable<VerticalAlignment>: Visit,
InheritableVariable<HorizontalAlignment>: Visit,
InheritableVariable<Brush>: Visit,
InheritableVariable<WrapMode>: Visit,
InheritableVariable<Option<char>>: Visit,
InheritableVariable<StyledProperty<f32>>: Visit,
InheritableVariable<bool>: Visit,
InheritableVariable<f32>: Visit,
InheritableVariable<Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>>: Visit,
Source§fn visit(&mut self, name: &str, visitor: &mut Visitor) -> Result<(), VisitError>
fn visit(&mut self, name: &str, visitor: &mut Visitor) -> Result<(), VisitError>
Auto Trait Implementations§
impl !Freeze for FormattedText
impl !RefUnwindSafe for FormattedText
impl Send for FormattedText
impl !Sync for FormattedText
impl Unpin for FormattedText
impl !UnwindSafe for FormattedText
Blanket Implementations§
Source§impl<T> AsyncTaskResult for T
impl<T> AsyncTaskResult for T
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
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.Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Any
. Could be used to downcast a trait object
to a particular type.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Any
. Could be used to downcast a trait object
to a particular type.fn into_any(self: Box<T>) -> Box<dyn Any>
Source§impl<T> FieldValue for Twhere
T: 'static,
impl<T> FieldValue for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian()
.Source§impl<T> ReflectBase for Twhere
T: Reflect,
impl<T> ReflectBase for Twhere
T: Reflect,
fn as_any_raw(&self) -> &(dyn Any + 'static)
fn as_any_raw_mut(&mut self) -> &mut (dyn Any + 'static)
Source§impl<T> ResolvePath for Twhere
T: Reflect,
impl<T> ResolvePath for Twhere
T: Reflect,
fn resolve_path<'p>( &self, path: &'p str, func: &mut dyn FnMut(Result<&(dyn Reflect + 'static), ReflectPathError<'p>>), )
fn resolve_path_mut<'p>( &mut self, path: &'p str, func: &mut dyn FnMut(Result<&mut (dyn Reflect + 'static), ReflectPathError<'p>>), )
fn get_resolve_path<'p, T>(
&self,
path: &'p str,
func: &mut dyn FnMut(Result<&T, ReflectPathError<'p>>),
)where
T: Reflect,
fn get_resolve_path_mut<'p, T>(
&mut self,
path: &'p str,
func: &mut dyn FnMut(Result<&mut T, ReflectPathError<'p>>),
)where
T: Reflect,
Source§impl<T> ScriptMessagePayload for T
impl<T> ScriptMessagePayload for T
Source§fn as_any_ref(&self) -> &(dyn Any + 'static)
fn as_any_ref(&self) -> &(dyn Any + 'static)
self
as &dyn Any
Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
self
as &dyn Any
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.