Skip to main content

TextStyle

Struct TextStyle 

Source
pub struct TextStyle {
    pub absolute_x: Option<StyleValue>,
    pub absolute_y: Option<StyleValue>,
    pub relative_x: Option<StyleValue>,
    pub relative_y: Option<StyleValue>,
    pub font_family: Option<Vec<String>>,
    pub font_size: Option<StyleValue>,
    pub color: Option<String>,
    /* private fields */
}
Expand description

Where a piece of text stands and how it is drawn: music21’s TextStyle, the part of it MusicXML’s print style, alignment and justification say.

Fields§

§absolute_x: Option<StyleValue>

Across from where it is placed, in tenths: absoluteX, MusicXML’s default-x.

§absolute_y: Option<StyleValue>

Up from where it is placed: absoluteY, default-y.

§relative_x: Option<StyleValue>

Across from its default place: relativeX, relative-x.

§relative_y: Option<StyleValue>

Up from its default place: relativeY, relative-y.

§font_family: Option<Vec<String>>

The fonts it may be set in, first choice first: fontFamily.

§font_size: Option<StyleValue>

Its size, in points or as a CSS size: fontSize.

§color: Option<String>

Its colour, as written: color.

Implementations§

Source§

impl TextStyle

Source

pub fn font_style(&self) -> Option<&str>

italic, normal, bold or bolditalic: music21’s fontStyle.

Source

pub fn set_font_style(&mut self, value: Option<&str>) -> Result<()>

Sets the font style, read without regard to case.

§Errors

A style music21 does not name.

Source

pub fn font_weight(&self) -> Option<&str>

normal or bold: music21’s fontWeight.

Source

pub fn set_font_weight(&mut self, value: Option<&str>) -> Result<()>

Sets the font weight, read without regard to case.

§Errors

A weight music21 does not name.

Source

pub fn justify(&self) -> Option<&str>

left, center, right or full: music21’s justify.

Source

pub fn set_justify(&mut self, value: Option<&str>) -> Result<()>

Sets the justification, read without regard to case.

§Errors

A justification music21 does not name.

Source

pub fn align_horizontal(&self) -> Option<&str>

left, right or center: music21’s alignHorizontal, MusicXML’s halign.

Source

pub fn set_align_horizontal(&mut self, value: Option<&str>) -> Result<()>

Sets the horizontal alignment.

§Errors

An alignment music21 does not name.

Source

pub fn align_vertical(&self) -> Option<&str>

top, middle, bottom or baseline: music21’s alignVertical, MusicXML’s valign.

Source

pub fn set_align_vertical(&mut self, value: Option<&str>) -> Result<()>

Sets the vertical alignment.

§Errors

An alignment music21 does not name.

Trait Implementations§

Source§

impl Clone for TextStyle

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for TextStyle

Source§

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

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

impl Default for TextStyle

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for TextStyle

Available on crate feature serde only.
Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for TextStyle

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for TextStyle

Available on crate feature serde only.
Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for TextStyle

Auto Trait Implementations§

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.