pub struct PdfStyledString<'a> { /* private fields */ }Expand description
A single styled string in a PdfParagraph.
Implementations§
Source§impl<'a> PdfStyledString<'a>
impl<'a> PdfStyledString<'a>
Sourcepub fn new(text: String, font: &'a PdfFont<'a>, font_size: PdfPoints) -> Self
pub fn new(text: String, font: &'a PdfFont<'a>, font_size: PdfPoints) -> Self
Creates a new PdfStyledString from the given arguments.
Sourcepub fn from_text_object(text_object: &'a PdfPageTextObject<'a>) -> Self
pub fn from_text_object(text_object: &'a PdfPageTextObject<'a>) -> Self
Creates a new PdfStyledString from the given PdfPageTextObject.
Sourcepub fn text(&self) -> &str
pub fn text(&self) -> &str
Returns the text in this PdfStyledString.
Sourcepub fn font(&self) -> &PdfFont<'_>
pub fn font(&self) -> &PdfFont<'_>
Returns the PdfFont used to style this PdfStyledString.
Sourcepub fn font_size(&self) -> PdfPoints
pub fn font_size(&self) -> PdfPoints
Returns the font size used to style this PdfStyledString.
Sourcepub fn does_match_string_styling(&self, other: &PdfStyledString<'_>) -> bool
pub fn does_match_string_styling(&self, other: &PdfStyledString<'_>) -> bool
Returns true if the font and font size of this PdfStyledString is the same as
that of the given string.
Sourcepub fn does_match_object_styling(&self, other: &PdfPageTextObject<'_>) -> bool
pub fn does_match_object_styling(&self, other: &PdfPageTextObject<'_>) -> bool
Returns true if the font and font size of this PdfStyledString is the same as
that of the given PdfPageTextObject.
Sourcepub fn is_bold(&self) -> bool
pub fn is_bold(&self) -> bool
Returns true if this styled string’s font is bold.
Checks the font descriptor’s force-bold flag, the font weight (>= 700), and the font family name for “bold” substring.
Sourcepub fn is_italic(&self) -> bool
pub fn is_italic(&self) -> bool
Returns true if this styled string’s font is italic.
Checks the font descriptor’s italic flag and the font family name for “italic” or “oblique” substrings.
Sourcepub fn is_monospace(&self) -> bool
pub fn is_monospace(&self) -> bool
Returns true if this styled string’s font is monospace.
Checks the font descriptor’s fixed-pitch flag and the font family name against common monospace font patterns.
Sourcepub fn as_text_object(
&self,
document: &PdfDocument<'a>,
) -> Result<PdfPageTextObject<'a>, PdfiumError>
pub fn as_text_object( &self, document: &PdfDocument<'a>, ) -> Result<PdfPageTextObject<'a>, PdfiumError>
Creates a new PdfPageTextObject from this styled string, using the Pdfium bindings in the given document.
Auto Trait Implementations§
impl<'a> !Freeze for PdfStyledString<'a>
impl<'a> !RefUnwindSafe for PdfStyledString<'a>
impl<'a> !Send for PdfStyledString<'a>
impl<'a> !Sync for PdfStyledString<'a>
impl<'a> !UnwindSafe for PdfStyledString<'a>
impl<'a> Unpin for PdfStyledString<'a>
impl<'a> UnsafeUnpin for PdfStyledString<'a>
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
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> ⓘ
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> ⓘ
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