pub struct Text { /* private fields */ }
Expand description
A text element.
text
element in SVG.
Implementations§
source§impl Text
impl Text
sourcepub fn id(&self) -> &str
pub fn id(&self) -> &str
Element’s ID.
Taken from the SVG itself. Isn’t automatically generated. Can be empty.
sourcepub fn rendering_mode(&self) -> TextRendering
pub fn rendering_mode(&self) -> TextRendering
Rendering mode.
text-rendering
in SVG.
sourcepub fn dx(&self) -> &[f32]
pub fn dx(&self) -> &[f32]
A relative X axis offsets.
One offset for each Unicode codepoint. Aka char
in Rust.
sourcepub fn dy(&self) -> &[f32]
pub fn dy(&self) -> &[f32]
A relative Y axis offsets.
One offset for each Unicode codepoint. Aka char
in Rust.
sourcepub fn rotate(&self) -> &[f32]
pub fn rotate(&self) -> &[f32]
A list of rotation angles.
One angle for each Unicode codepoint. Aka char
in Rust.
sourcepub fn writing_mode(&self) -> WritingMode
pub fn writing_mode(&self) -> WritingMode
A writing mode.
sourcepub fn abs_transform(&self) -> Transform
pub fn abs_transform(&self) -> Transform
Element’s absolute transform.
Contains all ancestors transforms including elements’s transform.
Note that this is not the relative transform present in SVG. The SVG one would be set only on groups.
sourcepub fn bounding_box(&self) -> Rect
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.
sourcepub fn abs_bounding_box(&self) -> Rect
pub fn abs_bounding_box(&self) -> Rect
Element’s text bounding box in canvas coordinates.
userSpaceOnUse
in SVG terms.
sourcepub fn stroke_bounding_box(&self) -> Rect
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.
sourcepub fn abs_stroke_bounding_box(&self) -> Rect
pub fn abs_stroke_bounding_box(&self) -> Rect
Element’s bounding box including stroke in canvas coordinates.