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: boolWhether 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: boolWhether 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: boolWhether 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
impl Clone for SubstitutionOptions
Source§fn clone(&self) -> SubstitutionOptions
fn clone(&self) -> SubstitutionOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more