Register virtual fonts in native PDF shipout order
This commit is contained in:
1 parent
b008c0693a
commit
614f09aa9b
11 files changed
+708
-139
No files matched your search
@@ -306,3 +306,45 @@ fn nested_vf_preserves_pen_position_rules_and_one_to_many_origin() {
|
||||
&& *rule_y == *y + 49_152 && *width == 196_608 && *height == 49_152));
|
||||
render(&root, &revision.execution, &pages);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn autoexpanded_virtual_shipout_allocates_job_fonts_before_following_commands() {
|
||||
const SOURCE: &str = r"\catcode123=1 \catcode125=2
|
||||
\pdfoutput=1 \pdfpkresolution=600
|
||||
\font\virtual=ptmr7t
|
||||
\pdffontexpand\virtual 75 75 25 autoexpand
|
||||
\pdfadjustspacing=1 \parfillskip=0pt \hsize=31pt
|
||||
\setbox0=\vbox{\virtual \noindent AAAA\par}
|
||||
\font\sentinel=cmr10
|
||||
\fontdimen8\sentinel=1pt
|
||||
\shipout\copy0
|
||||
\end
|
||||
";
|
||||
let (root, mut host) = fixture("job-font-ids");
|
||||
let revision = execute(&root, SOURCE.as_bytes(), &mut host);
|
||||
let fonts = revision.execution.state.fonts();
|
||||
let names: Vec<_> = fonts.fonts().iter().map(FontInstance::name).collect();
|
||||
assert_eq!(
|
||||
names,
|
||||
["nullfont", "ptmr7t", "ptmr7t+75", "ptmr7t-75", "cmr10", "ptmr8r",
|
||||
"ptmr8r+75", "ptmr8r-75", "ptmr8r+75"],
|
||||
);
|
||||
|
||||
let source = SOURCE.replace(r"\end", r"\fontdimen9\sentinel=2pt \end");
|
||||
let run = |bytes: &str, host: &mut Host| {
|
||||
Executor::new(State::initex().with_etex(), Limits::default())
|
||||
.with_native_pages()
|
||||
.run(
|
||||
SourceFile { name: root.join("probe.tex").to_string_lossy().into_owned(),
|
||||
data: bytes.as_bytes().to_vec() },
|
||||
host,
|
||||
)
|
||||
};
|
||||
assert!(
|
||||
run(&source, &mut host)
|
||||
.unwrap_err()
|
||||
.message.contains("only the last loaded font can extend fontdimen")
|
||||
);
|
||||
let control = source.replace(r"\shipout\copy0", "");
|
||||
assert_eq!(run(&control, &mut host).unwrap().state.fonts().fonts().len(), 5);
|
||||
}
|
||||
Reference in new issue
Block a user