pub struct FontStats {Show 14 fields
pub font_size_counts: BTreeMap<String, usize>,
pub font_family_counts: BTreeMap<String, usize>,
pub bold_counts: BoldCounts,
pub italic_counts: ItalicCounts,
pub most_common_font_size: f32,
pub most_common_font_family: String,
pub all_font_sizes: Vec<f32>,
pub top_k_dominant_sizes: Vec<f32>,
pub distinct_size_frequency_profile: Vec<DistinctSizeFrequency>,
pub size_gap_first_to_second: f32,
pub bold_density_per_size: BTreeMap<String, f32>,
pub mean_font_size: f32,
pub median_font_size: f32,
pub variance_font_size: f32,
}Expand description
Document-level font statistics produced by the analytics pre-pass. All fields are descriptive primitives — they expose font-distribution shape for the corpus-analysis lab and for downstream rules. Classification decisions (heading vs body, structural significance) belong to consumer rules, not to this type.
Fields§
§font_size_counts: BTreeMap<String, usize>Element-count histogram keyed by string-formatted font size (see
size_key() helper). Deterministic key ordering via BTreeMap.
font_family_counts: BTreeMap<String, usize>Element-count histogram keyed by font family name. Deterministic key
ordering via BTreeMap.
bold_counts: BoldCountsElement counts split by bold/non-bold.
italic_counts: ItalicCountsElement counts split by italic/non-italic.
most_common_font_size: f32Single canonical body-size signal: the font size with the largest element count. Deterministic tiebreaker: larger size wins on equal count. Defaults to 12.0 if no elements observed.
most_common_font_family: StringSingle canonical body-family signal: the font family with the largest
element count. Deterministic tiebreaker: lexicographically smaller
family name wins on equal count. Defaults to "unknown" if no
elements observed.
all_font_sizes: Vec<f32>Sorted, deduplicated list of every distinct font size seen (ascending).
top_k_dominant_sizes: Vec<f32>Top K font sizes by element count. Descriptive primitive only. Dominant sizes are typically body text; rare/non-dominant sizes are NOT necessarily structurally meaningful (e.g., a rare large red callout is not a heading). Consumer rules combine this with isolation, position, and other signals before drawing structural conclusions.
distinct_size_frequency_profile: Vec<DistinctSizeFrequency>Font sizes that account for at least config.distinct_size_min_fraction
of elements. Descriptive primitive — populates corpus analysis and
downstream rules. The number of qualifying sizes is suggestive of
effective font diversity but is NOT a heading-depth classifier (rare
sizes are often inline emphasis, formula symbols, or non-structural
callouts).
size_gap_first_to_second: f32Absolute size difference between the two most common sizes (by element count). A small gap suggests low size-based separability between dominant content streams; a large gap suggests one stream is markedly larger than the other. Not a structural classifier on its own.
bold_density_per_size: BTreeMap<String, f32>Per-size fraction of elements that are bold. Identifies sizes where bold occurs disproportionately, candidate for the “bold heading size” signal. Combined with isolation and position by consumer rules.
mean_font_size: f32Mean of font sizes weighted by element count.
median_font_size: f32Median of font sizes weighted by element count.
variance_font_size: f32Variance of font sizes weighted by element count.