pub struct BaFontMap { /* private fields */ }Expand description
Font map for form field appearance streams.
Resolves font resources from the interactive form’s /DR dictionary
and the field’s /DA (default appearance) string.
Implementations§
Source§impl BaFontMap
impl BaFontMap
Sourcepub fn from_resources<S: PdfSource>(
dr_dict: Option<&HashMap<Name, Object>>,
da_string: Option<&str>,
store: &ObjectStore<S>,
) -> Self
pub fn from_resources<S: PdfSource>( dr_dict: Option<&HashMap<Name, Object>>, da_string: Option<&str>, store: &ObjectStore<S>, ) -> Self
Build a font map from the form’s /DR dictionary and /DA string.
dr_dict is the Font sub-dictionary from /DR → /Font.
da_string is the default appearance string (e.g., “0 g /Helv 12 Tf”).
Sourcepub fn default_font_name(&self) -> Option<&str>
pub fn default_font_name(&self) -> Option<&str>
Return the default font name from /DA.
Sourcepub fn default_font_size(&self) -> f32
pub fn default_font_size(&self) -> f32
Return the default font size from /DA.
Sourcepub fn font_count(&self) -> usize
pub fn font_count(&self) -> usize
Return the number of available fonts.
Sourcepub fn get_font_name(&self, index: usize) -> Option<&str>
pub fn get_font_name(&self, index: usize) -> Option<&str>
Upstream-aligned alias for font_name.
Sourcepub fn charset(&self, index: usize) -> Option<u8>
pub fn charset(&self, index: usize) -> Option<u8>
Return the charset of the font at the given index.
Sourcepub fn find_font(&self, name: &str) -> Option<&BaFontMapEntry>
pub fn find_font(&self, name: &str) -> Option<&BaFontMapEntry>
Find a font entry by name.
Sourcepub fn entries(&self) -> &[BaFontMapEntry]
pub fn entries(&self) -> &[BaFontMapEntry]
Return all font entries.
Sourcepub fn find_font_or_fallback(&self, name: &str) -> Option<&BaFontMapEntry>
pub fn find_font_or_fallback(&self, name: &str) -> Option<&BaFontMapEntry>
Find a font entry by name, falling back to standard font name aliases.
Tries the exact name first, then checks common abbreviation/alias mappings:
- “Helv” ↔ “Helvetica”
- “Cour” ↔ “Courier”
- “TiRo” ↔ “TimesNewRoman” / “Times-Roman”
- “ZaDb” ↔ “ZapfDingbats”
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BaFontMap
impl RefUnwindSafe for BaFontMap
impl Send for BaFontMap
impl Sync for BaFontMap
impl Unpin for BaFontMap
impl UnsafeUnpin for BaFontMap
impl UnwindSafe for BaFontMap
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