Skip to content

Support for VariableFont_wght #174567

Open
Open

Description

@M123-dev

Steps to Reproduce

I am about to use a bundled version of a font, the documentation says:

Note: Since these files are listed as assets, there is no need to list them in the fonts section of the pubspec.yaml. This can be done because the files are consistently named from the Google Fonts API (so be sure not to rename them!)

I did the same for Plus Jakarta Sans with allowRuntimeFetching = false but this lead to the error:

I/flutter ( 9128): Error: google_fonts was unable to load font PlusJakartaSans-Regular because the following exception occurred:
I/flutter ( 9128): Exception: GoogleFonts.config.allowRuntimeFetching is false but font PlusJakartaSans-Regular was not found in the application assets. Ensure PlusJakartaSans-Regular.ttf exists in a folder that is included in your pubspec's assets.

Which makes sense as I don't have PlusJakartaSans-Regular.ttf in the assets but PlusJakartaSans-VariableFont_wght.ttf which is the one you get when downloading from Google Fonts.

Expected results:
The variable font should be used.

Actual results:
It does not get used

Additional context
A workaround for just downloading the regular variant is also not possible, since when you just select the regular style on fonts.google.com also only the variable font is downloaded

https://fonts.google.com/share?selection.family=Plus%20Jakarta%20Sans

Activity

  1. guidezpl commented on May 26, 2022

    @guidezpl
    Member

    Yeah that's expected since we don't support variable fonts yet. If you only need the regular font weight, I recommend using the static font in static/PlusJakartaSans-Regular.ttf. It's smaller (95KB) than the variable font (174KB).

  2. M123-dev commented on May 26, 2022

    @M123-dev
    Author

    Thanks for the quick response @guidezpl

    If anyone else is looking for the basic font, here the link: https://github.com/tokotype/PlusJakartaSans/blob/master/fonts/ttf/PlusJakartaSans-Regular.ttf

  3. guidezpl commented on May 26, 2022

    @guidezpl
    Member

    Tip: If you download the font family from Google Fonts, it's also included in the .zip file

  4. M123-dev commented on May 26, 2022

    @M123-dev
    Author
  5. guidezpl commented on May 26, 2022

    @guidezpl
    Member

    It should be there
    Screen Shot 2022-05-26 at 19 00 03

  6. M123-dev commented on May 26, 2022

    @M123-dev
    Author

    Oh in the hurry I somehow missed the static folder, sorry for that and thanks @guidezpl

  7. added
    p: google_fontsPackage to use fonts from fonts.google.com. Supports HTTP fetching, caching, and asset bundling.
    on Feb 1, 2023
  8. added
    p: google_fontsPackage to use fonts from fonts.google.com. Supports HTTP fetching, caching, and asset bundling.
    on Aug 27, 2025
  9. transferred this issue fromon Aug 27, 2025
  10. added
    packageflutter/packages repository. See also p: labels.
    on Aug 27, 2025
  11. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    P2Important issues not at the top of the work list
    on Aug 27, 2025
  12. added
    team-designOwned by Design Languages team
    triaged-designTriaged by Design Languages team
    and removed
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listp: google_fontsPackage to use fonts from fonts.google.com. Supports HTTP fetching, caching, and asset bundling.packageflutter/packages repository. See also p: labels.team-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions