Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow IParagraphPortion.Font to be null #713

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

drasmith
Copy link

@drasmith drasmith commented Jun 20, 2024

In our usage, we found instances where TextFrame.ShrinkText would throw a null reference exception due to ContentFrames not having font's for every portion. Changed IParagraphPortion to be nullable and cleaned up code so that it can skip null fonts


PR-Codex overview

This PR updates nullable references in text handling classes for font properties.

Detailed summary

  • Made Font property nullable in IParagraphPortion.cs.
  • Updated font property access to handle nullability in IParagraph.cs.
  • Adjusted font property access to handle nullability in TextFrame.cs.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

@ashahabov
Copy link
Member

@drasmith, thank you for the Pull Request!

Could you please provide a unit test for these changes.

paint.TextSize = (float)firstPortion.Font.Size;
var typeFace = SKTypeface.FromFamilyName(firstPortion.Font.LatinName);
paint.TextSize = (float)(firstPortion.Font?.Size ?? 11);
var typeFace = SKTypeface.FromFamilyName(firstPortion.Font?.LatinName ?? "Arial");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm not mistaken, the default font in the latest PowerPoint is "Aptos". Please change this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@drasmith, did you have time to check this out?

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.

None yet

2 participants