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.
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>
impl<P: Policy> Glyph<P>
Public: Construction and modification.
sourcepub const fn new_tehta_alt(tehta: Tehta) -> Self
pub const fn new_tehta_alt(tehta: Tehta) -> Self
Define a glyph with only an alternate Tehta
.
sourcepub const fn new_vowel(tehta: Tehta, alt: bool) -> Self
pub const fn new_vowel(tehta: Tehta, alt: bool) -> Self
Define a glyph with only a Tehta
. It may be marked as Alternate.
sourcepub const fn change_policy<Q: Policy>(&self) -> Glyph<Q>
pub const fn change_policy<Q: Policy>(&self) -> Glyph<Q>
Switch the glyph to use a different Policy
implementor.
sourcepub const fn with_tengwa(self, tengwa: char) -> Self
pub const fn with_tengwa(self, tengwa: char) -> Self
Change the base char
.
sourcepub const fn with_tehta(self, tehta: Tehta) -> Self
pub const fn with_tehta(self, tehta: Tehta) -> Self
Change the Tehta
to be used.
sourcepub const fn with_tehta_alt(self, enabled: bool) -> Self
pub const fn with_tehta_alt(self, enabled: bool) -> Self
Mark this glyph as using the alternate form of its Tehta
.
sourcepub const fn with_underline(self, enabled: bool) -> Self
pub const fn with_underline(self, enabled: bool) -> Self
Mark this glyph as being underlined.
sourcepub const fn with_labial(self, enabled: bool) -> Self
pub const fn with_labial(self, enabled: bool) -> Self
Mark this glyph as being labialized. It will be rendered with a wavy overbar.
sourcepub const fn with_nasal(self, enabled: bool) -> Self
pub const fn with_nasal(self, enabled: bool) -> Self
Mark this glyph as being nasalized. It will be rendered overlined.
sourcepub const fn with_palatal(self, enabled: bool) -> Self
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.
sourcepub const fn with_rince(self, enabled: bool) -> Self
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.
sourcepub fn integrate_consonant(&mut self, other: Self)
pub fn integrate_consonant(&mut self, other: Self)
Update this glyph with the consonant attributes of another glyph.
sourcepub fn integrate_vowel(&mut self, other: Self)
pub fn integrate_vowel(&mut self, other: Self)
Update this glyph with the vowel attributes of another glyph.
sourcepub fn replace_base(&mut self, old: char, new: char) -> bool
pub fn replace_base(&mut self, old: char, new: char) -> bool
If the base char
matches a specific value, change it to another.
sourcepub fn replace_tehta(&mut self, old: Tehta, new: Tehta) -> bool
pub fn replace_tehta(&mut self, old: Tehta, new: Tehta) -> bool
If the Tehta
matches a specific value, change it to another.
sourcepub fn set_alt_a(&mut self) -> bool
pub fn set_alt_a(&mut self) -> bool
Switch the A-tehta to its alternate form.
source§impl<P: Policy> Glyph<P>
impl<P: Policy> Glyph<P>
Public: Information and logic.
sourcepub fn base_nuq(&self) -> char
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.
sourcepub const fn base(&self) -> char
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.
sourcepub fn parts(&self) -> Parts<'static>
pub fn parts(&self) -> Parts<'static>
Return Parts
representing the final visual composition of the glyph.
sourcepub fn can_take_rince(&self) -> bool
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.
sourcepub fn ignoring_nuquerna(&self) -> bool
pub fn ignoring_nuquerna(&self) -> bool
Determine whether the base character has a nuquerna variant, but is set to not use it.
sourcepub const fn is_short_carrier(&self) -> bool
pub const fn is_short_carrier(&self) -> bool
Determine whether this glyph will use Telco as its base.
sourcepub fn ligates_with<Q: Policy>(&self, other: &Glyph<Q>) -> bool
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.
sourcepub fn ligates_with_ara(&self) -> bool
pub fn ligates_with_ara(&self) -> bool
sourcepub fn telco_ligates(&self) -> bool
pub fn telco_ligates(&self) -> bool
sourcepub fn choose_rince(&self) -> Rince
pub fn choose_rince(&self) -> Rince
Choose the correct form of Sa-Rincë.
pub fn carries_tehta(&self) -> bool
sourcepub fn tehta_char(&self) -> Option<TehtaChar>
pub fn tehta_char(&self) -> Option<TehtaChar>
Resolve the position and identity of the tehta.
sourcepub fn tehta_is_a(&self) -> bool
pub fn tehta_is_a(&self) -> bool
Return true
if the glyph carries the A-tehta.