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

feat(TextFormatter): Support vertical alignment, overflow, line height #408

Merged

Conversation

steeltomato
Copy link
Contributor

Enhances the XTextFormatter class to...

  • Specify vertical alignment within the given XRect
  • Specify if overflow is allowed, when true the Height of the XRect is ignored and all text is placed
  • Specify a custom line height, overriding the height detected from the font
  • Calculate the bounding box of the text after layout (not exposed)

Additionally, this seemed like a good opportunity to introduce some sort of unit testing and settled on visual facts. I created these on OSX and suspect they may not match across all platforms due to font anti-aliasing. Putting this out for initial feedback and will do some further testing when I have chance.

This introduces a dependency in Magick.NET within the .Test project to perform the visual diff. If differences are found, the test helper will output a _diff.png file to aid in assessing the change.

@ststeiger ststeiger merged commit cdf089b into ststeiger:master Jan 16, 2024
@ststeiger
Copy link
Owner

Merged.

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