pub(crate) struct EncodingPlanner {
used: HashMap<Base14Font, BTreeSet<char>>,
}Expand description
Two-phase encoding planner: caller streams every (face, ch) in
through Self::observe, then calls Self::finalize to get one
DocEncoding per Latin Core 14 face that participated.
Fields§
§used: HashMap<Base14Font, BTreeSet<char>>Observed chars per face. BTreeSet for deterministic order
during finalize, which keeps /Differences arrays byte-stable
between runs. (Base14Font doesn’t derive Ord, so the outer
container is a HashMap: finalize sorts what matters.)
Implementations§
Source§impl EncodingPlanner
impl EncodingPlanner
pub(crate) fn new() -> Self
Sourcepub(crate) fn observe(&mut self, face: Base14Font, ch: char)
pub(crate) fn observe(&mut self, face: Base14Font, ch: char)
Record that face will need to render ch. Idempotent.
Symbol and ZapfDingbats are silently ignored; those faces
don’t participate in /Differences planning (their encodings
are different category entirely; see crate-level
pdf-base14-metrics docs).
Sourcepub(crate) fn observe_runs(&mut self, runs: &[TextRun])
pub(crate) fn observe_runs(&mut self, runs: &[TextRun])
Convenience: feed every char of every text run. Embedded-font
runs are skipped; they take the Type 0 CID path and don’t
participate in /Differences planning.
Sourcepub(crate) fn finalize(
self,
diagnostics: &mut Vec<Diagnostic>,
) -> HashMap<Font, DocEncoding>
pub(crate) fn finalize( self, diagnostics: &mut Vec<Diagnostic>, ) -> HashMap<Font, DocEncoding>
Compute the per-face encoding plan. Any face never observed
is absent from the returned map; callers should fall back to
the predefined WinAnsiEncoding shortcut for those.
Pushes a MOS0032 diagnostic when a face’s extended-glyph budget
overflows the 256-slot single-byte ceiling.
Trait Implementations§
Source§impl Debug for EncodingPlanner
impl Debug for EncodingPlanner
Source§impl Default for EncodingPlanner
impl Default for EncodingPlanner
Source§fn default() -> EncodingPlanner
fn default() -> EncodingPlanner
Auto Trait Implementations§
impl Freeze for EncodingPlanner
impl RefUnwindSafe for EncodingPlanner
impl Send for EncodingPlanner
impl Sync for EncodingPlanner
impl Unpin for EncodingPlanner
impl UnsafeUnpin for EncodingPlanner
impl UnwindSafe for EncodingPlanner
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
§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.