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

[BUG] Duplicate font listed ("Inter") #4854

Open
tgex0 opened this issue Sep 23, 2024 · 5 comments · May be fixed by #4884
Open

[BUG] Duplicate font listed ("Inter") #4854

tgex0 opened this issue Sep 23, 2024 · 5 comments · May be fixed by #4884
Labels

Comments

@tgex0
Copy link
Contributor

tgex0 commented Sep 23, 2024

Describe the bug

The font "Inter" is listed twice in the font list. Each entry has its own different set of variants (italic, medium, regular, etc.) but if you select either font, both radio buttons are highlighted. See screenshot.

Steps to reproduce

Steps to reproduce the behavior:

  1. Go to 'General'
  2. Click on any font option to bring up the font list
  3. Scroll down and you'll see the two entries for "Inter"
  4. Select either one and both will be selected

Expected behavior

I'd expect only once instance of each font to be listed (and only one radio button to be selected at any one time).

Screenshots

1727090179912

Device information

  • Device: POCO X5 5G
  • OS: HyperOS 1.0.6.0 (stock, Android 14)
  • App version: Lawnchair 14.Dev.(d7e3f32) (Play Store version) and current dev (dfccdae)

Additional context

No response

@tgex0 tgex0 added the bug label Sep 23, 2024
@tgex0
Copy link
Contributor Author

tgex0 commented Sep 24, 2024

I've gone down a rabbit hole regarding the inner workings of Lawnchair's font system over the last couple of days and I think I've figured it out.
The solution is actually quite simple (just rename the internal font's label in the GoogleFontsListing.kt file) but I wanted a better understanding of what's going on to be sure that my solution was not going to break anything.

I'll put together a pull request soon but, in the meantime, I'll put my intentions here:

  • Update the internal font from Inter v3.12 to Inter v4.0 (released November 2023... v4 has the same license as v3)
  • Label the font "Inter v4" to avoid a duplicate name collision with the Google Fonts "Inter" font
  • Update the default/internal font labels (seen on the General page) so that they match the format used when a different font is selected (i.e. append variant name to family name)

(I've already tested this myself in a custom build and it all works great.)

This seems like a good opportunity to update the internal font and keep things up-to-date.
Please let me know if updating the font is OK or too radical an idea. v4.0 is stable and almost indistinguishable from v3.12.

If you'd rather not update the font, please let me know. I could just name the internal font "Inter v3" instead.
Thanks.

@tgex0
Copy link
Contributor Author

tgex0 commented Sep 24, 2024

Back to the drawing board... Unless the label matches the actual font name, the variant styles do not display correctly in the drop-down menu or in the default/internal font labels (on the General page). It's a small thing but it's a backward step.

Incidentally, the drop-down variant menu for the internal font lists 3 different italic variants, none of which are actually available. Also, the drop-down variant menu quite often needs to be opened twice to see the actual variant styles.

I can see why the font section is labelled 'experimental'.
I'll keep thinking about things though and if I come up with anything, I'll post back.

(We could still update the internal font without breaking anything, though.)

@tgex0
Copy link
Contributor Author

tgex0 commented Sep 25, 2024

Perhaps the easiest solution would be to filter the Inter font from the Google Fonts list (so that there is only one Inter font: the internal one) and then add the missing variants to the internal Inter font so that they match all the variants that were available in the Google Fonts version.

@tgex0
Copy link
Contributor Author

tgex0 commented Sep 26, 2024

On further investigation,. both Inter entries use the Google Fonts version (neither uses the internal version), even though they have different sets of variants. Tested by replacing the internal Inter font files with an Inter Italic variant (which is not available in the Google Fonts version of Inter). The italic variant is used on first startup but not seen again when selecting either of the Inter versions from the font list (it is possible to separate the radio buttons if the variants of the two versions don't match).

With this in mind, I think the easiest option might be to simply remove the second Inter entry (leaving the original Google Fonts version).
The only drawbacks are that if the Google Fonts somehow don't load, then the font list would be empty and there would be no way to reinstate the internal Inter font after choosing a custom font (via TTF or OTF file), but this seems to be the case at the moment anyway.

I think I'll leave this to the devs for the time being.
After all, the font section is still experimental.

Edit:
If the Google Fonts did not load, the font list would not be empty... the three sans-serif system fonts would still be there.

@tgex0
Copy link
Contributor Author

tgex0 commented Sep 29, 2024

I'm still working on this (deeper down the rabbit hole)...

I should soon be able to put together a PR which addresses several different font issues:

  1. Testing shows that both Inter fonts currently listed in the font list are the same Google Font (but shown with different variants). Neither is the internal Inter font.
  2. The 2nd Inter font entry lists italic variants which are not available. This font entry can be removed from the list completely.
  3. The internal Inter font can be updated (from v3.12 to v4.0) and added to the font list (with all 18 available variants) so that users can revert to the default font if desired.
  4. The internal Inter font can be renamed (perhaps "Inter v4.0") to differentiate itself from the Google Fonts version.
  5. When a font is selected, the family and variant are both displayed on the General settings page with the exception of the default font which reads "Inter" instead of "Inter Regular". (Easy fix.)
  6. When first visiting the font list, no radio button is selected. The default font should be listed and selected. Item 3 above will fix this.
  7. During testing, I notice that AssetFont and ResourceFont font types cannot be added to the font list without issue. When first selecting one of these font types (which don't actually appear in the font list at the moment), the radio button is selected but when leaving the font list, the font is not applied and going back to the font list, the radio button is no longer selected. I'll fix this not-yet-a-bug as I plan to add the internal Inter font to the font list as a ResourceFont.
  8. The Google Fonts list can be updated (with 78 new fonts).

It's still a work-in-progress but it's taking shape and tests are going well. I just thought I'd give anyone following this issue an update to let them know that I've not abandoned it.

@tgex0 tgex0 linked a pull request Oct 10, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant