pub struct Text { /* private fields */ }Expand description
A text annotation placed at a specific point with configurable presentation.
Implementations§
Source§impl Text
impl Text
Sourcepub fn new(
text: &str,
origin: Point,
layer: Layer,
datatype: DataType,
magnification: f64,
angle: f64,
x_reflection: bool,
vertical_presentation: VerticalPresentation,
horizontal_presentation: HorizontalPresentation,
) -> Self
pub fn new( text: &str, origin: Point, layer: Layer, datatype: DataType, magnification: f64, angle: f64, x_reflection: bool, vertical_presentation: VerticalPresentation, horizontal_presentation: HorizontalPresentation, ) -> Self
Creates a new text element with the given properties.
Sourcepub fn set_text(self, text: String) -> Self
pub fn set_text(self, text: String) -> Self
Sets the text string and returns the modified value.
Sourcepub fn set_origin(self, origin: Point) -> Self
pub fn set_origin(self, origin: Point) -> Self
Sets the origin point and returns the modified value.
Sourcepub fn set_layer(self, layer: Layer) -> Self
pub fn set_layer(self, layer: Layer) -> Self
Sets the layer number and returns the modified value.
Sourcepub fn remap_layers(&mut self, mapping: &LayerMapping)
pub fn remap_layers(&mut self, mapping: &LayerMapping)
Remaps the layer and data type using the given mapping. If the current (layer, datatype) pair is found in the mapping, it is replaced.
Sourcepub const fn magnification(&self) -> f64
pub const fn magnification(&self) -> f64
Returns the magnification factor.
Sourcepub fn set_magnification(self, magnification: f64) -> Self
pub fn set_magnification(self, magnification: f64) -> Self
Sets the magnification factor and returns the modified value.
Sourcepub fn set_angle(self, angle: f64) -> Self
pub fn set_angle(self, angle: f64) -> Self
Sets the rotation angle and returns the modified value.
Sourcepub const fn x_reflection(&self) -> bool
pub const fn x_reflection(&self) -> bool
Returns whether x-axis reflection is enabled.
Sourcepub fn set_x_reflection(self, x_reflection: bool) -> Self
pub fn set_x_reflection(self, x_reflection: bool) -> Self
Sets x-axis reflection and returns the modified value.
Sourcepub const fn vertical_presentation(&self) -> &VerticalPresentation
pub const fn vertical_presentation(&self) -> &VerticalPresentation
Returns the vertical text presentation alignment.
Sourcepub fn set_vertical_presentation(
self,
vertical_presentation: VerticalPresentation,
) -> Self
pub fn set_vertical_presentation( self, vertical_presentation: VerticalPresentation, ) -> Self
Sets the vertical presentation alignment and returns the modified value.
Sourcepub const fn horizontal_presentation(&self) -> &HorizontalPresentation
pub const fn horizontal_presentation(&self) -> &HorizontalPresentation
Returns the horizontal text presentation alignment.
Sourcepub fn set_horizontal_presentation(
self,
horizontal_presentation: HorizontalPresentation,
) -> Self
pub fn set_horizontal_presentation( self, horizontal_presentation: HorizontalPresentation, ) -> Self
Sets the horizontal presentation alignment and returns the modified value.
Sourcepub fn to_integer_unit(self) -> Self
pub fn to_integer_unit(self) -> Self
Converts origin to integer units.
Sourcepub fn to_float_unit(self) -> Self
pub fn to_float_unit(self) -> Self
Converts origin to float units.
Trait Implementations§
Source§impl Dimensions for Text
impl Dimensions for Text
Source§fn bounding_box(&self) -> (Point, Point)
fn bounding_box(&self) -> (Point, Point)
(min_point, max_point).Source§impl Transformable for Text
impl Transformable for Text
Source§fn transform_impl(self, transformation: &Transformation) -> Self
fn transform_impl(self, transformation: &Transformation) -> Self
Source§fn transform(self, transformation: impl Into<Transformation>) -> Self
fn transform(self, transformation: impl Into<Transformation>) -> Self
Source§fn rotate(self, angle: AngleInRadians, centre: Point) -> Self
fn rotate(self, angle: AngleInRadians, centre: Point) -> Self
Source§fn scale(self, factor: f64, centre: Point) -> Self
fn scale(self, factor: f64, centre: Point) -> Self
impl StructuralPartialEq for Text
Auto Trait Implementations§
impl Freeze for Text
impl RefUnwindSafe for Text
impl Send for Text
impl Sync for Text
impl Unpin for Text
impl UnsafeUnpin for Text
impl UnwindSafe for Text
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more