Reject automatic expansion of bitmap fonts at PDF shipout
This commit is contained in:
1 parent
45b79fc5a5
commit
9527d3bbec
8 files changed
+211
-46
No files matched your search
@@ -274,7 +274,7 @@ fn format_retains_synthesized_slots_and_parameters_but_resets_active_paint() {
|
||||
\end
|
||||
",
|
||||
),
|
||||
&mut Host,
|
||||
&mut font_world::FontFiles,
|
||||
)
|
||||
.unwrap();
|
||||
let mut messages = Vec::new();
|
||||
|
||||
@@ -280,3 +280,35 @@ fn absent_density_or_provider_is_a_real_failure_and_never_changes_font_identity(
|
||||
.contains(&Dependency::PdfDeviceConfiguration { pk_resolution: 300 })
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn autoexpanded_bitmap_rejects_at_shipout_before_following_commands() {
|
||||
let declaration = r"\pdfpkresolution=600
|
||||
\font\bitmap=cmr10 \pdffontexpand\bitmap 75 75 25 autoexpand
|
||||
\pdfadjustspacing=1 \parfillskip=0pt
|
||||
\setbox0=\vbox{\hsize=32.25pt \bitmap \noindent AAAA\par}";
|
||||
let mut files = Files::new(600);
|
||||
let error = native(
|
||||
&format!(r"{declaration}\shipout\box0\errmessage{{after shipout}}\end"),
|
||||
&mut files,
|
||||
)
|
||||
.unwrap_err();
|
||||
assert!(error.message.contains("auto expansion is only possible with scalable fonts"));
|
||||
assert!(files.world.trace().reads.iter().any(|read| read.path.ends_with("pdftex.map")));
|
||||
assert!(!files.world.trace().lookups.iter().any(|read| read.kind == ResourceKind::Pk));
|
||||
|
||||
let mut files = Files::new(600);
|
||||
let execution = native(
|
||||
&format!(r"{declaration}\shipout\hbox{{\bitmap AAAA}}\message{{ORDINARY}}\end"),
|
||||
&mut files,
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(messages(&execution), ["ORDINARY"]);
|
||||
let mut pages = execution.shipout_display_lists().unwrap();
|
||||
resolve_native_fonts(&mut pages, &mut files).unwrap();
|
||||
assert!(pages[0].items.iter().any(|item| matches!(
|
||||
item,
|
||||
texrra_tex_core::render::DisplayItem::NativeGlyph { paint: Some(paint), .. }
|
||||
if matches!(paint.program, NativeFontProgram::Pk(_))
|
||||
)));
|
||||
}
|
||||
Reference in new issue
Block a user