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

The line height will affect the text position when text document has wrap position property enabled #2603

Open
bubble2025 opened this issue Dec 17, 2024 · 3 comments

Comments

@bubble2025
Copy link

Describe the bug
When the text layer has the wrap position property enabled, the text position will change after rendering when the line height is modified. However, this does not affect the text position on iOS or Web.

The attachment is the text Lottie sample file.
line_height_test.json

What version of Lottie did you test this on?
6.5.2

What version of Android did you test this on?
Android 14
Steps To Reproduce
Steps to reproduce the behavior:

1.Render the line_height_test.json on Android and Web.
2.The orange text has a line height (lh) of 42, and the green text has a line height (lh) of 32.
3.On Web, the text position remains unchanged, and both texts are horizontally aligned.
4.On Android, the text position will be affected.
5.If modify the orange text with lh 32, the both texts on Android will be horizontally aligned.

Web Screenshots
截圖 2024-12-17 下午1 43 50
截圖 2024-12-17 下午1 44 17
Android Screenshots
screenshot-1734414202298

@sam880222
Copy link

I also met the same issue.
Is there any solution to fix it?

@bubble2025
Copy link
Author

bubble2025 commented Jan 9, 2025

Hi @gpeal
Is there any idea?
This issue is causing trouble for our development. We can't achieve the correct spacing between the text and other layers when the text has the Wrap Position (ps) and Wrap Size (sz) properties enabled to support text wrapping.

@bubble2025
Copy link
Author

Image

Hi @gpeal
We found that the text position Y("p") in the Android text layer means that the top of Line Height("lh") if the wrap position ("sz") was enabled. But in iOS, it means the top of the text.
So if the Android changes the position Y in the Json by the below formula:
Position_Y = Position_Y - (LineHeight - TextHeight)
It will display the same position Y with iOS and Web.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants