Wrong bbox in location for vertical font#735
Conversation
📝 WalkthroughWalkthrough
ChangesVertical text flow
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@wcag-validation/src/main/java/org/verapdf/gf/model/factory/chunks/TextPieces.java`:
- Around line 31-53: Update TextPieceComparatorH and TextPieceComparatorV to add
a monotonic insertion-order tiebreaker after the existing center/end
comparisons, and assign that ordinal before textPieces.add in TextPieces.add.
Ensure distinct TextPiece instances with identical geometry compare nonzero so
every added piece is retained and indexing remains consistent.
- Around line 88-117: Update TextPieces.addSpaces to calculate the gap
direction-aware, handling descending coordinates produced by
TextPieceComparatorV so spaces are inserted when the absolute or appropriately
oriented distance between adjacent pieces exceeds threshold. Preserve the
existing ascending-order behavior and add gaps only when the directional
distance is positive and above the threshold.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 17412848-901d-41c1-828a-cfc8ab1f0b43
📒 Files selected for processing (3)
wcag-validation/src/main/java/org/verapdf/gf/model/factory/chunks/ChunkParser.javawcag-validation/src/main/java/org/verapdf/gf/model/factory/chunks/TextChunksHelper.javawcag-validation/src/main/java/org/verapdf/gf/model/factory/chunks/TextPieces.java
8c4262b to
5e05608
Compare
5e05608 to
8a6c31c
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
wcag-validation/src/main/java/org/verapdf/gf/model/factory/chunks/ChunkParser.java (1)
871-876: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winUnconditional
SEVERElogging inside a per-glyph loop.Every glyph with a missing width logs at
SEVEREunconditionally, unlike the analogous "no Unicode mapping" branch which is gated behindStaticContainers.isDataLoader(). For a font that's missing many width entries, this can flood logs at the highest severity for every glyph of every string-show operator across a document.♻️ Suggested fix
} else { - LOGGER.log(Level.SEVERE, "Missing width of glyph with code " + code + " in font " + font.getName()); + if (StaticContainers.isDataLoader()) { + LOGGER.log(Level.WARNING, "Missing width of glyph with code " + code + " in font " + font.getName()); + } width = 0.0; }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@wcag-validation/src/main/java/org/verapdf/gf/model/factory/chunks/ChunkParser.java` around lines 871 - 876, Update the missing-width branch in the per-glyph parsing logic of ChunkParser so its SEVERE log is emitted only when StaticContainers.isDataLoader() is true, matching the analogous missing-Unicode handling. Preserve assigning width = 0.0 for all missing-width glyphs.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@wcag-validation/src/main/java/org/verapdf/gf/model/factory/chunks/ChunkParser.java`:
- Around line 928-946: Guard the descriptor obtained in the TextChunk
construction flow before calling descriptor.getItalicAngle() or
descriptor.getFontFamily(). Use the established default italic-angle behavior
when the descriptor is absent, and only perform the fontNameToFontFamilyMap
update when descriptor is available; retain font-name extraction as the fallback
for empty family values.
---
Nitpick comments:
In
`@wcag-validation/src/main/java/org/verapdf/gf/model/factory/chunks/ChunkParser.java`:
- Around line 871-876: Update the missing-width branch in the per-glyph parsing
logic of ChunkParser so its SEVERE log is emitted only when
StaticContainers.isDataLoader() is true, matching the analogous missing-Unicode
handling. Preserve assigning width = 0.0 for all missing-width glyphs.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 96bcec96-eb48-4034-b895-07dc5c8aea99
📒 Files selected for processing (3)
wcag-validation/src/main/java/org/verapdf/gf/model/factory/chunks/ChunkParser.javawcag-validation/src/main/java/org/verapdf/gf/model/factory/chunks/TextChunksHelper.javawcag-validation/src/main/java/org/verapdf/gf/model/factory/chunks/TextPieces.java
🚧 Files skipped from review as they are similar to previous changes (1)
- wcag-validation/src/main/java/org/verapdf/gf/model/factory/chunks/TextPieces.java
Closes: https://trello.com/c/SCBNY4Sg
pdf.js PR: veraPDF/pdf.js#30
veraPDF-parser PR: veraPDF/veraPDF-parser#708
Summary by CodeRabbit