fix(xlsx): preserve category label boundary spaces - #1575
Merged
Conversation
Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Preserve single leading and trailing spaces in standalone category-axis labels. Typst collapsed these literal boundary spaces, so centered month labels ignored part of the source label width. Emit them using the same code-mode string representation already used for consecutive spaces. Apply it to bar, column, line, area, and radar category labels, including rotated labels.
Related: #1567. The existing chart-origin offset and separate label-baseline residual remain tracked in #1542 and #1568.
Testing
janretains its single trailing space;yearkeeps its existing two spaces.cargo test --locked -p office2pdf --lib: 2,837 passed.cargo test --locked --workspace: 3,469 passed.cargo clippy --locked --workspace --all-targets -- -D warnings: passed.pdftotext -layoutcontent matches native and baseline on both pages (486 and 2,120 non-whitespace characters).Baseline:
d4d8ef3ff4374126b2b69ce0e8378e0f79adf14f, including the separate axis-font and chart-line alpha fixes. Fixture SHA-256:2b4a2d8dceda58758593c88409875efbda05780559154c02bd13fef4f7a1c65b; Cargo.lock SHA-256:750f50c507b281f84b945b09573333ffa02dc45cddd566481af8535ae101e612.Reproduce conversion with
cargo run --locked -p office2pdf-cli -- tests/fixtures/xlsx/issue_1181_fit_to_height.xlsx -o output.pdf --font-path '/Applications/Microsoft Excel.app/Contents/Resources/DFonts'. Compare both pages usingscripts/compare_layout.py GT.pdf output.pdf --audit --fine-shift 0.5 --json, andscripts/compare_render.py GT.pdf output.pdf --page P --dpi DPI --fine-shift 0.5 --cluster-report PATH --cluster-dispositions PATH --strict-clusters(150 DPI page 1, 300 DPI page 2).Visual impact
Visual audit
tests/fixtures/xlsx/issue_1181_fit_to_height.xlsx(SHA-2562b4a2d8dceda58758593c88409875efbda05780559154c02bd13fef4f7a1c65b)fixassets/bugfixes/issue-1567/layout-audit.jsonassets/bugfixes/issue-1567/render-clusters-page-1.json,assets/bugfixes/issue-1567/render-clusters-page-2.jsonassets/bugfixes/issue-1567/gt.jpgassets/bugfixes/issue-1567/before.jpgassets/bugfixes/issue-1567/after.jpgVisual comparison
Native Excel 16.112.3 exports, verified Excel/Quartz PDF provenance. Page 2 at 300 DPI:
The unchanged page-1 native comparison is attached to #1550, #1551, and #1552.
Required inspection
Deviation audit