niklasf / python-chess

A chess library for Python, with move generation and validation, PGN parsing and writing, Polyglot opening book reading, Gaviota tablebase probing, Syzygy tablebase probing, and UCI/XBoard engine communication
https://python-chess.readthedocs.io/en/latest/
GNU General Public License v3.0
2.45k stars 531 forks source link

Align pieces to their squares center when generating SVG images with border #1103

Closed Lukasel closed 2 months ago

Lukasel commented 2 months ago

When generating board SVGs with a border around the board, then the border displaces the squares but not the pieces. That results in the pieces being drawn of center from their squares.

A lichess puzzle rendered with border, the pieces are of center to the top left: 3r3k_p5pp_2r2q2_2p4Q_8_8_P5PP_3R1R1K b - - 5 29_border

The same position without border, the pieces are centered: 3r3k_p5pp_2r2q2_2p4Q_8_8_P5PP_3R1R1K b - - 5 29_no-border