Struct smufl::Anchors

source ·
pub struct Anchors {
Show 22 fields pub split_stem_up_se: Option<Coord>, pub split_stem_up_sw: Option<Coord>, pub split_stem_down_ne: Option<Coord>, pub split_stem_down_nw: Option<Coord>, pub stem_up_se: Option<Coord>, pub stem_down_nw: Option<Coord>, pub stem_up_nw: Option<Coord>, pub stem_down_sw: Option<Coord>, pub nominal_width: Option<Coord>, pub numeral_top: Option<Coord>, pub numeral_bottom: Option<Coord>, pub cut_out_ne: Option<Coord>, pub cut_out_se: Option<Coord>, pub cut_out_sw: Option<Coord>, pub cut_out_nw: Option<Coord>, pub grace_note_slash_sw: Option<Coord>, pub grace_note_slash_ne: Option<Coord>, pub grace_note_slash_nw: Option<Coord>, pub grace_note_slash_se: Option<Coord>, pub repeat_offset: Option<Coord>, pub notehead_origin: Option<Coord>, pub optical_center: Option<Coord>,
}
Expand description

Anchor data for glyphs.

See the SMuFL documentation.

Fields§

§split_stem_up_se: Option<Coord>

The exact position at which the bottom right-hand (south-east) corner of an angled upward-pointing stem connecting the right-hand side of a notehead to a vertical stem to its left should start, relative to the glyph origin, expressed as Cartesian coordinates in staff spaces.

§split_stem_up_sw: Option<Coord>

The exact position at which the bottom left-hand (south-west) corner of an angled upward-pointing stem connecting the left-hand side of a notehead to a vertical stem to its right should start, relative to the glyph origin, expressed as Cartesian coordinates in staff spaces.

§split_stem_down_ne: Option<Coord>

The exact position at which the top right-hand (north-east) corner of an angled downward-pointing stem connecting the right-hand side of a notehead to a vertical stem to its left should start, relative to the glyph origin, expressed as Cartesian coordinates in staff spaces.

§split_stem_down_nw: Option<Coord>

The exact position at which the top left-hand (north-west) corner of an angled downward-pointing stem connecting the left-hand side of a notehead to a vertical stem to its right should start, relative to the glyph origin, expressed as Cartesian coordinates in staff spaces.

§stem_up_se: Option<Coord>

The exact position at which the bottom right-hand (south-east) corner of an upward-pointing stem rectangle should start, relative to the glyph origin, expressed as Cartesian coordinates in staff spaces.

§stem_down_nw: Option<Coord>

The exact position at which the top left-hand (north-west) corner of a downward-pointing stem rectangle should start, relative to the glyph origin, expressed as Cartesian coordinates in staff spaces.1


  1. It is typical for noteheads and flags to be drawn using font glyphs, while stems themselves are drawn using primitive lines or rectangles. Flag glyphs in SMuFL-compliant fonts are registered such that y=0 represents the end of a stem drawn at its normal length, i.e. typically 3.5 staff spaces, so for simple drawing, any flag can be drawn at the same position relative to the stem and give the correct visual stem length. Modern drawing APIs typically provide sub-pixel RGB anti-aliasing for font glyphs, but may only provide grayscale anti-aliasing for primitive shapes. If the stem is drawn at its normal length with a flag glyph continuing beyond the end of the stem, there may be a poor visual appearance resulting from the primitive stem using standard anti-aliasing and the flag glyph using sub-pixel anti-aliasing. Therefore, it is recommended to extend the stem by the additional height of the flag such that the primitive stem stops at the end (or just short of the end) of the flag. Because the amount by which the stem should be extended is highly dependent on the design of the flag in a particular font, this value should be specified for each flag glyph in the metadata JSON file. 

§stem_up_nw: Option<Coord>

The amount by which an up-stem should be lengthened from its nominal unmodified length in order to ensure a good connection with a flag, in spaces.1

§stem_down_sw: Option<Coord>

The amount by which a down-stem should be lengthened from its nominal unmodified length in order to ensure a good connection with a flag, in spaces.

§nominal_width: Option<Coord>

The width in staff spaces of a given glyph that should be used for e.g. positioning leger lines correctly.2

§numeral_top: Option<Coord>

The position in staff spaces that should be used to position numerals relative to clefs with ligated numbers where those numbers hang from the bottom of the clef, corresponding horizontally to the center of the numeral’s bounding box.1


  1. It is typical for noteheads and flags to be drawn using font glyphs, while stems themselves are drawn using primitive lines or rectangles. Flag glyphs in SMuFL-compliant fonts are registered such that y=0 represents the end of a stem drawn at its normal length, i.e. typically 3.5 staff spaces, so for simple drawing, any flag can be drawn at the same position relative to the stem and give the correct visual stem length. Modern drawing APIs typically provide sub-pixel RGB anti-aliasing for font glyphs, but may only provide grayscale anti-aliasing for primitive shapes. If the stem is drawn at its normal length with a flag glyph continuing beyond the end of the stem, there may be a poor visual appearance resulting from the primitive stem using standard anti-aliasing and the flag glyph using sub-pixel anti-aliasing. Therefore, it is recommended to extend the stem by the additional height of the flag such that the primitive stem stops at the end (or just short of the end) of the flag. Because the amount by which the stem should be extended is highly dependent on the design of the flag in a particular font, this value should be specified for each flag glyph in the metadata JSON file. 

§numeral_bottom: Option<Coord>

The position in staff spaces that should be used to position numerals relative to clefs with ligatured numbers where those numbers sit on the baseline or at the north-east corner of the G clef, corresponding horizontally to the center of the numeral’s bounding box.

§cut_out_ne: Option<Coord>

The Cartesian coordinates in staff spaces of the bottom left corner of a nominal rectangle that intersects the top right corner of the glyph’s bounding box. This rectangle, together with those in the other four corners of the glyph’s bounding box, can be cut out to produce a more detailed bounding box (of abutting rectangles), useful for kerning or interlocking symbols such as accidentals.

§cut_out_se: Option<Coord>

The Cartesian coordinates in staff spaces of the top left corner of a nominal rectangle that intersects the bottom right corner of the glyph’s bounding box.

§cut_out_sw: Option<Coord>

The Cartesian coordinates in staff spaces of the top right corner of a nominal rectangle that intersects the bottom left corner of the glyph’s bounding box.

§cut_out_nw: Option<Coord>

The Cartesian coordinates in staff spaces of the bottom right corner of a nominal rectangle that intersects the top left corner of the glyph’s bounding box.

§grace_note_slash_sw: Option<Coord>

The Cartesian coordinates in staff spaces of the position at which the glyph graceNoteSlashStemUp should be positioned relative to the stem-up flag of an unbeamed grace note; alternatively, the bottom left corner of a diagonal line drawn instead of using the above glyph.

§grace_note_slash_ne: Option<Coord>

The Cartesian coordinates in staff spaces of the top right corner of a diagonal line drawn instead of using the glyph graceNoteSlashStemUp for a stem-up flag of an unbeamed grace note.

§grace_note_slash_nw: Option<Coord>

The Cartesian coordinates in staff spaces of the position at which the glyph graceNoteSlashStemDown should be positioned relative to the stem-down flag of an unbeamed grace note; alternatively, the top left corner of a diagonal line drawn instead of using the above glyph.

§grace_note_slash_se: Option<Coord>

The Cartesian coordinates in staff spaces of the bottom right corner of a diagonal line drawn instead of using the glyph graceNoteSlashStemDown for a stem-down flag of an unbeamed grace note.

§repeat_offset: Option<Coord>

The Cartesian coordinates in staff spaces of the horizontal position at which a glyph repeats, i.e. the position at which the same glyph or another of the same group should be positioned to ensure correct tessellation. This is used for e.g. multi-segment lines and the component glyphs that make up trills and mordents.

§notehead_origin: Option<Coord>

The Cartesian coordinates in staff spaces of the left-hand edge of a notehead with a non-zero left-hand side bearing (e.g. a double whole, or breve, notehead with two vertical lines at each side), to assist in the correct horizontal alignment of these noteheads with other noteheads with zero-width left-side bearings.

§optical_center: Option<Coord>

The Cartesian coordinates in staff spaces of the optical center of the glyph, to assist in the correct horizontal alignment of the glyph relative to a notehead or stem. Currently recommended for use with glyphs in the Dynamics range.

Trait Implementations§

source§

impl Clone for Anchors

source§

fn clone(&self) -> Anchors

Returns a copy 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 Anchors

source§

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

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

impl Default for Anchors

source§

fn default() -> Anchors

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

impl<'de> Deserialize<'de> for Anchors

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<Anchors> for Anchors

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for Anchors

source§

impl StructuralPartialEq for Anchors

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · 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 Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,