Repository navigation
Read and write a markup annotation's comment as rich text - #978
Merged
Merged
Conversation
The release brings fork PRs 110 to 112: a markup annotation's comment written as rich text (EPDFAnnot_SetRichTextJSON writes /RC and /Contents on every markup kind), linearized files opened through the layer in layer-mode tests, and upstream PDFium up to 2b52a82ab (Nov 2), where CMYK images under a soft mask or a blend mode convert like any other. No function is added; runtime-src moves to the pin.
/RC is every markup annotation's comment (ISO 32000-2 §12.5.6.2). Every markup kind now has `richText`, the RichTextDocument free text has, or null for a plain comment, with `contents` its plain projection. Rich text brings its contents; contents alone on a formatted comment rewrite its paragraphs over its body, so /RC follows instead of keeping the old text other PDF apps show; richText: null drops the formatting. Contents and rich text given together must agree, line breaks however spelled. engine-services: each markup kind's reader reads its comment's /RC, and a write sets /RC with /Contents through EPDFAnnot_SetRichTextJSON, leaving the appearance. A comment body that names no font reads as Helvetica and is written back naming none. A redact's overlay font now reads from its /DA alone (EPDFAnnot_GetDefaultAppearanceFontFace): its rich text is its comment, and a comment in another font changed it. The rich text schemas move to dto/RichText.schema.ts and are named wire components, so the contract and SDK carry the model once. The pinned export hashes move because a read's richText now sits beside the base fields.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch had an error being deployed
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.
What changes
/RCis every markup annotation's comment (ISO 32000-2 §12.5.6.2): the formatted text its popup shows. Only free text hadrichText, so a note's formatted comment couldn't be read or written. Editing one's text also had a bug: the update set/Contentsand left Acrobat's old/RC. Acrobat shows/RCwhen it's there, so it kept showing the old text. (Checked on a note written by Acrobat 26.)Now every markup kind (text, line, square, circle, polygon, polyline, the four text markups, caret, stamp, ink, file attachment, redact) has
richText, the sameRichTextDocumentfree text has:richText: null;contentsis always the plain text.contents.contentsalone on a formatted comment rewrites its paragraphs over its body, so/RCfollows instead of going stale.richText: nulldrops the formatting and keeps the text.contentsandrichTextgiven together must agree, on every kind now, not only free text. Line breaks count the same however they're spelled (Acrobat's\n, our\r).By layer:
EPDFAnnot_SetRichTextJSONwrites/RCand/Contentson every markup kind, and nothing else, as Acrobat does), Svelte and npm package #111 (linearized test files go through the layer) and the S16 upstream sync (readAttachmentContent throws WASM error. #112). No function is added.markupBaseFieldsgives the markup kindsrichText; free text keeps its own.resolve/comment.tsholds the agreement check and the follow rules for drafts and patches.dto/RichText.schema.tsand become named wire components.EPDFAnnot_SetRichTextJSON;nullremoves/RC./DAalone (EPDFAnnot_GetDefaultAppearanceFontFace), not from its rich text. That rich text is the comment, so a comment in another font changed the overlay's font.api:sync. The two schemas are named once, which makes the TypeScript SDK 439 lines smaller.Not in this PR:
/RCover the annotation's/DAdefaults, and a redact is the only comment kind with a/DA. So a redact's comment with no font of its own reads in the overlay's font, size and color, where Acrobat shows its default.Testing
Fork (Write a markup annotation's comment as rich text runtime#110, released): Acrobat's note read as rich text, a comment written as Acrobat writes one, Acrobat's comment written back unchanged, and a link and a popup refused.
Conformance on the local (wasm) and cloud engines:
null;contentsrewrite a formatted comment, andnullmakes it plain;Export hashes: both pinned export hashes moved, because a read's
richTextnow sits beside the base fields. Moving it back to the end reproduces the old hashes exactly.Suites, on a runtime built from the release's libraries (darwin-arm64, wasm32), with main merged (Format the text typed next at a caret, and a selected box's whole text #975):
@embedpdf/engine@cloudpdf/engineThe full engine runs came before the last hash update; their export and mutation files were rerun after it.
Checks: typecheck of the 72 packages that depend on engine-core (118 turbo tasks) and
api:check.