pub struct TextLine {
pub bbox: BoundingBox,
pub index: Option<u32>,
pub level: Option<String>,
pub font_size: f64,
pub base_line: f64,
pub slant_degree: f64,
pub is_hidden_text: bool,
pub text_chunks: Vec<TextChunk>,
pub is_line_start: bool,
pub is_line_end: bool,
pub is_list_line: bool,
pub connected_line_art_label: Option<LineArtChunk>,
}Expand description
A horizontal group of TextChunks sharing a baseline.
Fields§
§bbox: BoundingBoxBounding box
index: Option<u32>Global index
level: Option<String>Nesting level
font_size: f64Dominant font size
base_line: f64Baseline Y coordinate
slant_degree: f64Slant degree
Whether all text is hidden
text_chunks: Vec<TextChunk>Component text chunks
is_line_start: boolWhether this line starts a new paragraph
is_line_end: boolWhether this line ends a paragraph
is_list_line: boolWhether this line is part of a list
connected_line_art_label: Option<LineArtChunk>Connected line art (bullet marker)
Implementations§
Source§impl TextLine
impl TextLine
Sourcepub fn value(&self) -> String
pub fn value(&self) -> String
Concatenated text value of all chunks, inserting spaces between chunks when a horizontal gap indicates a word boundary.
Whitespace-only chunks are skipped (matching the reference processTextLines
which skips isWhiteSpaceChunk() chunks); word spaces are re-detected
from bounding-box gaps via needs_space().
For letter-spaced text (≥70% of chunks are single-character), an adaptive
gap threshold based on the median inter-chunk gap is used instead of the
fixed fontSize * 0.17 rule. This correctly collapses text like
"H O W C A N" into "HOW CAN".
Sourcepub fn concatenate_chunks(chunks: &[TextChunk]) -> String
pub fn concatenate_chunks(chunks: &[TextChunk]) -> String
Concatenate a slice of owned TextChunks using gap-based word boundary detection. Handles letter-spaced text with adaptive threshold.
For multi-line content (e.g. table cells), chunks on different visual lines are separated by spaces — detected via Y-position change.
Sourcepub fn chunk_count(&self) -> usize
pub fn chunk_count(&self) -> usize
Number of text chunks in this line.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TextLine
impl<'de> Deserialize<'de> for TextLine
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for TextLine
impl RefUnwindSafe for TextLine
impl Send for TextLine
impl Sync for TextLine
impl Unpin for TextLine
impl UnsafeUnpin for TextLine
impl UnwindSafe for TextLine
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> 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 more