pub struct Font {
pub name: Option<String>,
pub size: Option<f64>,
pub bold: Option<bool>,
pub italic: Option<bool>,
pub underline: Option<MsoTextUnderlineType>,
pub color: Option<RgbColor>,
pub strikethrough: Option<bool>,
pub subscript: Option<bool>,
pub superscript: Option<bool>,
pub language_id: Option<String>,
pub fill: Option<FillFormat>,
pub hyperlink: Option<Hyperlink>,
}Expand description
Character formatting properties for a text run.
Corresponds to the <a:rPr> element in OOXML. None values indicate
that the property should be inherited from the style hierarchy.
Fields§
§name: Option<String>Typeface name (e.g. "Calibri").
size: Option<f64>Font size in points (e.g. 18.0 for 18pt).
bold: Option<bool>Bold flag.
italic: Option<bool>Italic flag.
underline: Option<MsoTextUnderlineType>Underline type. None means inherited; Some(MsoTextUnderlineType::None) means
explicitly no underline; Some(MsoTextUnderlineType::SingleLine) for single, etc.
color: Option<RgbColor>Font color.
strikethrough: Option<bool>Strikethrough flag. When true, a single strike line is rendered.
subscript: Option<bool>Subscript flag. When true, text is rendered as subscript (baseline -25000).
superscript: Option<bool>Superscript flag. When true, text is rendered as superscript (baseline +30000).
language_id: Option<String>Language identifier (e.g. "en-US", "ja-JP").
fill: Option<FillFormat>Fill format for the font (e.g. solid fill for text color via fill).
hyperlink: Option<Hyperlink>Hyperlink associated with this font (alternative to Run-level hyperlink).
Implementations§
Source§impl Font
impl Font
Sourcepub fn set_size(&mut self, size: f64) -> Result<(), PptxError>
pub fn set_size(&mut self, size: f64) -> Result<(), PptxError>
Set the font size in points.
size must be greater than 0.0.
§Errors
Returns Err(PptxError::InvalidValue) if the size is not positive.
Sourcepub fn color_type(&self) -> Option<MsoColorType>
pub fn color_type(&self) -> Option<MsoColorType>
Return the color type of this font, if a color or fill with a solid color is set.
When fill is a SolidFill, the color type is derived from its ColorFormat.
When only a simple color (RGB) is set, returns MsoColorType::Rgb.
Returns None if no color information is present.
Sourcepub fn to_xml_string(&self) -> String
pub fn to_xml_string(&self) -> String
Generate the <a:rPr> XML element string.
If no properties are set, produces <a:rPr lang="en-US" dirty="0"/>.
§Panics
Panics if writing to a String fails (should never happen).