Skip to content

feat(bindings): Text::set_style in python, java, objective-c and the npm package - #898

Merged
andiwand merged 1 commit into
mainfrom
feat/bind-set-style
Sep 13, 2026
Merged

feat(bindings): Text::set_style in python, java, objective-c and the npm package#898
andiwand merged 1 commit into
mainfrom
feat/bind-set-style

Conversation

@andiwand

@andiwand andiwand commented Sep 13, 2026

Copy link
Copy Markdown
Member

🤖 Generated with Claude Code

The last step of the inline formatting plan. Rebased onto main after #897 merged.

  • python: Text.set_style(TextStyle). TextStyle was already constructible with writable fields.
  • java: Text.setStyle(TextStyle). TextStyle gets a public no-arg constructor and writable fields, so a caller builds the delta it passes; the native side reads the non-null fields, a Java enum by ordinal. A fontName refuses with UnsupportedOperation before it reaches C++, since the C++ one borrows from a document.
  • objective-c: -[ODRText setStyle:error:]. ODRTextStyle gets a public init and readwrite properties; -handle in the private category unboxes them, and a fontName refuses the same way.
  • npm: Document.setTextStyle(id, style) takes the page's style object, typed as TextStyle in index.d.ts, and replays it through the edit envelope, so the wire's parser validates it and an unknown property is an OdrError.

Verified on this machine after the rebase: python 83 passed (one new); JUnit 63 successful (one new); wasm node suite 50 passed (two new); the macOS slice built for both archs and swift test passed with the two new cases. The JNI and python binding sources are clean under Homebrew clang -Wall -Wextra -Werror.

docs/design/document-editing.md marks the plan landed. Changelog entry added.

Base automatically changed from feat/format-editor to main September 13, 2026 17:15
…npm package

Python binds `Text.set_style(TextStyle)` as it stands. Java and Objective-C
get the same, with `TextStyle` constructible and its fields writable, so a
caller builds the delta it passes; a `fontName` is refused before it reaches
C++, since the C++ one borrows from a document. The npm package's
`setTextStyle(id, style)` takes the page's style object and replays it
through the envelope, so the wire's parser validates it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0137vd79NGaB8nfLsdPoghM4
@andiwand
andiwand merged commit 54cd0a9 into main Sep 13, 2026
30 checks passed
@andiwand
andiwand deleted the feat/bind-set-style branch September 13, 2026 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant