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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more