Skip to content

feat(ppt): per-run character formatting from StyleTextPropAtom#609

Open
andiwand wants to merge 1 commit into
mainfrom
feat/ppt-character-formatting
Open

feat(ppt): per-run character formatting from StyleTextPropAtom#609
andiwand wants to merge 1 commit into
mainfrom
feat/ppt-character-formatting

Conversation

@andiwand

Copy link
Copy Markdown
Member

🤖 Generated with Claude Code

Adds per-run character formatting to the legacy .ppt decoder: bold, italic, underline, font size, font name, and font color, replacing the flat font_size = 11pt placeholder.

How

  • Each text atom (TextCharsAtom/TextBytesAtom) is now kept raw until the StyleTextPropAtom ([MS-PPT] 2.9.44) that most closely follows it — in the drawing's ClientTextbox and in the outline (SlideListWithText) alike. Its character runs (counts in UTF-16 units, also covering the implicit final paragraph mark) split the text into styled spans; the tree becomes frame → paragraph → span → text.
  • The paragraph-level runs that precede the character runs in the atom are skipped field-by-field via their PFMasks (including the variable-size tabStops).
  • Font names come from the FontCollection (RT_EnvironmentFontEntityAtom, indexed by recInstance), interned in the registry.
  • Colors are ColorIndexStructs: explicit sRGB values (index 0xFE) are used; scheme indexes are left unset (they need the slide's color scheme — documented as open work along with master-inherited formatting via TxMasterStyleAtom; unformatted text defaults to 18pt as an approximation).
  • Paragraphs store their first run's style, keeping empty-paragraph height.

Validation

On the style-various-1.ppt fixture the titles now render as 44pt Arial with explicit black, and slide 7's link text renders underlined blue 32pt:

<x-s style="font-family:Arial;font-size:32pt;text-decoration:underline;color:#0000ff;"><x-s>https://www.google.at/</x-s></x-s>

Tests

  • OldMs.ppt_parse_style_text_prop_atom — inline bytes: PF-run skipping incl. mask-dependent fields, CFStyle bold/italic, fontRef/size, sRGB color.
  • OldMs.ppt_style_various — extended with style assertions against the real fixture (44pt Arial black title; underlined blue 32pt link).
  • All OldMs.* and ppt HtmlOutputTests pass.

Note: reference HTML

Rendered .ppt HTML changes (styled spans instead of flat 11pt); the ppt reference outputs under test/data/reference-output/odr-public/output/ppt/ need regenerating for the compare-html CI step (flagged separately, same as #606/#608).

https://claude.ai/code/session_01R9Z3kyUaHNkJacAEggevHH

Parse the StyleTextPropAtom ([MS-PPT] 2.9.44) that follows each text
atom — in the drawing's ClientTextbox as well as the outline
(SlideListWithText) — and split slide text into styled spans carrying
bold, italic, underline, font size, font name (FontCollection) and
explicit sRGB colors. Replaces the flat 11pt placeholder; unformatted
text defaults to 18pt, approximating the unread master text styles.

Paragraph-level runs are skipped field-by-field via their PFMasks;
paragraphs store their first run's style so empty paragraphs keep
their height. Scheme-indexed colors and master-inherited formatting
remain open (documented in AGENTS.md).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R9Z3kyUaHNkJacAEggevHH
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