engine icon indicating copy to clipboard operation
engine copied to clipboard

[web] support manual loading of manifest fonts

Open yjbanov opened this issue 2 years ago • 8 comments

Add support for manual loading of manifest fonts (i.e. those specified in pubspec.yaml):

  • Add a new option loadManifestFontsBeforeAppMain in the configuration object (defaults to true). If not specified or set to true, font loading works like it does today: manifest fonts are loaded prior to calling the main() function. If set to false, the engine does not load manifest fonts automatically, but does allow rendering UI. Attempting to render text without fonts will result in blank space in place of the text.
  • Add a new function loadManifestFonts, which can be called explicitly to load manifest fonts. After this function completes successfully, text can be rendered using manifest fonts.

Fixes https://github.com/flutter/flutter/issues/134594

yjbanov avatar Sep 13 '23 00:09 yjbanov

Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change).

If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review.

Changes reported for pull request #45749 at sha 5951b09efa590a277ddc42a8163ade552328611a

flutter-dashboard[bot] avatar Sep 13 '23 01:09 flutter-dashboard[bot]

@yjbanov said this is still on his radar.

goderbauer avatar Dec 05 '23 23:12 goderbauer

@jacobsimionato Would this still be valuable? Or have users found other ways to achieve what this aims to fix?

yjbanov avatar Feb 13 '24 23:02 yjbanov

@jacobsimionato Would this still be valuable? Or have users found other ways to achieve what this aims to fix?

Sure! Just checking https://github.com/flutter/flutter/issues/122282 and https://github.com/flutter/flutter/issues/108660, people do have this issue (me included). It would be great if you could unload certain assets or, as proposed, just lazy load them.

flawnn avatar Mar 06 '24 14:03 flawnn

I think this would still be useful, though I'd like to revisit it with an additional data point - another internal Google app that I'm going to optimize over the next couple of weeks where font loading is currently an issue. Maybe I can get back to you in a few days once I've taken a look at this second app?

Though it does sound like there is demand for this outside Google also!

jacobsimionato avatar Mar 08 '24 04:03 jacobsimionato

This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold.

flutter-dashboard[bot] avatar Mar 28 '24 04:03 flutter-dashboard[bot]

Closing for now. The demand seems to have waned for this feature. We might come back to it at some point.

yjbanov avatar May 10 '24 17:05 yjbanov

Closing for now. The demand seems to have waned for this feature. We might come back to it at some point.

I'm still really keen for this. I've had to implement a custom font loader for use on the web to improve our app startup time.

Would love to see this continued

josh-burton avatar May 10 '24 20:05 josh-burton

If someone would like to take this over, go ahead. I'm unlikely to get to it any time soon.

yjbanov avatar Jul 16 '24 17:07 yjbanov