postext 1.61.0 → 1.61.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1505,11 +1505,13 @@ function placeDocumentPass(content, config, cache, options, hints) {
1505
1505
  }
1506
1506
  };
1507
1507
  const floatHeadOf = (col) => reservedOf(col).top;
1508
- /** `BandCap.headPx` for a cap proposed on `cols`: how far the float bands
1509
- * every column holds at its head put the band's top below its bare one. */
1510
- const capHeadPx = (cols) => {
1508
+ /** Where a cap proposed on `cols` was measured: `BandCap.at` (the page
1509
+ * and the band's top) and `BandCap.headPx` (how far the float bands every
1510
+ * column holds at its head put the band's top below its bare one). */
1511
+ const capOrigin = (cols) => {
1511
1512
  const head = bandTop(cols) - bareBandTop(cols, floatHeadOf);
1512
- return head > 0.5 ? { headPx: head } : {};
1513
+ const at = `${cursor.pageIndex}:${Math.round(bandTop(cols))}`;
1514
+ return head > 0.5 ? { at, headPx: head } : { at };
1513
1515
  };
1514
1516
  /** Content index of the block that first referenced the latest float
1515
1517
  * reserved at the head of each column. */
@@ -3712,6 +3714,14 @@ function placeDocumentPass(content, config, cache, options, hints) {
3712
3714
  // The cut is measured from under the float bands the proposing pass
3713
3715
  // had at the band's head, which may not have landed yet.
3714
3716
  const top = Math.max(bandTop(cols), bareBandTop(cols, floatHeadOf) + (cap.headPx ?? 0));
3717
+ // A cut below the band's foot cuts nothing: the band opens lower on
3718
+ // its page than where the cap was measured (the caps before it pulled
3719
+ // the flow up), so its text runs into the page foot whatever the cap.
3720
+ // Left unapplied, the driver takes the fresh proposal of the band the
3721
+ // boundary is reached in instead of growing this one (#1253).
3722
+ const foot = Math.min(...cols.map((c) => columnBottom(c, uncappedBottoms)));
3723
+ if (cols.length > 0 && top + cap.lines * (cap.pitchPx ?? baselineGrid) > foot + 0.5)
3724
+ continue;
3715
3725
  // (A trailing cap counts the lines of its band's own leading, #711.)
3716
3726
  applyBandCap(cols, cap.lines * (cap.pitchPx ?? baselineGrid), uncappedBottoms, cap.zone, cap.kind === 'trailing', top);
3717
3727
  cappedBandColumns.set(spanIndex, cols);
@@ -3826,7 +3836,7 @@ function placeDocumentPass(content, config, cache, options, hints) {
3826
3836
  ...(pitch !== baselineGrid ? { pitchPx: pitch, retryLimit: capRetryLimit(pitch, baselineGrid) } : {}),
3827
3837
  retries: 0,
3828
3838
  ...(aroundZone !== null ? { zone } : {}),
3829
- ...capHeadPx(cols),
3839
+ ...capOrigin(cols),
3830
3840
  });
3831
3841
  };
3832
3842
  /** Cut the columns of a closing band that ends level on the grid line
@@ -4521,7 +4531,7 @@ function placeDocumentPass(content, config, cache, options, hints) {
4521
4531
  ...(bandStart.visit > 0 ? { startVisit: bandStart.visit } : {}),
4522
4532
  lines,
4523
4533
  retries: 0,
4524
- ...capHeadPx(cols),
4534
+ ...capOrigin(cols),
4525
4535
  });
4526
4536
  }
4527
4537
  else {
@@ -4682,7 +4692,7 @@ function placeDocumentPass(content, config, cache, options, hints) {
4682
4692
  ...(bandStart.visit > 0 ? { startVisit: bandStart.visit } : {}),
4683
4693
  lines,
4684
4694
  retries: 0,
4685
- ...capHeadPx(cols),
4695
+ ...capOrigin(cols),
4686
4696
  });
4687
4697
  proposedSpan = true;
4688
4698
  }