fix(xlsx): scale Excel worksheet bar-chart value-axis label gap with font size - #1766
Merged
Merged
Conversation
…font size Fixes #1622. The horizontal value-axis label gap for a Spreadsheet+Bar chart was a flat 7.65pt (a single 10pt native measurement from #1549/#1266). A fresh native Excel export of the same issue_1181_fit_to_height.xlsx income/expense charts shows the current output landing 0.79-0.80pt too high, worse than the issue's own 0.61-0.62pt because the flat constant carries no size term and the typst 0.15 upgrade shifted the box model slightly. Isolating the value-axis font size with one-factor native Excel probes (8pt clean, 10pt clean, 12pt/14pt unusable because native re-lays the plot itself) shows the required gap is not flat: fitting the two clean points gives GAP(size) = 6.029984 + 0.262695 * size_pt, the same PT+EM shape already shipped for the PowerPoint sibling constant. Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com> Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
Fresh native Excel export vs. the fixed office2pdf output for issue_1181_fit_to_height.xlsx page 2, plus a strict render-cluster disposition reused by exact bbox match from PR #1765's report on the same fixture/page (bit-identical before/after cluster set). Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com> Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
This was referenced Sep 16, 2026
pull Bot
pushed a commit
to RadaKichenin/office2pdf
that referenced
this pull request
Sep 17, 2026
Fresh native Excel for Mac 300 DPI GT/before/after for page 2 of tests/fixtures/xlsx/issue_1181_fit_to_height.xlsx, plus a --fine-shift 0.5 layout audit and a strict render-cluster report for the same page. The title's measured dx moves from -1.255pt to -0.475pt; 348 of 354 render clusters are reused byte-for-byte (exact bbox match) from PR developer0hye#1766's report for developer0hye#1622 on this same fixture/page, and the 6 new clusters are exactly the text this fix moves. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> 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
Related issue
Fixes #1622
Testing
cargo test --locked -p office2pdf an_excel_worksheet_horizontal_value_axis_uses_the_native_label_band -- --nocapture(failed: actual gap tracked the flat old constant, not a size-scaled one)cargo test --locked -p office2pdf an_excel_worksheet_horizontal_value_axis_scales_its_label_gap_with_size -- --nocapture(1 passed)cargo test --locked -p office2pdf non_worksheet_horizontal_value_axes_keep_their_existing_label_gap -- --nocapture(1 passed)cargo test --locked -p office2pdf a_powerpoint_horizontal_value_axis_keeps_native_label_gap_at_multiple_sizes -- --nocapture(1 passed)cargo test --locked -p office2pdf --lib(3089 passed)cargo fmt --all -- --checkpython3 scripts/probe_harness.py assets/validation/issue-1622/value-axis-label-gap-size-probe.json --backend officepython3 scripts/probe_harness.py assets/validation/issue-1622/value-axis-label-gap-size-probe-1200.json --backend officepython3 scripts/compare_layout.py gt_full.pdf before.pdf --page 2 --fine-shift 0.5 --noise-floor 0.5 --json(12 value-axis label instances flagged, dy -0.79/-0.80pt)python3 scripts/compare_layout.py gt_full.pdf after.pdf --page 2 --fine-shift 0.5 --noise-floor 0.5 --json(same 12 instances resolved; nothing else in the 547-item remaining population changed)python3 scripts/compare_render.py gt_full.pdf after.pdf --page 2 --dpi 300 --fine-shift 0.5 --cluster-report assets/bugfixes/issue-1622/render-clusters-page-2.json --cluster-dispositions /tmp/cluster-dispositions.json --strict-clusters(395/395 dispositioned, PASS; dispositions reused by exact bbox match from PR fix(xlsx): quantize interior horizontal bar-chart category baselines #1765's report for XLSX: horizontal bar-chart category baselines deviate from native row placement #1621 on this same fixture/page; before/after cluster sets are bit-identical — this fix's effect sits under the 5%-fuzz clustering floor at 300 DPI)Visual impact
Visual audit
tests/fixtures/xlsx/issue_1181_fit_to_height.xlsx(unmodified; SHA-2562b4a2d8dceda58758593c88409875efbda05780559154c02bd13fef4f7a1c65b)fixassets/bugfixes/issue-1622/layout-audit.jsonassets/bugfixes/issue-1622/render-clusters-page-2.jsonassets/bugfixes/issue-1622/gt.jpg/before.jpg/after.jpg), plus a 400%-zoomed crop of both charts' "0%"/"10%" value-axis labels. At normal viewing scale the defect is invisible — a-compose differenceoverlay of the zoomed crop is what actually shows the edge-doubling ghost around both glyphs before the fix; after the fix the same overlay is flat. The measured residual drops from -0.785pt/-0.798pt (income/expenses) to 0.0pt/0.012pt against the fresh native export. A before/after self-diff at the pixel-cluster level is bit-identical (395/395, 0 new/removed clusters) — this fix's effect sits under the 5%-fuzz clustering floor at 300 DPI, so the render-cluster disposition set is reused by exact bbox match (395/395) from PR fix(xlsx): quantize interior horizontal bar-chart category baselines #1765's report for XLSX: horizontal bar-chart category baselines deviate from native row placement #1621 on this same fixture/page (unmerged but bbox-identical, since neither PR's fix moves any pixel cluster), which individually inspected and cropped each cluster this repository has open right now: rectangle-geometry clusters map to XLSX: fitted worksheet cell fills sit one sheet point above Excel's #1632 (cell fills one sheet point high) and XLSX: horizontal bar-chart value-bar fills sit ~0.544pt above native, widest bar 11pt narrow #1759 (bar fills ~0.544pt high, one 11pt-narrow bar), and the fine-shift population maps to XLSX: horizontal bar-chart category baselines deviate from native row placement #1621 (category-label baselines), XLSX: large left-aligned Cambria title starts 1.255pt left of native #1623 (title starts 1.255pt left, confirmed by crop), XLSX: right-aligned cells on the fitted budget sheet land 0.9pt left to 2.2pt right of Excel by number format #1631 (right-aligned/number-format cells 0.9-2.2pt off, confirmed on "FEB"), XLSX: fitted worksheet text keeps the physical margin origin while its paint layer snaps to Excel's sheet-space origin #1719 and XLSX: a 14-15pt bottom-aligned cell in a 19.5pt fixed row is centred as a tight row where Excel bottom-seats it #1721 (tight-row centering, including the 14-15pt header cells "january income:"/"january expenses:" sit up to 2.16pt high), XLSX: a form-control label row sits 2.16pt above Excel where the rest of the fitted sheet sits ~0.6-0.8pt off #1757 (fitted-sheet ~0.6-0.8pt offset, confirmed on "Monthly college budget"), and XLSX: repeated %INC column-header text sits 0.39pt right of native #1761 (repeated "% INC" header text 0.39pt right). None of these move between the before and after builds in this PR.assets/bugfixes/issue-1622/gt.jpgassets/bugfixes/issue-1622/before.jpgassets/bugfixes/issue-1622/after.jpgassets/bugfixes/issue-1622/compare.jpg(filed with the original issue)Visual comparison
Required inspection
Deviation audit
Checklist
Signed-off-bylineRelated: #1266, #1549