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 scaling and tracking for dynamic text #1635

Merged
merged 2 commits into from
Oct 2, 2020

Conversation

mgod
Copy link
Contributor

@mgod mgod commented Sep 30, 2020

Close #1183. Close #1310.

This has a couple of related bugfixes.

  1. Fix the scale/positioning of the text relative to the parent (from PR fixed: Using Text Delegate and scaletype then the textfield wont posi… #1583, thanks @pikaMouse)
  2. Include text tracking values in the line width used for text alignment
  3. Scale the text tracking values based on the font size rather than the parent size (parent size adjustment is already handled when we're calculating tracking values)
  4. Include all bytes for multibyte characters when calculating canvas offsets for characters.

From #1183, here's the updated test animation result with the text correctly centered between the lines:

Screen Shot 2020-09-30 at 11 02 54 AM

And here's the before and after for the same sample with some 🦁 emojis added in to show multibyte character measurement:

Before:
Screen Shot 2020-09-30 at 11 10 47 AM

After:
Screen Shot 2020-09-30 at 11 11 43 AM

@LottieSnapshotBot
Copy link

Snapshot Tests
28: Report Diff

Copy link
Collaborator

@gpeal gpeal left a comment

Choose a reason for hiding this comment

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

The diffs look great. Thanks!

@gpeal gpeal merged commit f5517cd into airbnb:master Oct 2, 2020
gpeal pushed a commit that referenced this pull request Oct 4, 2020
Close #1183. Close #1310.

This has a couple of related bugfixes.

Fix the scale/positioning of the text relative to the parent (from PR #1583, thanks @pikaMouse)
Include text tracking values in the line width used for text alignment
Scale the text tracking values based on the font size rather than the parent size (parent size adjustment is already handled when we're calculating tracking values)
Include all bytes for multibyte characters when calculating canvas offsets for characters.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants