Skip to main content

PortableTexEngine

Struct PortableTexEngine 

Source
pub struct PortableTexEngine<'resources> { /* private fields */ }

Implementations§

Source§

impl<'resources> PortableTexEngine<'resources>

Source

pub fn from_format<R>( profile: EngineProfile, format: &PortableFormatImage, resources: R, ) -> Self
where R: ResourceProvider + 'resources,

Source

pub fn with_font_platform<F>(self, fonts: F) -> Self
where F: FontPlatform + 'resources,

Source

pub fn with_platform<P>(self, platform: P) -> Self
where P: PortablePlatform + 'resources,

Source

pub fn profile(&self) -> EngineProfile

Source

pub fn initialize_format_state(&mut self) -> bool

Source

pub fn begin_primary_input(&mut self, name: &str, bytes: Vec<u8>) -> bool

Source

pub fn run_main_control(&mut self) -> bool

Source

pub fn run_format_initialization(&mut self) -> bool

Source

pub fn begin_fragment_capture(&mut self)

Source

pub fn end_fragment_capture(&mut self)

Source

pub fn snapshot_format(&self) -> PortableFormatImage

Source

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.

Source

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.

Source

pub fn resource_request_count(&self) -> usize

Source

pub fn resource_request_records(&self) -> &[PortableResourceRequestRecord]

Source

pub fn transcript_bytes(&self) -> &[u8] ⓘ

Source

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.

Source

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.

Source

pub fn stripped_page_build_count(&self) -> usize

Source

pub fn stripped_shipout_count(&self) -> usize

Source

pub fn stripped_special_output_count(&self) -> usize

Source

pub fn stripped_picture_load_count(&self) -> usize

Source

pub fn stripped_source_special_count(&self) -> usize

Source

pub fn stripped_write_whatsit_diagnostic_count(&self) -> usize

Source

pub fn stripped_pdf_extension_count(&self) -> usize

Source

pub fn stripped_page_top_prune_count(&self) -> usize

Source

pub fn last_stripped_shipout_box(&self) -> Option<PortableNodeHandle>

Source

pub fn captured_fragment_root(&self) -> Option<PortableNodeHandle>

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn last_abort_status(&self) -> Option<i32>

Source

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.

Source

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).

Source

pub fn snapshot_node( &self, handle: PortableNodeHandle, ) -> Option<PortableNodeSnapshot>

Source

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.

Source

pub fn source_tracking_enabled(&self) -> bool

Whether source tracking is currently enabled.

Source

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.

Source

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.

Auto Trait Implementations§

§

impl<'resources> !RefUnwindSafe for PortableTexEngine<'resources>

§

impl<'resources> !Send for PortableTexEngine<'resources>

§

impl<'resources> !Sync for PortableTexEngine<'resources>

§

impl<'resources> !UnwindSafe for PortableTexEngine<'resources>

§

impl<'resources> Freeze for PortableTexEngine<'resources>

§

impl<'resources> Unpin for PortableTexEngine<'resources>

§

impl<'resources> UnsafeUnpin for PortableTexEngine<'resources>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.