Expose per-order page stretch to the output routine
This commit is contained in:
1 parent
52e3e0647c
commit
a4388942f0
6 files changed
+117
-5
No files matched your search
@@ -20,6 +20,12 @@ pub struct OutputContext {
|
||||
pub page_depth: i64,
|
||||
/// TeX `\pagestretch`: stretch of the vertical glue so far.
|
||||
pub page_stretch: i64,
|
||||
/// TeX `\pagefilstretch`: stretch of `\vfil` glue on the page.
|
||||
pub page_fil_stretch: i64,
|
||||
/// TeX `\pagefillstretch`: stretch of `\vfill` glue on the page.
|
||||
pub page_fill_stretch: i64,
|
||||
/// TeX `\pagefilllstretch`: stretch of `\vfilll` glue on the page.
|
||||
pub page_filll_stretch: i64,
|
||||
/// TeX `\pageshrink`: shrink of the vertical glue so far.
|
||||
pub page_shrink: i64,
|
||||
/// TeX `\vsize`: the configured page height.
|
||||
@@ -105,6 +111,9 @@ enum Register {
|
||||
PageTotal,
|
||||
PageDepth,
|
||||
PageStretch,
|
||||
PageFilStretch,
|
||||
PageFillStretch,
|
||||
PageFilllStretch,
|
||||
PageShrink,
|
||||
Vsize,
|
||||
TopSkip,
|
||||
@@ -120,6 +129,9 @@ impl Dimension {
|
||||
Register::PageTotal => context.page_total,
|
||||
Register::PageDepth => context.page_depth,
|
||||
Register::PageStretch => context.page_stretch,
|
||||
Register::PageFilStretch => context.page_fil_stretch,
|
||||
Register::PageFillStretch => context.page_fill_stretch,
|
||||
Register::PageFilllStretch => context.page_filll_stretch,
|
||||
Register::PageShrink => context.page_shrink,
|
||||
Register::Vsize => context.vsize,
|
||||
Register::TopSkip => context.top_skip,
|
||||
@@ -488,6 +500,9 @@ fn parse_dimension(tokens: &[Token], index: &mut usize) -> Result<Dimension, Str
|
||||
"pagetotal" => Register::PageTotal,
|
||||
"pagedepth" => Register::PageDepth,
|
||||
"pagestretch" => Register::PageStretch,
|
||||
"pagefilstretch" => Register::PageFilStretch,
|
||||
"pagefillstretch" => Register::PageFillStretch,
|
||||
"pagefilllstretch" => Register::PageFilllStretch,
|
||||
"pageshrink" => Register::PageShrink,
|
||||
"vsize" => Register::Vsize,
|
||||
"topskip" => Register::TopSkip,
|
||||
@@ -578,6 +593,9 @@ mod tests {
|
||||
page_total,
|
||||
page_depth: 0,
|
||||
page_stretch: 0,
|
||||
page_fil_stretch: 0,
|
||||
page_fill_stretch: 0,
|
||||
page_filll_stretch: 0,
|
||||
page_shrink: 0,
|
||||
vsize: 612 * 65_536,
|
||||
top_skip: 10 * 65_536,
|
||||
@@ -609,6 +627,25 @@ mod tests {
|
||||
assert_eq!(shrink.shipout_count(&context(0)).unwrap(), 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fill_stretch_registers_are_visible() {
|
||||
let program = OutputProgram::parse(r"\ifdim\pagefilstretch>9pt\shipout\box255\fi").unwrap();
|
||||
let mut context = context(0);
|
||||
context.page_fil_stretch = 10 * 65_536;
|
||||
assert_eq!(program.shipout_count(&context).unwrap(), 1);
|
||||
assert_eq!(program.shipout_count(&self::context(0)).unwrap(), 0);
|
||||
|
||||
let fill = OutputProgram::parse(r"\ifdim\pagefillstretch>4pt\shipout\box255\fi").unwrap();
|
||||
let mut context = self::context(0);
|
||||
context.page_fill_stretch = 5 * 65_536;
|
||||
assert_eq!(fill.shipout_count(&context).unwrap(), 1);
|
||||
|
||||
let filll = OutputProgram::parse(r"\ifdim\pagefilllstretch>4pt\shipout\box255\fi").unwrap();
|
||||
let mut context = self::context(0);
|
||||
context.page_filll_stretch = 5 * 65_536;
|
||||
assert_eq!(filll.shipout_count(&context).unwrap(), 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn page_depth_register_is_visible() {
|
||||
let program = OutputProgram::parse(r"\ifdim\pagedepth>4pt\shipout\box255\fi").unwrap();
|
||||
|
||||
Reference in new issue
Block a user