fix: implement actual list item spacing with Y offset adjustment

Previous implementation only expanded bbox_height which had no visual effect.
New implementation properly applies spacing_after between list items.

Changes:
1. Track cumulative Y offset in _draw_list_elements_direct
2. Calculate actual gap between adjacent list items
3. If actual gap < desired spacing_after, add offset to push next item down
4. Pass y_offset parameter to _draw_text_element_direct
5. Apply y_offset when calculating pdf_y coordinate

Implementation details:
- Default 3pt spacing_after for list items (except last item in group)
- Compare actual_gap (next.bbox.y0 - current.bbox.y1) with desired spacing
- Cumulative offset ensures spacing compounds across multiple items
- Negative offset in PDF coordinates (Y increases upward)
- Debug logging shows when additional spacing is applied

This now creates actual visual spacing between list items in the PDF output.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
egg
2025-11-24 11:35:58 +08:00
parent 1ac8e82f47
commit b1de7616e4
2 changed files with 38 additions and 25 deletions

View File

@@ -115,10 +115,11 @@
- [x] Calculate marker width before rendering (line 1758)
- [x] Add marker_width to subsequent line indentation (lines 1770-1772)
- [x] 6.2.5 Remove original markers from text content (lines 1716-1723)
- [x] 6.2.6 Dedicated list item spacing (lines 1655-1662, 1764-1769)
- [x] Default 3pt spacing_after for list items
- [x] Applied by expanding bbox_height (line 1769)
- [x] Marked with _apply_spacing_after flag
- [x] 6.2.6 Dedicated list item spacing (lines 1658-1683)
- [x] Default 3pt spacing_after for list items (except last item)
- [x] Calculate actual gap between adjacent items (line 1676)
- [x] Apply cumulative Y offset to push items down if gap < desired (lines 1678-1683)
- [x] Pass y_offset to _draw_text_element_direct (line 1668, 1690, 1716)
- [x] 6.2.7 Maintain list grouping via proximity (max_gap=30pt, lines 1597-1607)
### 7. Span-Level Rendering (Advanced)