Added support for preserving and rendering inline style variations
within text elements (e.g., bold/italic/color changes mid-line).
Span Extraction (direct_extraction_engine.py):
1. Parse PyMuPDF span data with font, size, flags, color per span
2. Create DocumentElement children for each span with StyleInfo
3. Store spans in element.children for downstream rendering
4. Extract span-specific bbox from PyMuPDF (lines 434-453)
Span Rendering (pdf_generator_service.py):
1. Implement _draw_text_with_spans() method (lines 1685-1734)
- Iterate through span children
- Apply per-span styling via _apply_text_style
- Track X position and calculate widths
- Return total rendered width
2. Integrate in _draw_text_element_direct() (lines 1822-1823, 1905-1914)
- Check for element.children (has_spans flag)
- Use span rendering for first line
- Fall back to normal rendering for list items
3. Add span count to debug logging
Features:
- Inline font changes (Arial → Times → Courier)
- Inline size changes (12pt → 14pt → 10pt)
- Inline style changes (normal → bold → italic)
- Inline color changes (black → red → blue)
Limitations (future work):
- Currently renders all spans on first line only
- Multi-line span support requires line breaking logic
- List items use single-style rendering (compatibility)
Direct track only (OCR track has no span information).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>