You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fix superscript and subscript baseline rendering - #32
The reason will be displayed to describe this comment to others. Learn more.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
Restore superscript and subscript baselines in RichTextArea
🐞 Bug fix🧪 Tests🕐 10-20 Minutes
AI Description
• Preserve font-size-scaled baseline offsets in styled text attributes for superscript and subscript
runs.
• Apply offsets to rendered text nodes, including zero for normal runs to prevent stale positioning.
• Add model and JavaFX regression tests for offsets and related styling.
Keep the custom character attribute and segment handler: they fit the existing RichTextArea styling extension point and use the same baseline ratios as FxRenderer. A separate rendering path would add complexity without addressing the model-to-node handoff.
Files changed (4) +100 / -1
Bug fix (2) +15 / -1
HtmlRichTextArea.javaApply baseline offsets through a segment handler+2/-0
Apply baseline offsets through a segment handler
• Registers a handler for the new baseline attribute that sets each rendered segment node's vertical translation.
RichTextRenderer.javaCarry scaled baseline offsets in text-run attributes+13/-1
Carry scaled baseline offsets in text-run attributes
• Adds a character attribute for baseline position and computes its value from the run's effective font size. Normal runs explicitly receive zero, so reused nodes can return to the baseline.
RichTextRendererTest.javaCover baseline attributes and adjacent styling behavior+33/-0
Cover baseline attributes and adjacent styling behavior
• Tests font-size-scaled subscript and superscript offsets and zero offset on normal text. Also checks inline font attributes and paragraph spacing around superscript text.
View low (1) 1. Docs still say baseline shifts are lost 🐞 Bug
Description
The new BASELINE_OFFSET attribute renders subscript and superscript shifts, but the README and
RichTextRenderer class documentation still list lost baseline shifts as an interim gap. Readers
choosing a renderer, or maintainers reviewing the remaining gaps, are therefore told this fixed
behavior is unsupported.
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution
## Issue description
The rich renderer now applies baseline shifts, but its public documentation still says it loses them.
## Fix Focus Areas
- README.md[152-156]
- src/main/java/org/jabref/htmltonode/rich/RichTextRenderer.java[29-33]
## Recommended Fix
Remove the subscript/superscript baseline-shift item from both lists of interim gaps while retaining the unresolved limitations.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Tip of the day
💡 Did you know, you can hide the parts of a finding you never read, like the evidence or the agent prompt
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
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
Validation
./gradlew test --no-daemon./gradlew guiTest --no-daemon./gradlew guiTest --tests org.jabref.htmltonode.HtmlRichTextAreaTest --no-daemongit diff --checkThe offset is scaled from the effective font size and normal text explicitly carries zero to avoid stale translation on recycled nodes.