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 Font Awesome 6.7.2 (from 5.0.13), minimize size #3504

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

flodolo
Copy link
Collaborator

@flodolo flodolo commented Jan 2, 2025

Not sure if there's more to this.

I took the all.css file and copied over as fontawesome-all.css, corrected the font rules to only use .woff2.

For example, I changed

@font-face {
  font-family: 'Font Awesome 6 Brands';
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("../webfonts/fa-brands-400.woff2") format("woff2"), url("../webfonts/fa-brands-400.ttf") format("truetype"); }

to

@font-face {
  font-family: 'Font Awesome 6 Brands';
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("../fonts/fa-brands-400.woff2") format("woff2");
}

@flodolo flodolo changed the title Update to Font Awesome 6 Update to Font Awesome from 5.0.13 to 6.7.2 Jan 3, 2025
@flodolo flodolo changed the title Update to Font Awesome from 5.0.13 to 6.7.2 Update Font Awesome from 5.0.13 to 6.7.2 Jan 3, 2025
@eemeli
Copy link
Member

eemeli commented Jan 3, 2025

This would add about 180kB to Pontoon's first load size. What is the benefit of this change?

@flodolo
Copy link
Collaborator Author

flodolo commented Jan 3, 2025

This would add about 180kB to Pontoon's first load size. What is the benefit of this change?

Use a maintained, up-to-date version of an external dependency?

@flodolo
Copy link
Collaborator Author

flodolo commented Jan 3, 2025

Look like v5 is still supported (latest version being 5.15.14)
https://fontawesome.com/support#is-font-awesome-5-still-being-supported

@flodolo
Copy link
Collaborator Author

flodolo commented Jan 3, 2025

This would add about 180kB to Pontoon's first load size. What is the benefit of this change?

With that said, I wonder if we should look into optimizing this 🤔

@flodolo flodolo marked this pull request as draft January 3, 2025 13:46
@flodolo
Copy link
Collaborator Author

flodolo commented Jan 3, 2025

I've looked into optimizing the font, but it's a ton of work just to identify which icons we're using in the code 😞

@flodolo
Copy link
Collaborator Author

flodolo commented Jan 5, 2025

Tried minimizing the font via Python+fonttools, seems to work locally and the gain is about 110k
https://gist.github.com/flodolo/ba0bd409bc1612945b8e436f175abc1f

One downside is that the font binary file changes at every run 🤔

@flodolo flodolo changed the title Update Font Awesome from 5.0.13 to 6.7.2 Update to Font Awesome 6.7.2 (from 5.0.13), minimize size Jan 5, 2025
@flodolo
Copy link
Collaborator Author

flodolo commented Jan 5, 2025

If the approach sounds reasonable, we should put the script in the pontoon-script repo, and add a README in the folder.
Maybe even rename the fonts, e.g. adding -pontoon, to make it clear it's not the standard full font.

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