Skip to content

Conversation

@calda
Copy link
Member

@calda calda commented Apr 28, 2025

This PR adds support for customizing the contentsScale of text layers, to control text rendering sharpness.

Text in the animation below is aliased poorly because of how the text layer is being rasterized at a high resolution and then downscaled. As a workaround, we can reduce the contentsScale of the layer in our feature code.

Before

Screenshot 2025-04-25 at 2 07 20 PM

After, with customized contentsScale = 0.25

Screenshot 2025-04-25 at 2 06 54 PM (1)

@calda calda force-pushed the cal--text-scale branch from e4ac6a2 to d1fec2e Compare April 28, 2025 16:05
@emerge-tools
Copy link

emerge-tools bot commented Apr 28, 2025

⚠️ 1 new unused protocol, 1 build increased size

Name Version Download Change Install Change Approval
SizeTest
com.airbnb.lottie.sizetest.iOS
1.0 (1) 758.9 kB ⬇️ 27 B 2.3 MB ⬆️ 366 B (0.02%) N/A

SizeTest 1.0 (1)
com.airbnb.lottie.sizetest.iOS

⚠️ Found new unused protocol: TextContentsScaleProvider
⚖️ Compare build
⏱️ Analyze build performance

Total install size change: ⬆️ 366 B (0.02%)
Total download size change: ⬇️ 27 B

Largest size changes

Item Install Size Change
Other ⬆️ 366 B
View Treemap

Image of diff


🛸 Powered by Emerge Tools

Copy link
Contributor

@miguel-jimenez-0529 miguel-jimenez-0529 left a comment

Choose a reason for hiding this comment

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

Great addition!

Comment on lines 17 to 16
var precision: Float = 1
var precision: Float = 0.985
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add a comment about why this is not 1?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea

@calda calda merged commit a6912de into master Apr 28, 2025
13 checks passed
@calda calda deleted the cal--text-scale branch April 28, 2025 20:56
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.

3 participants