pub struct PortableTexEngine<'resources> { /* private fields */ }Implementations§
Source§impl<'resources> PortableTexEngine<'resources>
impl<'resources> PortableTexEngine<'resources>
pub fn from_format<R>(
profile: EngineProfile,
format: &PortableFormatImage,
resources: R,
) -> Selfwhere
R: ResourceProvider + 'resources,
pub fn with_font_platform<F>(self, fonts: F) -> Selfwhere
F: FontPlatform + 'resources,
pub fn with_platform<P>(self, platform: P) -> Selfwhere
P: PortablePlatform + 'resources,
pub fn profile(&self) -> EngineProfile
pub fn initialize_format_state(&mut self) -> bool
pub fn begin_primary_input(&mut self, name: &str, bytes: Vec<u8>) -> bool
pub fn run_main_control(&mut self) -> bool
pub fn run_format_initialization(&mut self) -> bool
pub fn begin_fragment_capture(&mut self)
pub fn end_fragment_capture(&mut self)
pub fn snapshot_format(&self) -> PortableFormatImage
Sourcepub fn into_format(self) -> PortableFormatImage
pub fn into_format(self) -> PortableFormatImage
Consume this engine and seal its state in place as a format snapshot,
moving the Box<PortableTexState> instead of deep-cloning it the way
Self::snapshot_format does. Building a format cache normally holds the
freshly-initialized engine (~hundreds of MB of mem/eqtb/hash) and a
full clone of it at the same time — a transient ~2x spike. When the caller
owns the engine and discards it right after snapshotting (the
GeneratedFormatCache::initialized / preload paths), moving the state
avoids the clone and halves that peak.
Sourcepub fn finalize_trie(&mut self)
pub fn finalize_trie(&mut self)
Pack the hyphenation trie now, so its construction scratch can be freed
when the format is sealed. This engine packs the trie lazily on the first
runtime hyphenation (inittrie is a no-op while format_initialization);
doing it here — once the final format is built, exactly like TeX’s
\dump — yields an identical packed trie and lets seal_as_format_snapshot
drop the ~24 MB of builder scratch arrays. Only call this when no further
\patterns will be loaded.
pub fn resource_request_count(&self) -> usize
pub fn resource_request_records(&self) -> &[PortableResourceRequestRecord]
pub fn transcript_bytes(&self) -> &[u8] ⓘ
Sourcepub fn primary_input_source_span(&self) -> Option<PortableSourceSpan>
pub fn primary_input_source_span(&self) -> Option<PortableSourceSpan>
The interned span keyed to the primary input’s source name, if any — the first recorded span whose name is the primary input file.
Sourcepub fn node_source_spans(&self) -> &[PortableNodeSourceSpan]
pub fn node_source_spans(&self) -> &[PortableNodeSourceSpan]
Stamped node→span pairs. The node_src shadow is paged-sparse and not
cheaply enumerable by node address, so callers that need per-node spans
use Self::resolve_node_src / snapshot_node on the live node graph;
this restored accessor returns an empty slice rather than scanning mem.
pub fn stripped_page_build_count(&self) -> usize
pub fn stripped_shipout_count(&self) -> usize
pub fn stripped_special_output_count(&self) -> usize
pub fn stripped_picture_load_count(&self) -> usize
pub fn stripped_source_special_count(&self) -> usize
pub fn stripped_write_whatsit_diagnostic_count(&self) -> usize
pub fn stripped_pdf_extension_count(&self) -> usize
pub fn stripped_page_top_prune_count(&self) -> usize
pub fn last_stripped_shipout_box(&self) -> Option<PortableNodeHandle>
pub fn captured_fragment_root(&self) -> Option<PortableNodeHandle>
Sourcepub fn font_at_size(&self, font: i32) -> i32
pub fn font_at_size(&self, font: i32) -> i32
At-size (scaled points) a font was loaded at, by internal font number. Used by the IR builder to carry the real glyph-run font size.
Sourcepub fn font_name(&self, font: i32) -> Option<String>
pub fn font_name(&self, font: i32) -> Option<String>
The interned \font name for a font number. For native fonts this is the
XeTeX spec the font was loaded with (e.g.
[latinmodern-math.otf]:script=math;ssty=1); for TFM fonts it is the
.tfm name. Lets the IR carry a real font identity so a renderer can
resolve per-run glyph outlines to the originating font file.
Sourcepub fn native_font_spec(&self, font: i32) -> Option<String>
pub fn native_font_spec(&self, font: i32) -> Option<String>
The \font spec a native font number was loaded with, recovered from the
font platform ([file]:features). For native fonts this is the reliable
identity (TFM \fontname is empty for them). Read-only.
Sourcepub fn native_font_table(&self) -> Vec<(PortableFontHandle, String, i32)>
pub fn native_font_table(&self) -> Vec<(PortableFontHandle, String, i32)>
Snapshot the native-font table (handle, spec, size) from the attached
font platform, for packaging alongside a serialized format image.
Sourcepub fn restore_native_font_table(
&mut self,
table: &[(PortableFontHandle, String, i32)],
) -> bool
pub fn restore_native_font_table( &mut self, table: &[(PortableFontHandle, String, i32)], ) -> bool
Re-bind native fonts on a cold-loaded format image: rebuilds the attached
platform’s handle→font map from a Self::native_font_table snapshot so
the fontlayoutengine handles preserved in the image resolve again.
Returns false if any font failed to reload.
pub fn last_abort_status(&self) -> Option<i32>
Sourcepub fn last_error_message(&self) -> Option<&str>
pub fn last_error_message(&self) -> Option<&str>
The message from the most recent surfaced [EngineError], if the last
run failed with a TeX error (rather than a fatal abort). None after a
clean run or a bare abort.
Sourcepub fn set_sandbox(&mut self, on: bool)
pub fn set_sandbox(&mut self, on: bool)
Enable/disable the fragment sandbox (see PortableTexEngine::sandbox),
resetting the per-run bookkeeping so each render starts clean. Uses the
self: &mut Self receiver form the patcher’s passes expect for prelude
methods (the &mut self shorthand gets its receiver stripped).
pub fn snapshot_node( &self, handle: PortableNodeHandle, ) -> Option<PortableNodeSnapshot>
Sourcepub fn set_source_tracking(&mut self, on: bool)
pub fn set_source_tracking(&mut self, on: bool)
Enable/disable source tracking, lazily (re)allocating the node_src
shadow (sized to mem) and clearing the intern tables. Resets all the
transient registers so a render starts clean. Default off.
Sourcepub fn source_tracking_enabled(&self) -> bool
pub fn source_tracking_enabled(&self) -> bool
Whether source tracking is currently enabled.
Sourcepub fn node_enclosing_spans(
&self,
handle: PortableNodeHandle,
) -> Vec<PortableSourceSpan>
pub fn node_enclosing_spans( &self, handle: PortableNodeHandle, ) -> Vec<PortableSourceSpan>
Resolve a node’s enclosing-construct chain (innermost first) to display
spans, gated to the node’s own source and to frames that strictly enclose
the node’s primary range (a real enclosing construct contains the node),
with consecutive duplicates and the primary-equal innermost frame dropped.
&self: safe on the read-only IR snapshot path. Empty when tracking off.
Consumed by the IR builder to emit role-tagged EnclosingConstruct entries.
Sourcepub fn input_source_spans(&self) -> Vec<PortableSourceSpan>
pub fn input_source_spans(&self) -> Vec<PortableSourceSpan>
All interned spans, resolved to display form. Restored from the stubbed
&[]: exposes the populated table for inspection / tests.