Struct tengwar::characters::glyph::Glyph

source ·
pub struct Glyph<P: Policy = Standard> {
Show 18 fields pub base: Option<char>, pub tehta: Option<Tehta>, pub tehta_alt: bool, pub tehta_first: bool, pub tehta_hidden: bool, pub vowels: VowelStyle, pub rince: bool, pub rince_final: bool, pub nasal: bool, pub labial: bool, pub palatal: bool, pub nuquerna: bool, pub long_cons: bool, pub dot_inner: bool, pub dot_under: bool, pub ligate_short: bool, pub ligate_zwj: u8, pub _p: PhantomData<P>,
}
Expand description

A single base tengwa, and all of its modifications. This includes the tehta marking, flags for additional diacritics, flags for consonant and vowel length, and information on vowel and ligature behavior.

Fields§

§base: Option<char>

A base character.

§tehta: Option<Tehta>

The primary diacritical marking over the base character.

§tehta_alt: bool

Indicates whether the Tehta should use its alternate “long” form.

§tehta_first: bool

Indicates whether a tehta with an extended carrier should be printed before the glyph.

§tehta_hidden: bool§vowels: VowelStyle

The pattern of behavior followed by the tehta, if there is one.

§rince: bool

Indicates whether the glyph has a sa-rincë attached.

§rince_final: bool

Indicates whether the glyph may use a more ornate rincë. This will have no effect if rince is not true.

§nasal: bool

A nasalized consonant is typically represented by an overbar.

§labial: bool

A labialized consonant is represented by an additional diacritic.

§palatal: bool

A palatalized vowel is represented by an additional diacritic.

§nuquerna: bool

Try to use a “nuquerna” variant of the base character.

§long_cons: bool

A lengthened consonant is typically represented by an underbar.

§dot_inner: bool

Indicates whether a dot should be placed inside the base character. This is occasionally used, when vowel tehtar may be elided, to indicate the explicit lack of a vowel.

§dot_under: bool

Indicates whether a dot should be placed below the base character. This is used in many English modes to indicate a “silent” E.

§ligate_short: bool

Indicates that this glyph should use the ligating short carrier, if it is applicable.

§ligate_zwj: u8

Indicates whether this glyph should try to use ZWJ ligation.

§_p: PhantomData<P>

Phantom field to carry the Policy parameter.

Implementations§

source§

impl<P: Policy> Glyph<P>

Public: Construction and modification.

source

pub const fn new() -> Self

Define a new empty glyph.

source

pub const fn new_both(base: char, tehta: Tehta) -> Self

Define a glyph with both a base char and a Tehta.

source

pub const fn new_base(base: char) -> Self

Define a glyph with only a base char.

source

pub const fn new_tehta(tehta: Tehta) -> Self

Define a glyph with only a Tehta.

source

pub const fn new_tehta_alt(tehta: Tehta) -> Self

Define a glyph with only an alternate Tehta.

source

pub const fn new_vowel(tehta: Tehta, alt: bool) -> Self

Define a glyph with only a Tehta. It may be marked as Alternate.

source

pub const fn change_policy<Q: Policy>(&self) -> Glyph<Q>

Switch the glyph to use a different Policy implementor.

source

pub const fn with_tengwa(self, tengwa: char) -> Self

Change the base char.

source

pub const fn with_tehta(self, tehta: Tehta) -> Self

Change the Tehta to be used.

source

pub const fn with_tehta_alt(self, enabled: bool) -> Self

Mark this glyph as using the alternate form of its Tehta.

source

pub const fn with_underline(self, enabled: bool) -> Self

Mark this glyph as being underlined.

source

pub const fn with_labial(self, enabled: bool) -> Self

Mark this glyph as being labialized. It will be rendered with a wavy overbar.

source

pub const fn with_nasal(self, enabled: bool) -> Self

Mark this glyph as being nasalized. It will be rendered overlined.

source

pub const fn with_palatal(self, enabled: bool) -> Self

Mark this glyph as being palatalized. It will be rendered with a pair of dots below it.

source

pub const fn with_rince(self, enabled: bool) -> Self

Mark this glyph as being followed by a sibilant. It may be rendered with a flourish.

source

pub fn integrate_consonant(&mut self, other: Self)

Update this glyph with the consonant attributes of another glyph.

source

pub fn integrate_vowel(&mut self, other: Self)

Update this glyph with the vowel attributes of another glyph.

source

pub fn replace_base(&mut self, old: char, new: char) -> bool

If the base char matches a specific value, change it to another.

source

pub fn replace_tehta(&mut self, old: Tehta, new: Tehta) -> bool

If the Tehta matches a specific value, change it to another.

source

pub fn set_alt_a(&mut self) -> bool

Switch the A-tehta to its alternate form.

source§

impl<P: Policy> Glyph<P>

Public: Information and logic.

source

pub fn base_nuq(&self) -> char

Determine the base character to be used for this glyph. If one is not set, an appropriate “carrier” mark will be returned instead.

source

pub const fn base(&self) -> char

Determine the base character to be used for this glyph. If one is not set, an appropriate “carrier” mark will be returned instead.

This method does not apply a Nuquerna variant.

source

pub const fn tengwa(&self) -> Option<Tengwa<'static>>

Return a Tengwa representing the base char, if there is one.

source

pub fn parts(&self) -> Parts<'static>

Return Parts representing the final visual composition of the glyph.

source

pub fn can_take_rince(&self) -> bool

Determine whether a rincë may be added to this glyph. Returns false if a rincë is already set.

source

pub fn ignoring_nuquerna(&self) -> bool

Determine whether the base character has a nuquerna variant, but is set to not use it.

source

pub const fn is_empty(&self) -> bool

Determine whether is glyph has no basic forms at all.

source

pub const fn is_short_carrier(&self) -> bool

Determine whether this glyph will use Telco as its base.

source

pub fn ligates_with<Q: Policy>(&self, other: &Glyph<Q>) -> bool

Determine whether the base char of this glyph is permitted to ligate with another glyph using a zero-width joiner.

source

pub fn ligates_with_ara(&self) -> bool

Determine whether the base char of this glyph is permitted to ligate with Ára using a zero-width joiner.

source

pub fn telco_ligates(&self) -> bool

Determine whether Telco is permitted to ligate with the base char of this glyph using a zero-width joiner.

source

pub fn choose_rince(&self) -> Rince

Choose the correct form of Sa-Rincë.

source

pub fn carries_tehta(&self) -> bool

source

pub fn tehta_char(&self) -> Option<TehtaChar>

Resolve the position and identity of the tehta.

source

pub fn tehta_is_a(&self) -> bool

Return true if the glyph carries the A-tehta.

Trait Implementations§

source§

impl<P: Clone + Policy> Clone for Glyph<P>

source§

fn clone(&self) -> Glyph<P>

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<P: Debug + Policy> Debug for Glyph<P>

source§

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

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

impl<P: Default + Policy> Default for Glyph<P>

source§

fn default() -> Glyph<P>

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

impl<P: Policy> Display for Glyph<P>

source§

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

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

impl<P: Policy> From<Tehta> for Glyph<P>

source§

fn from(tehta: Tehta) -> Self

Converts to this type from the input type.
source§

impl<P: Policy> From<Tengwa<'_>> for Glyph<P>

source§

fn from(tengwa: Tengwa<'_>) -> Self

Converts to this type from the input type.
source§

impl<P: Policy> From<char> for Glyph<P>

source§

fn from(cons: char) -> Self

Converts to this type from the input type.
source§

impl<P: Copy + Policy> Copy for Glyph<P>

Auto Trait Implementations§

§

impl<P> RefUnwindSafe for Glyph<P>where P: RefUnwindSafe,

§

impl<P> Send for Glyph<P>where P: Send,

§

impl<P> Sync for Glyph<P>where P: Sync,

§

impl<P> Unpin for Glyph<P>where P: Unpin,

§

impl<P> UnwindSafe for Glyph<P>where P: UnwindSafe,

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,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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 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> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. 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.
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.
source§

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

Performs the conversion.