Skip to content

fix(xlsx): scale Excel worksheet bar-chart value-axis label gap with font size - #1766

Merged
developer0hye merged 2 commits into
mainfrom
fix/issue-1622-bar-value-axis-gap
Sep 16, 2026
Merged

developer0hye merged 2 commits into
mainfrom
fix/issue-1622-bar-value-axis-gap

Conversation

@developer0hye

Copy link
Copy Markdown
Owner

Summary

  • Scale the Excel worksheet horizontal bar-chart value-axis label gap with the declared font size instead of a flat 7.65pt, matching the PT+EM shape already shipped for the PowerPoint sibling constant.
  • Derive the new constants from one-factor native Excel probes that isolate the value-axis font size (8pt and 10pt are clean; 12pt and 14pt make native re-lay the plot itself and cannot isolate the term).
  • Add real-frame regression coverage plus fresh native Excel 300 DPI evidence for the budget sheet's two percentage-label lines.

Related issue

Fixes #1622

Testing

  • Pre-fix: 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 -- --check
  • python3 scripts/probe_harness.py assets/validation/issue-1622/value-axis-label-gap-size-probe.json --backend office
  • python3 scripts/probe_harness.py assets/validation/issue-1622/value-axis-label-gap-size-probe-1200.json --backend office
  • python3 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

  • No rendered PDF change
  • Rendered PDF change or visual evidence added
  • Reason: the horizontal bar-chart value-axis label rows in Excel worksheet bar charts now scale their gap with the declared font size instead of a flat constant.

Visual audit

Visual comparison

GT Before After
GT Before After

Required inspection

  • Rendered all evidence at 150 DPI or higher
  • Stored progressive JPEG quality 86 assets with metadata stripped
  • Used Codex/Claude vision to inspect the full GT/output pages, diff, and matched crops
  • Inspected matched region crops at full resolution
  • Ran compare_layout.py --audit --fine-shift PT and dispositioned every fine/large text-instance shift, rectangle geometry deviation, painted-text visibility mismatch, and visible-fill occlusion
  • Ran compare_render.py --cluster-report PATH --strict-clusters and dispositioned every material 5% fuzz diff cluster by explicit ID
  • Inventoried hairlines and border dash styles
  • Inventoried font weight, italic, and underline emphasis

Deviation audit

Check Result
Page count/order Matches GT
Element presence Matches GT
Position/size Remaining: #1621, #1632, #1721, #1757, #1759 cover pre-existing category-label, cell-fill, tight-row, fitted-sheet, and bar-fill position; the horizontal bar-chart value-axis label rows are fixed by this PR.
Rotation/flip No deviation observed
Fill Remaining: #1632, #1759
Stroke/border No deviation observed: this text-only correction changes no gridline, axis, or border stroke.
Shape outline geometry Remaining: #1759 covers pre-existing bar-fill width; no shape geometry changes from this fix.
Text content No deviation observed
Font family/weight/style Matches GT for the corrected labels
Text color Matches GT for the corrected labels
Alignment Remaining: #1623, #1631, #1719, #1721, #1761 cover pre-existing title, cell-number-format, tight-row, and repeated-header alignment; the value-axis label vertical alignment is fixed by this PR.
Line/paragraph spacing Remaining: #1760 covers the pre-existing 1-into-2 line reflow; single-line value-axis labels carry no paragraph spacing.
Clipping/overflow No deviation observed

Checklist

  • Commits include a Signed-off-by line
  • PR scope contains one root cause
  • Remaining converter or harness deviations each reference an open issue

Related: #1266, #1549

developer0hye and others added 2 commits September 17, 2026 07:08
…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>
@developer0hye
developer0hye merged commit af96fb4 into main Sep 16, 2026
18 checks passed
@developer0hye
developer0hye deleted the fix/issue-1622-bar-value-axis-gap branch September 16, 2026 23:05
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

XLSX: fitted horizontal bar-chart value labels sit about 0.61pt too high

1 participant