Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit e553cd6

Browse files
authored
[web] Switch all fonts to WOFF2 (non-split) (#56035)
Google Fonts serves TTF fonts gzipped. By switching to WOFF2 fonts, we get Brotli compression by design. Google Font's WOFF2 fonts are 30%+ smaller than their gzipped TTF counterparts (including Roboto).
1 parent dfa70d7 commit e553cd6

File tree

6 files changed

+160
-147
lines changed

6 files changed

+160
-147
lines changed

DEPS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,7 @@ deps = {
925925
'packages': [
926926
{
927927
'package': 'flutter/flutter_font_fallbacks',
928-
'version': '0570a0ea824083da79de07b131fc5df7f55dad4d6cba2ee704912ce7e4ce812a'
928+
'version': '10da6a95fedad127634500aa854466fe9e3fa760220a2a1c7c20df84073fce76'
929929
}
930930
],
931931
'dep_type': 'cipd',

lib/web_ui/dev/roll_fallback_fonts.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
312312
}
313313
final List<_FontInfo> processedFonts = <_FontInfo>[];
314314
final http.Response response = await client.get(Uri.parse(
315-
'https://www.googleapis.com/webfonts/v1/webfonts?key=$apiKey'));
315+
'https://www.googleapis.com/webfonts/v1/webfonts?capability=WOFF2&key=$apiKey'));
316316
if (response.statusCode != 200) {
317317
throw ToolExit('Failed to download Google Fonts list.');
318318
}

lib/web_ui/lib/src/engine/canvaskit/fonts.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import 'package:ui/ui_web/src/ui_web.dart' as ui_web;
1414
// Roboto font. The API reference is here:
1515
// https://developers.google.com/fonts/docs/developer_api
1616
String _robotoUrl =
17-
'${configuration.fontFallbackBaseUrl}roboto/v20/KFOmCnqEu92Fr1Me5WZLCzYlKw.ttf';
17+
'${configuration.fontFallbackBaseUrl}roboto/v32/KFOmCnqEu92Fr1Me4GZLCzYlKw.woff2';
1818

1919
/// Manages the fonts used in the Skia-based backend.
2020
class SkiaFontCollection implements FlutterFontCollection {

0 commit comments

Comments
 (0)