Skip to content

Fix style cascade and rendering bugs (Phase 3 Track B Task 3)#5

Open
kevincarlson wants to merge 2 commits into
mainfrom
claude/inline-measurement-line-breaking-bht1n
Open

Fix style cascade and rendering bugs (Phase 3 Track B Task 3)#5
kevincarlson wants to merge 2 commits into
mainfrom
claude/inline-measurement-line-breaking-bht1n

Conversation

@kevincarlson

Copy link
Copy Markdown
Member

Bug 1 — Percentage font size not cascaded correctly:

  • Add FontSizePercentage float? to ParagraphStyleDef so fo:font-size="150%" can be stored without loss.
  • OdfDocumentParser.ParseParaDef splits raw font-size values into either absolute points or a percentage multiplier via new ParseFontSize helper.
  • OdfStyleResolver.ApplyPara resolves percentage values relative to the running FontSizePts at each cascade level (defaulting to 12pt at root), so Heading styles with percentage sizes produce correct point values.

Bug 2 — Bold flag not reflected in FontDescriptor:

  • OdfStyleResolver.ResolveCharacter now synchronises Font.Weight with the resolved Bold flag after the full cascade, ensuring IFontManager receives a FontDescriptor.Weight == Bold when Bold == true.

Bug 3 — Bullet points not rendered for list items:

  • OdfDocumentParser.ParseParaDef reads style:list-style-name into ParagraphStyleDef.ListStyleId so list paragraphs carry their list id.
  • OdfStyleResolver.ResolveNamedStyleId (new public method) walks the automatic-style parent chain to return the named style id; used by OdfDocumentParser.ParseParagraph to store a recognisable StyleName on ParagraphNode (e.g. "Heading_20_1" instead of auto-style "P1").
  • PaintSceneBuilder now requires IFontManager + ILokiLogger, creates a LokiTextShaper, and emits a shaped bullet GlyphRunNode before the first line of any list-item paragraph, indenting the following text by bulletWidth + 6pt. Bullet character depends on ListLevel (•/◦/▪).
  • LayoutEngine passes its font manager and logger to PaintSceneBuilder.

Add StyleResolverBugFixTests.cs with 6 regression tests covering all three bugs plus integration verification against tests/corpus/writer/simple.fodt.

https://claude.ai/code/session_01MwZSF1NiXAiAtYgDy6AHUv

claude added 2 commits March 8, 2026 13:52
Bug 1 — Percentage font size not cascaded correctly:
- Add FontSizePercentage float? to ParagraphStyleDef so fo:font-size="150%"
  can be stored without loss.
- OdfDocumentParser.ParseParaDef splits raw font-size values into either
  absolute points or a percentage multiplier via new ParseFontSize helper.
- OdfStyleResolver.ApplyPara resolves percentage values relative to the
  running FontSizePts at each cascade level (defaulting to 12pt at root),
  so Heading styles with percentage sizes produce correct point values.

Bug 2 — Bold flag not reflected in FontDescriptor:
- OdfStyleResolver.ResolveCharacter now synchronises Font.Weight with the
  resolved Bold flag after the full cascade, ensuring IFontManager receives
  a FontDescriptor.Weight == Bold when Bold == true.

Bug 3 — Bullet points not rendered for list items:
- OdfDocumentParser.ParseParaDef reads style:list-style-name into
  ParagraphStyleDef.ListStyleId so list paragraphs carry their list id.
- OdfStyleResolver.ResolveNamedStyleId (new public method) walks the
  automatic-style parent chain to return the named style id; used by
  OdfDocumentParser.ParseParagraph to store a recognisable StyleName on
  ParagraphNode (e.g. "Heading_20_1" instead of auto-style "P1").
- PaintSceneBuilder now requires IFontManager + ILokiLogger, creates a
  LokiTextShaper, and emits a shaped bullet GlyphRunNode before the first
  line of any list-item paragraph, indenting the following text by
  bulletWidth + 6pt. Bullet character depends on ListLevel (•/◦/▪).
- LayoutEngine passes its font manager and logger to PaintSceneBuilder.

Add StyleResolverBugFixTests.cs with 6 regression tests covering all
three bugs plus integration verification against tests/corpus/writer/simple.fodt.

https://claude.ai/code/session_01MwZSF1NiXAiAtYgDy6AHUv
Signed-off-by: Claude <noreply@anthropic.com>
OdfStyleResolver is internal but StyleResolverBugFixTests calls it
directly for unit testing. Add InternalsVisibleTo for
AppThere.Loki.Tests.Writer in the Format.Odf csproj so tests can
access it without changing its production visibility.

https://claude.ai/code/session_01MwZSF1NiXAiAtYgDy6AHUv
Signed-off-by: Claude <noreply@anthropic.com>
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.

2 participants