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

Update to Compose 1.6 (BC break in Text) #564

Merged
merged 5 commits into from
Dec 8, 2023
Merged

Update to Compose 1.6 (BC break in Text) #564

merged 5 commits into from
Dec 8, 2023

Conversation

hrach
Copy link
Contributor

@hrach hrach commented Oct 23, 2023

No description provided.

@hrach hrach changed the title Compose1.6 Update to Compose 1.6 Dec 5, 2023
@hrach hrach marked this pull request as ready for review December 5, 2023 14:27
@hrach hrach requested a review from a team as a code owner December 5, 2023 14:27
@hrach hrach added the feature New feature or request label Dec 5, 2023
@hrach hrach force-pushed the compose1.6 branch 2 times, most recently from b362e77 to 5aa26f2 Compare December 7, 2023 10:12
@hrach hrach changed the title Update to Compose 1.6 Update to Compose 1.6 (BC break in Text) Dec 7, 2023
@hrach
Copy link
Contributor Author

hrach commented Dec 7, 2023

Pure update of Compose without M3 (still in alpha) is crashing in loaders:
https://issuetracker.google.com/issues/311362897

@hrach
Copy link
Contributor Author

hrach commented Dec 8, 2023

Ok, now I see, the icon sizing is broken as well. 🤔

@hrach
Copy link
Contributor Author

hrach commented Dec 8, 2023

Oh n.2, it is caused by adaptive font scaling. Exploring.

@hrach
Copy link
Contributor Author

hrach commented Dec 8, 2023

Ok, so this is what is happening:

Newly, there is the non-linear scaling. Orbit's icon usage is relying on the icon's box height to be the same height as the line height of the accompanying text. I.e. 15sp text with line-height 20sp fits nicely with 20sp tall icon.

The issue now appears when the non-linear scaling applies smaller enlargement on a bigger text. All this is calculated against a sp unit value.

Therefore, in the aforementioned example, this stops working:

  • text 15sp with 1.5 font-scale is ~23sp
  • text's 20sp line-height with 1.5 font-scale is ~26sp
  • icon's 20sp height with 1.5 font-scale is ~26sp

But, this produces a different ratio between the text size and the icon size, which should be/had been ~30sp before (non-linear scaling) and now it is "only" ~26sp.


So there are these options:

  1. Ask Orbit designers to define baseline definitions for icons - this would help in many other cases and we could stop relying on the line-height calculation. But this change is a long shot.
  2. Let it be. Scaled designs are not meant to be pixel-perfect.
  3. Rework the calculation to somehow match the logic -> resolve the actual scaling for 15sp. and then rescale the icon to ~30sp.

@hrach
Copy link
Contributor Author

hrach commented Dec 8, 2023

Let's not block Compose 1.6 by this and tackle it later. I've contacted Orbit and created an issue.

@hrach hrach added this to the Q4/2023 milestone Dec 8, 2023
@hrach hrach enabled auto-merge December 8, 2023 15:39
@hrach hrach merged commit af59afc into main Dec 8, 2023
@hrach hrach deleted the compose1.6 branch December 8, 2023 15:45
@hrach
Copy link
Contributor Author

hrach commented Jan 23, 2024

The current Orbit POV is:

Let it be. Scaled designs are not meant to be pixel-perfect.

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

Successfully merging this pull request may close these issues.

2 participants