use super::*;
impl MathIdentifier {
pub fn new<S>(text: S, variant: FontVariant) -> Self
where
S: ToString,
{
Self { identifier: text.to_string(), variant }
}
pub fn normal<S>(text: S) -> Self
where
S: ToString,
{
Self { identifier: text.to_string(), variant: FontVariant::Normal }
}
pub fn italic<S>(text: S) -> Self
where
S: ToString,
{
Self { identifier: text.to_string(), variant: FontVariant::Italic }
}
pub fn get_variant(&self) -> FontVariant {
self.variant
}
pub fn get_identifier(&self) -> &str {
&self.identifier
}
}
impl MathText {
pub fn text<S>(text: S) -> Self
where
S: ToString,
{
Self { text: text.to_string(), is_string: false }
}
pub fn string<S>(text: S) -> Self
where
S: ToString,
{
Self { text: text.to_string(), is_string: true }
}
}
impl MathML {
pub fn identifier<S>(text: S) -> Self
where
S: ToString,
{
MathIdentifier::italic(text).into()
}
pub fn text<S>(text: S) -> Self
where
S: ToString,
{
MathText::text(text).into()
}
pub fn string<S>(text: S) -> Self
where
S: ToString,
{
MathText::string(text).into()
}
}