flutter-packages icon indicating copy to clipboard operation
flutter-packages copied to clipboard

[google_fonts] Enhance font fallback

Open gonuit opened this issue 2 years ago • 0 comments

Description

The main motivation behind this change is to improve the font fallback mechanism. This makes it possible to switch to another font if the current one does not support certain glyphs.

For example, replace all emoticons with an emoji font:

/* ... */
theme: GoogleFonts.latoTextTheme(
  GoogleFonts.notoColorEmojiTextTheme(theme.textTheme),
);
/* ... */

With these changes, the app will still use the lato font, but all emoji will be replaced by notoColorEmoji.

Tests

Verifying that the text style correctly falls back to the next available font when the primary font is unavailable.

Checklist

gonuit avatar Nov 17 '23 00:11 gonuit