Skip to content

Fix text bounding box baseline alignment discrepancy #251

Description

@kyamagu

Description

Fix the dominant-baseline positioning discrepancy for bounding box text mentioned in the TODO comment at src/psd2svg/core/text.py:317.

Current Behavior

Bounding box text (ShapeType=1) positioning may not accurately match Photoshop's layout, particularly for baseline alignment.

Expected Behavior

Text baseline should align correctly within bounding boxes to match Photoshop's rendering as closely as possible.

Implementation Notes

  • The TODO at line 317 in text.py indicates a known issue with dominant_baseline positioning
  • This affects the _compute_paragraph_position method
  • Needs empirical testing to determine correct baseline values
  • Focus on achieving "acceptable tolerance" (e.g., ±2px) rather than pixel-perfect matching

Related

Success Criteria

  • Remove TODO comment with proper fix
  • Text baseline aligns within acceptable tolerance (±2px)
  • No regression in existing text positioning tests
  • Add test cases for baseline alignment accuracy

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions