Text

Struct Text 

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

A text element.

text element in SVG.

Implementations§

Source§

impl Text

Source

pub fn id(&self) -> &str

Element’s ID.

Taken from the SVG itself. Isn’t automatically generated. Can be empty.

Source

pub fn rendering_mode(&self) -> TextRendering

Rendering mode.

text-rendering in SVG.

Source

pub fn dx(&self) -> &[f32]

A relative X axis offsets.

One offset for each Unicode codepoint. Aka char in Rust.

Source

pub fn dy(&self) -> &[f32]

A relative Y axis offsets.

One offset for each Unicode codepoint. Aka char in Rust.

Source

pub fn rotate(&self) -> &[f32]

A list of rotation angles.

One angle for each Unicode codepoint. Aka char in Rust.

Source

pub fn writing_mode(&self) -> WritingMode

A writing mode.

Source

pub fn chunks(&self) -> &[TextChunk]

A list of text chunks.

Source

pub fn abs_transform(&self) -> Transform

Element’s absolute transform.

Contains all ancestors transforms excluding element’s transform.

Note that this is not the relative transform present in SVG. The SVG one would be set only on groups.

Source

pub fn bounding_box(&self) -> Rect

Element’s text bounding box.

Text bounding box is special in SVG and doesn’t represent tight bounds of the element’s content. You can find more about it here.

objectBoundingBox in SVG terms. Meaning it doesn’t affected by parent transforms.

Returns None when the text build feature was disabled. This is because we have to perform a text layout before calculating a bounding box.

Source

pub fn abs_bounding_box(&self) -> Rect

Element’s text bounding box in canvas coordinates.

userSpaceOnUse in SVG terms.

Source

pub fn stroke_bounding_box(&self) -> Rect

Element’s object bounding box including stroke.

Similar to bounding_box, but includes stroke.

Will have the same value as bounding_box when path has no stroke.

Source

pub fn abs_stroke_bounding_box(&self) -> Rect

Element’s bounding box including stroke in canvas coordinates.

Source

pub fn flattened(&self) -> &Group

Text converted into paths, ready to render.

Returns None when the text build feature was disabled.

Trait Implementations§

Source§

impl Clone for Text

Source§

fn clone(&self) -> Text

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Text

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Hash for Text

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more

Auto Trait Implementations§

§

impl Freeze for Text

§

impl RefUnwindSafe for Text

§

impl Send for Text

§

impl Sync for Text

§

impl Unpin for Text

§

impl UnwindSafe for Text

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.