Expand description
Pure text-layout functions: word wrapping and sentence segmentation.
Both functions have zero IO and work on any platform.
word_wrap_bytes depends on crate::rendering::text_render for script
detection and width measurement, and crate::html_text::Line for output.
Structs§
Functions§
- block_
indent_ for - clamp_
page - Clamp a page index into
[0, page_count-1]. An empty chapter (0 pages) maps any request to 0. - count_
chapter_ pages - estimate_
chapter_ offsets - paginate_
heights - Paginate row heights into pages that fit within
content_hpx. - resolve_
progress_ target - Map a progress-bar per-mille (0..1000) to a
(chapter, local_offset)pair using the cumulative chapter-offset table. - sentences_
with_ ranges - word_
wrap_ bytes - word_
wrap_ char_ based - Character-granular wrap that preserves every space and tab. Used for
<pre>code, where indentation is meaningful and words must not be reflowed, and internally for scripts that do not separate words with spaces. - word_
wrap_ char_ based_ styled - As
word_wrap_char_based, measured instyle. Code wraps in the monospace face, whose advances are wider than the proportional body face – measuring with the wrong one overfills every line. - word_
wrap_ indent - Like
word_wrap_bytesbut reservesfirst_indentpx on the first line for a paragraph indent. Only word-spacing scripts indent; the rest wrap unchanged.