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

Use optimized font from fontsource #2775

Merged
merged 1 commit into from
Nov 14, 2024
Merged

Use optimized font from fontsource #2775

merged 1 commit into from
Nov 14, 2024

Conversation

sandhose
Copy link
Member

@sandhose sandhose commented Nov 14, 2024

This replaces the embedded font with a package from fontsource.

The @font-face declarations are way better, with the font being split depending on the font-weight, font-style, and unicode-range.

I also removed the custom font-family variables on desktop, so that we can get the carefully-crafted fallbacks from the compound-design-tokens.

Here is a side-by-side comparison for this patch:

Screen.Recording.2024-11-14.at.11.21.22.mov

You'll notice on the left that the font swap is barely noticeable (at 10s) compared to the right (at 22s) and that the fonts are way smaller to load.

I still kept the font overrides on Android/iOS, as I assume this is for better design in embedded mode on those platforms.

@hughns
Copy link
Member

hughns commented Nov 14, 2024

The overall bundle size increases:

image

But are you saying this is okay because only the required fonts are actually loaded?

@sandhose
Copy link
Member Author

This is because public assets aren't accounted for in the bundle size, so the increase here is misleading.

This is the actual diff in size during loading:

image

@hughns hughns merged commit 3b3f776 into livekit Nov 14, 2024
7 checks passed
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.

2 participants