Carry XDV device advances through packed box scopes
This commit is contained in:
1 parent
9da75c82f5
commit
9efededf6d
14 files changed
+252
-83
No files matched your search
@@ -461,6 +461,37 @@ fn paragraph_protrusion_observes_profile_specific_whatsit_boundaries() {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn xdv_device_advances_are_restored_with_the_packed_box_stack() {
|
||||
use texrra_tex_core::render::DisplayItem;
|
||||
|
||||
let source = r"\catcode123=1 \catcode125=2
|
||||
\font\probe=cmr10 \probe
|
||||
\shipout\hbox{C\hbox{CC}\kern1sp CC\special{pdf:literal direct 0 0 m}\vrule width1pt height1pt}
|
||||
\end";
|
||||
let execution = Executor::new(
|
||||
State::initex().with_etex().with_input_profile(InputProfile::XeTeX),
|
||||
Limits::default(),
|
||||
)
|
||||
.with_native_pages()
|
||||
.run(
|
||||
SourceFile { name: "xdv-cursor.tex".into(), data: source.as_bytes().into() },
|
||||
&mut font_world::FontFiles,
|
||||
)
|
||||
.unwrap();
|
||||
let pages = execution.shipout_display_lists().unwrap();
|
||||
let page = &pages[0];
|
||||
let glyph_offsets: Vec<_> = page.items.iter().enumerate().filter_map(|(index, item)| {
|
||||
matches!(item, DisplayItem::NativeGlyph { .. }).then(|| page.xdv_horizontal_offset(index))
|
||||
}).collect();
|
||||
assert_eq!(glyph_offsets, [0, 1, 2, 1, 2]);
|
||||
let drawing_offsets: Vec<_> = page.items.iter().enumerate().filter_map(|(index, item)| {
|
||||
matches!(item, DisplayItem::Rule { .. } | DisplayItem::PdfGraphics { .. })
|
||||
.then(|| page.xdv_horizontal_offset(index))
|
||||
}).collect();
|
||||
assert_eq!(drawing_offsets, [3, 3]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn shipout_applies_the_stored_glue_ratio_before_rounding() {
|
||||
use texrra_tex_core::render::DisplayItem;
|
||||
|
||||
Reference in new issue
Block a user