Repository navigation
Read a comment's rich text over the reader's defaults - #113
Merged
bobsingor merged 1 commit intoNov 4, 2026
Merged
Conversation
A markup annotation's /RC is its comment, which draws nothing, so it states its style over the reader's defaults, as Acrobat writes one with no body style. The parser read every annotation's /RC over its /DA and /DS. Among the comment kinds only a redact has a /DA, and it styles the overlay text: a redact's comment that stated no font read in the overlay's font, size and color, and one written with the default body read back in the overlay's style. DefaultsFromAnnotation now takes /DA, /DS, /Q and /TextColor only for a free text and a widget, whose rich text is the text they draw. EPDFAnnot_GetRichTextJSON, SetRichTextJSON and SetRichTextXHTML all go through it.
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.
A markup annotation's
/RCis its comment (ISO 32000-2 §12.5.6.2). A comment draws nothing on the page, so it states its style over the reader's defaults: Acrobat writes a note's/RCwith no body style at all. The parser read every annotation's/RCover its/DAand/DS, the base style a free text draws its text in.Among the comment kinds, only a redact has a
/DA, and it styles the overlay text ("CONFIDENTIAL"). So with a Courier 10pt red overlay:Now
CPDF_RichTextParser::DefaultsFromAnnotationtakes/DA,/DS,/Qand/TextColoronly for a free text and a widget, whose rich text is the text they draw. Any other annotation's rich text reads overCPDF_RichTextStyle{}, the same defaults the comment writer compares against.EPDFAnnot_GetRichTextJSON,EPDFAnnot_SetRichTextJSONandEPDFAnnot_SetRichTextXHTMLall go through it. Free text and form fields are unchanged, and a redact's overlay still reads from its/DAthroughEPDFAnnot_GetDefaultAppearance.Pin this after embedpdf/embed-pdf-viewer#978. Main's engine still reads a redact's overlay font through
EPDFAnnot_GetRichTextJSON; #978 reads it from/DAdirectly (EPDFAnnot_GetDefaultAppearanceFontFace). With this change and without #978, a redact whose overlay uses a registered font would read back as a standard font.Tests
RedactCommentReadsOverTheReadersDefaults, on a redact whose overlay is Courier 10pt red:/DA.It fails without the change, on both the JSON and the XHTML write. It is recorded as a layer-mode writer (6 objects).
On macOS: every
*EPDFAnnot*,*RichText*and*Redact*embedder test passes (305, 2 skipped), and the 19 rich text unit tests pass. In layer mode, the 47 rich text and comment tests pass with no unknown writers. Linux CI hasn't run yet.