pub struct RichText { /* private fields */ }Expand description
A line of mixed-style text composed of multiple TextSpans.
Each span can have a different font, size, and color. The entire RichText renders as a single line (no word-wrapping).
§Example
use oxidize_pdf::layout::{RichText, TextSpan};
use oxidize_pdf::{Color, Font};
let rich = RichText::new(vec![
TextSpan::new("Total: ", Font::HelveticaBold, 14.0, Color::black()),
TextSpan::new("$1,234.56", Font::Helvetica, 14.0, Color::gray(0.3)),
]);
assert_eq!(rich.spans().len(), 2);
assert!(rich.total_width() > 0.0);Implementations§
Source§impl RichText
impl RichText
Sourcepub fn total_width(&self) -> f64
pub fn total_width(&self) -> f64
Total width of all spans combined.
Sourcepub fn max_font_size(&self) -> f64
pub fn max_font_size(&self) -> f64
Maximum font size across all spans (determines line height).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RichText
impl RefUnwindSafe for RichText
impl Send for RichText
impl Sync for RichText
impl Unpin for RichText
impl UnsafeUnpin for RichText
impl UnwindSafe for RichText
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more