jay3332 / ril

Rust Imaging Library: A high-level imaging crate for Rust.
https://crates.io/crates/ril
MIT License
80 stars 10 forks source link

Adding line height support on `TextLayout`. #35

Open tillderoquefeuil opened 3 weeks ago

tillderoquefeuil commented 3 weeks ago

This commit introduces a new method with_line_height in the TextLayout struct, which allows setting the line height of the text. This method must be called before adding any text segments. The commit also includes an example usage of the with_line_height method in the line_height.rs file.

All tests still work, the code is formatted and clippy does not show error on added code.

Summary by Sourcery

Add line height support to the TextLayout struct by introducing the with_line_height method, and provide an example usage in a new example file.

New Features:

Enhancements:

sourcery-ai[bot] commented 3 weeks ago

Reviewer's Guide by Sourcery

This pull request adds line height support to the TextLayout struct in the ril library. It introduces a new method with_line_height and includes an example demonstrating its usage.

File-Level Changes

Change Details Files
Added a new method with_line_height to the TextLayout struct
  • Implemented with_line_height method that takes a line_height parameter of type f32
  • Updated the LayoutSettings struct with the new line_height value
  • Added a documentation comment explaining that this method must be called before adding any text segments
src/text.rs
Created a new example to demonstrate the usage of the with_line_height method
  • Implemented a new example that creates a TextLayout with custom line height
  • Demonstrated the use of with_line_height method in conjunction with other text layout options
  • Showed how to create an image with multi-line text using the new line height feature
examples/line_height.rs

Tips - Trigger a new Sourcery review by commenting `@sourcery-ai review` on the pull request. - Continue your discussion with Sourcery by replying directly to review comments. - You can change your review settings at any time by accessing your [dashboard](https://app.sourcery.ai): - Enable or disable the Sourcery-generated pull request summary or reviewer's guide; - Change the review language; - You can always [contact us](mailto:support@sourcery.ai) if you have any questions or feedback.