fix(xlsx): read self-closing drawing run properties#468
Open
developer0hye wants to merge 1 commit into
Open
Conversation
Excel writes a shape label's run properties as a self-closing element, `<a:rPr lang="en-US" sz="1100"/>`, which quick-xml reports as `Event::Empty`. The drawing reader matched `rPr` only in its `Event::Start` arm, so every attribute on that spelling was discarded and the run fell back to the renderer's default 11pt regular. The default happens to equal the common `sz="1100"`, which hid the defect until a label used another size or weight: a 14pt bold italic label still rendered 11pt regular. Extract the attribute loop into `apply_run_properties` and call it from both arms, so a run's size, bold, and italic resolve identically whether or not its `<a:rPr>` has children. No committed fixture is affected: the only self-closing run properties in the corpus use `sz="1100"`. Rendering all 68 XLSX fixtures before and after leaves 67 byte-identical in layout, and the 68th differs only by 1e-5 pt of float noise on two words, from taking Typst's explicit-11pt path instead of its default-11pt path. Fixes #466 Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
developer0hye
force-pushed
the
fix/xlsx-drawing-rpr-empty
branch
from
July 25, 2026 18:10
fb7a419 to
587acb8
Compare
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
<a:rPr>attribute loop intoapply_run_propertiesEvent::Emptyarm as well asEvent::Start, so a self-closing<a:rPr/>keeps its size, bold, and italicRelated issue
Fixes #466
Details
Excel writes a shape label's run properties as a self-closing element,
<a:rPr lang="en-US" sz="1100"/>, which quick-xml reports asEvent::Empty. The drawing reader matchedrPronly in itsEvent::Startarm, so every attribute on that spelling was discarded and the run fell back to the renderer's default 11pt regular.That default happens to equal the common
sz="1100", which hid the defect until a label used another size or weight. Parsing the same attributes in both spellings showed the split:<a:rPr lang="en-US" sz="1400" b="1" i="1"/>NoneNoneNone<a:rPr … ><a:solidFill>…</a:solidFill></a:rPr>Some(14.0)Some(true)Some(true)Only the presence of a child element changed the outcome, which is not a distinction DrawingML makes. The new tests assert both spellings resolve identically, and that
b="0"/i="0"still mean "not bold"/"not italic".Testing
cargo fmt --all -- --checkcargo test --workspacecargo clippy --workspace --all-targets --all-featurespdftotext -bboxoutputVisual impact
sz="1100", which equals the renderer default. Rendering all 68 XLSX fixtures before and after leaves 67 byte-identical inpdftotext -bboxlayout; the 68th (tests/fixtures/xlsx/WithDrawing.xlsx) differs only by 1e-5 pt on two word coordinates, from taking Typst's explicit-11pt path instead of its default-11pt path. Documents outside the corpus that use another size, bold, or italic on a self-closing<a:rPr/>will render differently — correctly — after this change.Checklist
Signed-off-byline