fontaine icon indicating copy to clipboard operation
fontaine copied to clipboard

fix(fontless): skip non-optimial fonts by google provider

Open hi-ogawa opened this issue 2 months ago • 5 comments

  • Closes https://github.com/unjs/fontaine/issues/659

hi-ogawa avatar Sep 28 '25 09:09 hi-ogawa

Deploy Preview for fontless failed.

Name Link
Latest commit 281a68570c325108a11a6cd1a47a2f9f99f75f12
Latest deploy log https://app.netlify.com/projects/fontless/deploys/68db372bb4481c00088d8402

netlify[bot] avatar Sep 28 '25 09:09 netlify[bot]

Open in StackBlitz

npm i https://pkg.pr.new/fontaine@660
npm i https://pkg.pr.new/fontless@660

commit: 281a685

pkg-pr-new[bot] avatar Sep 28 '25 09:09 pkg-pr-new[bot]

Codecov Report

:x: Patch coverage is 0% with 9 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 52.75%. Comparing base (d66809d) to head (281a685).

Files with missing lines Patch % Lines
packages/fontless/src/resolve.ts 0.00% 9 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #660      +/-   ##
==========================================
- Coverage   53.40%   52.75%   -0.65%     
==========================================
  Files          11       11              
  Lines         734      743       +9     
  Branches       93       93              
==========================================
  Hits          392      392              
- Misses        342      351       +9     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Sep 28 '25 09:09 codecov[bot]

I'm not sure about doing this by default. What about browsers that don't support woff2? (admittedly few)

I think we can add experimental option to control this, but comparing Vite's default browser compatibility https://vite.dev/guide/build.html#browser-compatibility, woff2 support is expected, so can the default be still woff2 only? (i.e. we can assume the 1st user agent of unifont request https://github.com/unjs/unifont/blob/782fab5d03f162b866670c21034965941e8a2969/src/providers/google.ts#L76-L77)

hi-ogawa avatar Sep 30 '25 00:09 hi-ogawa

Probably experimental option on fontless side is odd. We might need unifont google provider's experimental option to skip the fonts from 2nd user agent.

EDIT: made a PR on unifont https://github.com/unjs/unifont/pull/254

hi-ogawa avatar Sep 30 '25 01:09 hi-ogawa