Use per-page annotation spacing with inferred margin fallback

This commit is contained in:
sebastien committed 2026-11-03 12:02:06 +01:00
1 parent b069805988
commit 0bb6f7d97c
10 files changed
+170 -39

No files matched your search

+14 -6
View File
@@ -10,13 +10,18 @@ extension **`.jpg`**, not `.jpeg`.
```python
ANNOTATION_MARGIN_LEFT = 300
ANNOTATION_LOW_MARGIN_LEFT = 400
ANNOTATION_MARGIN_POINTS = [(10, 450), (20, 400), (35, 300)]
```
These are added pixels at the 200 dpi annotation rendering scale. An answer
uses the larger margin if any of its source fragments has a measured left
margin below 20 mm (half the standard 40 mm). Unknown or insufficiently written
pages retain the normal spacing. The 600 px comment width is unchanged, so
The reference points are (measured margin in mm, added pixels at 200 dpi).
Each page fragment gets its own spacing: 450 px at or below 10 mm, 400 px at
20 mm, and 300 px at or above 35 mm, with linear interpolation between points.
Unknown pages retain their unknown status but use the arithmetic mean of the
copy's measured page margins, including during label-strip positioning.
Inferred values never contribute to that mean. If no page has a measurement,
`ANNOTATION_MARGIN_LEFT` supplies the default 300 px.
The old `ANNOTATION_LOW_MARGIN_LEFT` setting is replaced by the reference points.
The 600 px comment width is unchanged, so
comments can still overlap handwriting on pages with very little whitespace.
Automatic `crop-labels` saves per-page measurements in the Cutleft schema.
@@ -33,7 +38,10 @@ save their rendering geometry and reuse it when read back, even after settings
change. Older batches without saved geometry keep their original 300 px offset.
Do not overwrite a batch that still contains handwritten corrections to import.
All fragments of one answer share one left offset. BGnot pads narrower answer
Each fragment is positioned independently, with its annotation rectangles shifted
by the same amount. Rectangles crossing page boundaries are split at those boundaries.
Narrow pages receive any additional width on the right, so left padding does not
stack with the configured allowance. BGnot pads narrower answer
images with white without resizing handwriting; fitting the wider document to
screen or paper may reduce the displayed scale, and return-PDF page breaks can
change. The extra space is also used by Anot and Bnot.