Skip to content

feat(api)!: TextStyle::font_name is a string of its own - #900

Merged
andiwand merged 1 commit into
mainfrom
feat/font-name-string
Sep 13, 2026
Merged

feat(api)!: TextStyle::font_name is a string of its own#900
andiwand merged 1 commit into
mainfrom
feat/font-name-string

Conversation

@andiwand

@andiwand andiwand commented Sep 13, 2026

Copy link
Copy Markdown
Member

🤖 Generated with Claude Code

The second of the three public-API changes before the major. Independent of the other two.

The change. TextStyle::font_name was a std::optional<std::string_view> borrowing from the document that produced the style. A style could not outlive its document, and since #895 made TextStyle an input to Text::set_style, a caller could not build one with a font name safely. It is a std::optional<std::string> now.

What follows from it.

  • The .doc and .ppt style registries carried the font names only to keep the views alive; they take the resolved styles alone now. The .xls registry keeps its fonts, which the XF records index.
  • The python style getters drop the keep-alive they needed only for the borrowed name, and font_name is a plain read-write property.
  • The Java and Objective-C converters pass a font name through to C++ instead of refusing it themselves; Text::set_style refuses it as before, and the Swift test that expects that still passes.
  • The JNI string helper's string_view overload goes, having no caller left.

Verified. 908 tests across the document, html, legacy MS, markdown, odf and ooxml suites pass, with the C++ refusal of a font name pinned in document_edit_test. Every html output page is byte-identical to the reference in both corpora. JUnit 63 and pytest 83 pass, python sets and reads a font name, and the macOS Apple slice built for both archs with swift test passing. The thirteen touched translation units are clean under Homebrew clang -Wall -Wextra -Werror.

Changelog entry added, marked breaking.

The `std::string_view` borrowed from the document that produced the style,
so a style could not outlive its document and a caller could not build one
with a font name, which `Text::set_style` made a real gap. It is a
`std::string` now. The `.doc` and `.ppt` registries stop carrying the font
names for lifetime alone, the python style getters drop the keep-alive they
needed only for it, and the Java and Objective-C converters pass a font name
through to C++, which refuses it as before.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0137vd79NGaB8nfLsdPoghM4
@andiwand
andiwand force-pushed the feat/font-name-string branch from 7d7c74c to 7957aac Compare September 13, 2026 17:56
@andiwand
andiwand merged commit 83bff26 into main Sep 13, 2026
23 checks passed
@andiwand
andiwand deleted the feat/font-name-string branch September 13, 2026 17:57
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