Skip to main content

SubstitutionOptions

Struct SubstitutionOptions 

Source
pub struct SubstitutionOptions {
    pub skip_font_enumeration: bool,
    pub font_dirs: Vec<PathBuf>,
    pub croscore_font_names: bool,
    pub system_fonts: bool,
}
Expand description

How substitution finds faces.

Fields§

§skip_font_enumeration: bool

Whether the font-database weight rule applies rather than the enumeration one.

PDFium guards Branch A’s weight reset on an internal flag it sets in its “version 2” mode. fontdb is that mode — there is no enumeration callback, we query directly — so true is the architecturally honest value and bold and light variants survive into the query.

The default is false, because that is the behaviour the conformance corpus was rendered under — an enumerating font info, where the weight reset applies. Set it to true for the modern behaviour.

§font_dirs: Vec<PathBuf>

Directories to scan instead of the system’s, for a hermetic run.

§croscore_font_names: bool

Whether the family a database lookup asks for is rewritten to its Croscore equivalent (--croscore-font-names).

The oracle’s test_fonts directory holds no Arial, Times or Courier: it holds the metric-compatible Arimo, Tinos and Cousine, so a hermetic run needs the rewrite or a /BaseFont /Helvetica looks for a face that is not there and falls through to the built-ins with different metrics.

The rewrite sits at the database boundary — the family a lookup asks for is renamed, not the /BaseFont the ladder starts from — so the whole name/style/base-14 analysis runs on the document’s own spelling first.

§system_fonts: bool

Whether an empty font_dirs means the system’s own font directories rather than no directories at all.

A Linux reference run always enumerates the system’s fonts — /usr/share/fonts, /usr/share/X11/fonts/Type1, /usr/share/X11/fonts/TTF and /usr/local/share/fonts — so a --font-dir replaces that search path rather than enabling it.

The default is false, because a library whose output depends on which fonts happen to be installed is not testable and every unit test in the tree is written against the built-in faces. A host that wants the oracle’s behaviour — pdfrum-tool invoked without --font-dir does — sets it to true.

It has no effect when font_dirs is non-empty: those directories are then the whole search path either way, which is why every conformance invocation (which always passes --font-dir) is unaffected by it.

Trait Implementations§

Source§

impl Clone for SubstitutionOptions

Source§

fn clone(&self) -> SubstitutionOptions

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SubstitutionOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SubstitutionOptions

Source§

fn default() -> SubstitutionOptions

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.