Skip to content

Commit c28fb9e

Browse files
authored
Strip trailing zeros from serialized coordinates (#86) (#244)
Coordinates and numeric attributes were serialized with the fixed "%1.4f" pattern (ATTR_NUMFORMAT), leaving trailing zeros such as 108.0000, 404.8000 or 274.9930. Route all ATTR_NUMFORMAT-formattedvalues (ALTO String/SP/TextLine/TextBlock/Illustration coordinates and the SVG output) through a small formatCoord() helper that formats with the same precision and then trims trailing zeros (and a lone decimal point), normalizing "-0" to "0". Values are numerically identical, only the string representation is shortened. Verified end-to-end on a minimal generated PDF: 108.0000 -> 108, 612.0000 -> 612, 83.3840 -> 83.384, 11.1000 -> 11.1, and the output remains well-formed XML. FONTSIZE and ROTATION use their own formatters and are intentionally left unchanged (out of scope for coordinates).
1 parent efc9965 commit c28fb9e

1 file changed

Lines changed: 88 additions & 73 deletions

File tree

0 commit comments

Comments
 (0)