Skip to content

Commit 5af5f50

Browse files
authored
Update Google Fonts to v8.0.0 with new and removed fonts (#10785)
`dart generator/generator.dart` adds support for numerous new fonts and removed several deprecated or replaced fonts. This corresponds to directory 12, generated in January 2026 (generated quarterly from now on). Updated the diff generator to match the current `CHANGELOG.md` format. More duplicates were identified when initially generating. After investigation, I found that 2 fonts were producing combinations with multiple widths. This PR modifies `_deduplicateFonts` to remove these non-standard width (100) variants. Fixes #180333
1 parent d0c7d1f commit 5af5f50

18 files changed

Lines changed: 3172 additions & 650 deletions

‎packages/google_fonts/CHANGELOG.md‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1+
## 8.0.0
2+
3+
- Added fonts:
4+
- `Amarna`
5+
- `BBH Bartle`
6+
- `BBH Bogle`
7+
- `BBH Hegarty`
8+
- `Cause`
9+
- `Elms Sans`
10+
- `Geom`
11+
- `Google Sans`
12+
- `Google Sans Flex`
13+
- `Kedebideri`
14+
- `Lilex`
15+
- `Momo Signature`
16+
- `Momo Trust Display`
17+
- `Momo Trust Sans`
18+
- `Noto Sans Syriac Western`
19+
- `Science Gothic`
20+
- `Sekuya`
21+
- `Stack Sans Headline`
22+
- `Stack Sans Notch`
23+
- `Stack Sans Text`
24+
- Removed fonts:
25+
- `Chiron GoRound TC`
26+
- `Chiron Sung HK`
27+
128
## 7.1.0
229

330
- Adds support for WOFF2 and WOFF font formats on web platforms when loading fonts bundled with the app, providing improved performance and smaller bundle sizes.

‎packages/google_fonts/generator/families_supported‎

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ Alumni Sans Pinstripe
5858
Alumni Sans SC
5959
Amarante
6060
Amaranth
61+
Amarna
6162
Amatic SC
6263
Amethysta
6364
Amiko
@@ -138,6 +139,9 @@ Averia Serif Libre
138139
Azeret Mono
139140
B612
140141
B612 Mono
142+
BBH Bartle
143+
BBH Bogle
144+
BBH Hegarty
141145
BIZ UDGothic
142146
BIZ UDMincho
143147
BIZ UDPGothic
@@ -291,6 +295,7 @@ Castoro
291295
Castoro Titling
292296
Catamaran
293297
Caudex
298+
Cause
294299
Caveat
295300
Caveat Brush
296301
Cedarville Cursive
@@ -314,9 +319,7 @@ Cherry Swash
314319
Chewy
315320
Chicle
316321
Chilanka
317-
Chiron GoRound TC
318322
Chiron Hei HK
319-
Chiron Sung HK
320323
Chivo
321324
Chivo Mono
322325
Chocolate Classical Sans
@@ -438,6 +441,7 @@ Edu VIC WA NT Hand
438441
Edu VIC WA NT Hand Pre
439442
El Messiri
440443
Electrolize
444+
Elms Sans
441445
Elsie
442446
Elsie Swash Caps
443447
Emblema One
@@ -540,6 +544,7 @@ Gentium Book Plus
540544
Gentium Plus
541545
Geo
542546
Geologica
547+
Geom
543548
Georama
544549
Geostar
545550
Geostar Fill
@@ -560,7 +565,9 @@ Goblin One
560565
Gochi Hand
561566
Goldman
562567
Golos Text
568+
Google Sans
563569
Google Sans Code
570+
Google Sans Flex
564571
Gorditas
565572
Gothic A1
566573
Gotu
@@ -737,6 +744,7 @@ Kavoon
737744
Kay Pho Du
738745
Kdam Thmor Pro
739746
Keania One
747+
Kedebideri
740748
Kelly Slab
741749
Kenia
742750
Khand
@@ -819,6 +827,7 @@ Libre Caslon Text
819827
Libre Franklin
820828
Licorice
821829
Life Savers
830+
Lilex
822831
Lilita One
823832
Lily Script One
824833
Limelight
@@ -931,6 +940,9 @@ Mohave
931940
Moirai One
932941
Molengo
933942
Molle
943+
Momo Signature
944+
Momo Trust Display
945+
Momo Trust Sans
934946
Mona Sans
935947
Monda
936948
Monofett
@@ -1144,6 +1156,7 @@ Noto Sans Symbols
11441156
Noto Sans Symbols 2
11451157
Noto Sans Syriac
11461158
Noto Sans Syriac Eastern
1159+
Noto Sans Syriac Western
11471160
Noto Sans TC
11481161
Noto Sans Tagalog
11491162
Noto Sans Tagbanwa
@@ -1585,13 +1598,15 @@ Scada
15851598
Scheherazade New
15861599
Schibsted Grotesk
15871600
Schoolbell
1601+
Science Gothic
15881602
Scope One
15891603
Seaweed Script
15901604
Secular One
15911605
Sedan
15921606
Sedan SC
15931607
Sedgwick Ave
15941608
Sedgwick Ave Display
1609+
Sekuya
15951610
Sen
15961611
Send Flowers
15971612
Sevillana
@@ -1677,6 +1692,9 @@ Sree Krushnadevaraya
16771692
Sriracha
16781693
Srisakdi
16791694
Staatliches
1695+
Stack Sans Headline
1696+
Stack Sans Notch
1697+
Stack Sans Text
16801698
Stalemate
16811699
Stalinist One
16821700
Stardos Stencil

‎packages/google_fonts/generator/generator.dart‎

Lines changed: 46 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -167,21 +167,23 @@ class _FamiliesDelta {
167167
// (e.g. CHANGELOG, PR description).
168168
String markdownDiff() {
169169
final Iterable<String> addedPrintable = added.map(
170-
(String family) => ' - Added `$family`',
170+
(String family) => ' - `$family`',
171171
);
172172
final Iterable<String> removedPrintable = removed.map(
173-
(String family) => ' - Removed `$family`',
173+
(String family) => ' - `$family`',
174174
);
175175

176176
var diff = '';
177-
if (removedPrintable.isNotEmpty) {
178-
diff += removedPrintable.join('\n');
179-
diff += '\n';
180-
}
181177
if (addedPrintable.isNotEmpty) {
178+
diff += '- Added fonts:\n';
182179
diff += addedPrintable.join('\n');
183180
diff += '\n';
184181
}
182+
if (removedPrintable.isNotEmpty) {
183+
diff += '- Removed fonts:\n';
184+
diff += removedPrintable.join('\n');
185+
diff += '\n';
186+
}
185187

186188
return diff;
187189
}
@@ -332,17 +334,50 @@ void _writeDartFile(String path, String content) {
332334

333335
/// Remove variable-font entries when a static entry of the same
334336
/// weight/italic exists. Keep variable only if no static equivalent.
337+
/// Also deduplicate static variants by keeping only default width (100.0).
335338
///
336339
// TODO(guidezpl): Add explicit variable-font support, see
337340
// https://github.com/flutter/flutter/issues/174575 and
338341
// https://github.com/flutter/flutter/issues/174567
342+
// TODO(guidezpl): Add font width/stretch support to google_fonts API to properly
343+
// handle width variants (condensed, normal, extended) instead of deduplicating them.
339344
List<Font> _deduplicateFonts(List<Font> fonts) {
345+
// First, identify variable fonts, and group static fonts by weight/italic to
346+
// find the best width variant.
347+
final List<Font> variableFonts = [];
348+
final Map<String, List<Font>> staticGroups = {};
349+
for (final font in fonts) {
350+
if (font.isVf) {
351+
variableFonts.add(font);
352+
} else {
353+
final key = '${font.weight.start}_${font.italic.start.round()}';
354+
staticGroups.putIfAbsent(key, () => []).add(font);
355+
}
356+
}
357+
358+
// For each static group, keep a single width (default to 100.0) variant.
340359
final filteredVariants = <Font>[];
341-
for (final variant in fonts) {
342-
if (!variant.isVf) {
343-
filteredVariants.add(variant);
344-
continue;
360+
for (final List<Font> group in staticGroups.values) {
361+
Font? defaultWidthVariant;
362+
for (final font in group) {
363+
if (font.width.start == 100.0) {
364+
defaultWidthVariant = font;
365+
break;
366+
}
367+
}
368+
369+
if (defaultWidthVariant == null) {
370+
// If no default width, and more than one variant, we'll have to revise
371+
// this logic to understand which width to prefer.
372+
assert(group.length == 1);
345373
}
374+
375+
filteredVariants.add(defaultWidthVariant ?? group.first);
376+
}
377+
378+
// Now, for each variable font, check if a static equivalent exists.
379+
// If so, skip the variable font.
380+
for (final variant in variableFonts) {
346381
var hasStaticEquivalent = false;
347382
for (final other in fonts) {
348383
if (!other.isVf &&
@@ -356,6 +391,7 @@ List<Font> _deduplicateFonts(List<Font> fonts) {
356391
filteredVariants.add(variant);
357392
}
358393
}
394+
359395
return filteredVariants;
360396
}
361397

0 commit comments

Comments
 (0)