pub struct RenderPrep { /* private fields */ }Expand description
Render-prep orchestrator.
Implementations§
Source§impl RenderPrep
impl RenderPrep
Sourcepub fn new(opts: RenderPrepOptions) -> Self
pub fn new(opts: RenderPrepOptions) -> Self
Create a render-prep engine.
Sourcepub fn with_serif_default(self) -> Self
pub fn with_serif_default(self) -> Self
Use serif default fallback policy.
Sourcepub fn with_font_policy(self, policy: FontPolicy) -> Self
pub fn with_font_policy(self, policy: FontPolicy) -> Self
Override fallback font policy used during style-to-face resolution.
Sourcepub fn with_embedded_fonts_from_book<R: Read + Seek>(
self,
book: &mut EpubBook<R>,
) -> Result<Self, RenderPrepError>
pub fn with_embedded_fonts_from_book<R: Read + Seek>( self, book: &mut EpubBook<R>, ) -> Result<Self, RenderPrepError>
Register all embedded fonts from a book.
Sourcepub fn with_registered_fonts<I, F>(
self,
fonts: I,
loader: F,
) -> Result<Self, RenderPrepError>
pub fn with_registered_fonts<I, F>( self, fonts: I, loader: F, ) -> Result<Self, RenderPrepError>
Register fonts from any external source with a byte loader callback.
Sourcepub fn prepare_chapter<R: Read + Seek>(
&mut self,
book: &mut EpubBook<R>,
index: usize,
) -> Result<PreparedChapter, RenderPrepError>
pub fn prepare_chapter<R: Read + Seek>( &mut self, book: &mut EpubBook<R>, index: usize, ) -> Result<PreparedChapter, RenderPrepError>
Prepare a chapter into styled runs/events.
Sourcepub fn prepare_chapter_into<R: Read + Seek>(
&mut self,
book: &mut EpubBook<R>,
index: usize,
out: &mut Vec<StyledEventOrRun>,
) -> Result<(), RenderPrepError>
pub fn prepare_chapter_into<R: Read + Seek>( &mut self, book: &mut EpubBook<R>, index: usize, out: &mut Vec<StyledEventOrRun>, ) -> Result<(), RenderPrepError>
Prepare a chapter and append results into an output buffer.
Sourcepub fn prepare_chapter_with<R: Read + Seek, F: FnMut(StyledEventOrRun)>(
&mut self,
book: &mut EpubBook<R>,
index: usize,
on_item: F,
) -> Result<(), RenderPrepError>
pub fn prepare_chapter_with<R: Read + Seek, F: FnMut(StyledEventOrRun)>( &mut self, book: &mut EpubBook<R>, index: usize, on_item: F, ) -> Result<(), RenderPrepError>
Prepare a chapter and stream each styled item via callback.
Sourcepub fn prepare_chapter_bytes_with<R: Read + Seek, F: FnMut(StyledEventOrRun)>(
&mut self,
book: &mut EpubBook<R>,
index: usize,
html: &[u8],
on_item: F,
) -> Result<(), RenderPrepError>
pub fn prepare_chapter_bytes_with<R: Read + Seek, F: FnMut(StyledEventOrRun)>( &mut self, book: &mut EpubBook<R>, index: usize, html: &[u8], on_item: F, ) -> Result<(), RenderPrepError>
Prepare a chapter from caller-provided XHTML bytes and stream each styled item.
This avoids re-reading chapter bytes from the ZIP archive and is intended for embedded call sites that already own a reusable chapter buffer.
Sourcepub fn prepare_chapter_bytes_with_scratch<R: Read + Seek, F: FnMut(StyledEventOrRun)>(
&mut self,
book: &mut EpubBook<R>,
index: usize,
html: &[u8],
stylesheet_scratch: &mut Vec<u8>,
on_item: F,
) -> Result<(), RenderPrepError>
pub fn prepare_chapter_bytes_with_scratch<R: Read + Seek, F: FnMut(StyledEventOrRun)>( &mut self, book: &mut EpubBook<R>, index: usize, html: &[u8], stylesheet_scratch: &mut Vec<u8>, on_item: F, ) -> Result<(), RenderPrepError>
Prepare chapter bytes with caller-provided stylesheet scratch.
This avoids transient stylesheet Vec<u8> allocations by reusing stylesheet_scratch.
Sourcepub fn prepare_chapter_with_trace_context<R: Read + Seek, F: FnMut(StyledEventOrRun, RenderPrepTrace)>(
&mut self,
book: &mut EpubBook<R>,
index: usize,
on_item: F,
) -> Result<(), RenderPrepError>
pub fn prepare_chapter_with_trace_context<R: Read + Seek, F: FnMut(StyledEventOrRun, RenderPrepTrace)>( &mut self, book: &mut EpubBook<R>, index: usize, on_item: F, ) -> Result<(), RenderPrepError>
Prepare a chapter and stream each styled item with structured trace context.
Sourcepub fn prepare_chapter_with_trace<R: Read + Seek, F: FnMut(StyledEventOrRun, Option<FontResolutionTrace>)>(
&mut self,
book: &mut EpubBook<R>,
index: usize,
on_item: F,
) -> Result<(), RenderPrepError>
👎Deprecated since 0.2.0: Use prepare_chapter_with_trace_context for stable structured trace output.
pub fn prepare_chapter_with_trace<R: Read + Seek, F: FnMut(StyledEventOrRun, Option<FontResolutionTrace>)>( &mut self, book: &mut EpubBook<R>, index: usize, on_item: F, ) -> Result<(), RenderPrepError>
Prepare a chapter and stream each styled item with optional font-resolution trace.
Trait Implementations§
Source§impl Clone for RenderPrep
impl Clone for RenderPrep
Source§fn clone(&self) -> RenderPrep
fn clone(&self) -> RenderPrep
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more