pub struct PageFontStats {
pub dominant_em: f32,
pub dominant_line_height: f32,
pub dominant_char_width: f32,
pub body_font_name: String,
}Expand description
Per-page font statistics. Computed in O(n) over the spans.
Fields§
§dominant_em: f32Mode of font_size weighted by character count. The “1 em”
for the page’s body text. Defaults to 12.0 on an empty page.
dominant_line_height: f32Median baseline-to-baseline distance for adjacent same-column
same-font spans. Approximates the page’s set leading. Defaults
to 1.2 × dominant_em when fewer than two same-font spans are
available to derive it.
dominant_char_width: f32Average advance width per character in the dominant font. Used
to convert “N characters wide” thresholds into points. Defaults
to 0.5 × dominant_em (Helvetica’s per-em mean width).
body_font_name: StringIdentifier of the font used by the largest share of characters on the page. Used by region-distinctness heuristics (caption vs body) to detect font-discontinuity boundaries.
Implementations§
Source§impl PageFontStats
impl PageFontStats
Sourcepub fn from_spans(spans: &[TextSpan]) -> Self
pub fn from_spans(spans: &[TextSpan]) -> Self
Compute font statistics from a slice of spans.
Empty input → returns PageFontStats::default.
Trait Implementations§
Source§impl Clone for PageFontStats
impl Clone for PageFontStats
Source§fn clone(&self) -> PageFontStats
fn clone(&self) -> PageFontStats
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PageFontStats
impl Debug for PageFontStats
Source§impl Default for PageFontStats
impl Default for PageFontStats
Source§impl PartialEq for PageFontStats
impl PartialEq for PageFontStats
impl StructuralPartialEq for PageFontStats
Auto Trait Implementations§
impl Freeze for PageFontStats
impl RefUnwindSafe for PageFontStats
impl Send for PageFontStats
impl Sync for PageFontStats
impl Unpin for PageFontStats
impl UnsafeUnpin for PageFontStats
impl UnwindSafe for PageFontStats
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().Source§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
Source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.