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

Fix: ensure stroke is applied to all lines in multiline text with emojis #45

Open
wants to merge 1 commit into
base: 2.0
Choose a base branch
from

Conversation

Scr44gr
Copy link

@Scr44gr Scr44gr commented Oct 18, 2024

In the original implementation, there was logic that set stroke_width to 0 during the text rendering process in the getmask2 function call. This caused subsequent lines of text to lose their stroke, as the stroke width was effectively disabled after the first line.

The fix involved removing the part where stroke_width was set to 0 after the stroke was applied. By doing this, the stroke_width parameter is preserved across all lines of the multiline text, ensuring that each line has its proper stroke.

Additionally, the stroke_width argument was removed from the getmask2 call. This ensures that the stroke is applied consistently throughout all iterations when rendering the text. Instead of resetting the stroke for each line, the value of stroke_width remains intact, allowing the stroke to be applied uniformly to each line of text, including those that come after the first line.

This change ensures that the stroke is not lost when processing multiple lines of text, which was the core issue when rendering multiline text with emojis.

Summary by Sourcery

Bug Fixes:

  • Fix stroke application to ensure it is applied to all lines in multiline text with emojis by not setting stroke_width to 0.

Ensure not setting stroke_width to 0 so that in the next iteration the text has its respective stroke_width.
Copy link
Contributor

sourcery-ai bot commented Oct 18, 2024

Reviewer's Guide by Sourcery

This pull request fixes an issue with stroke application in multiline text containing emojis. The main change involves removing the reset of stroke_width to 0 and the passing of stroke_width to the getmask2 function.

Class diagram for changes in stroke application

classDiagram
    class Core {
        +getink(fill)
    }
    Core : -stroke_width
    Core : -getmask2(..., stroke_width, ...)
    note for Core "Removed stroke_width reset and its usage in getmask2"
Loading

File-Level Changes

Change Details Files
Remove stroke_width reset and parameter in text rendering
  • Remove the line that sets stroke_width to 0
  • Remove stroke_width parameter from getmask2 function call
pilmoji/core.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @Scr44gr - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Have you tested this change with various types of text input, including those without emojis? Please ensure comprehensive testing to avoid unintended side effects.
  • Consider improving the commit message to clearly explain the problem this change is solving and why it's necessary. This will help future maintainers understand the reasoning behind the modification.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

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