pub struct XfaFontResolver { /* private fields */ }Expand description
Resolves XFA font specifications to actual font data.
Implementations§
Source§impl XfaFontResolver
impl XfaFontResolver
Sourcepub fn new(embedded_fonts: Vec<EmbeddedFontData>) -> Self
pub fn new(embedded_fonts: Vec<EmbeddedFontData>) -> Self
Create a new resolver with embedded fonts extracted from the PDF.
Sourcepub fn with_font_cache(self, dir: &Path) -> Self
pub fn with_font_cache(self, dir: &Path) -> Self
Set a custom font cache directory (overrides XFA_FONT_CACHE env var).
Sourcepub fn resolve(&mut self, spec: &XfaFontSpec) -> Result<ResolvedFont>
pub fn resolve(&mut self, spec: &XfaFontSpec) -> Result<ResolvedFont>
Resolve a font specification to a usable font.
XFA Spec 3.3 §28.2 (p1246) — Font mapping: Adobe uses a 5-step algorithm:
- direct match, 2) equate, 3) locale, 4) genericFamily, 5) default. We implement steps 1, 4, 5 (equate and locale are config-dependent).
When weight is Bold and/or posture is Italic, variant-specific font names are tried first (e.g. “Arial-Bold”, “ArialBold”, “Arial Bold”) in both embedded and system font lookups. This ensures that bold/italic text gets the correct font metrics (wider glyphs, different ascender/ descender) instead of silently falling back to the regular weight.
Auto Trait Implementations§
impl Freeze for XfaFontResolver
impl RefUnwindSafe for XfaFontResolver
impl Send for XfaFontResolver
impl Sync for XfaFontResolver
impl Unpin for XfaFontResolver
impl UnsafeUnpin for XfaFontResolver
impl UnwindSafe for XfaFontResolver
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
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more