Skip to content

Commit f531599

Browse files
committed
ui: For boring, non-emoji font, use one that iOS recognizes
It's strange that iOS really doesn't seem to know what to do with 'sans-serif' here. Nor "SF Pro", "SF-Pro", nor any obvious variation on that, even though it's supposedly the system font: https://developer.apple.com/fonts/ But a GitHub comment popped up a few hours ago (linked in the added code), and that's the first thing I've found that seems to work, as a clear pointer to the default system font. Shrug. Later, we'll want to use Sorce Sans 3 for almost all the text in the app. But we'll want to take more care with that than I have bandwidth for right now (around it being a variable-weight font); see discussion: https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/flutter.3A.20text.20all.20weird/near/1633648 Fixes: zulip#289
1 parent 9e82157 commit f531599

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/widgets/app.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'dart:io';
12
import 'package:flutter/material.dart';
23

34
import '../model/narrow.dart';
@@ -21,7 +22,12 @@ class ZulipApp extends StatelessWidget {
2122
// Note that specifiying only "Noto Color Emoji" in the fallback list,
2223
// Flutter tries to use it to draw even the non emoji characters
2324
// which leads to broken text rendering.
24-
fontFamilyFallback: const <String>['sans-serif', 'Noto Color Emoji'],
25+
fontFamilyFallback: [
26+
// …since apparently iOS doesn't support 'sans-serif', use this instead:
27+
// https://github.com/flutter/flutter/issues/63507#issuecomment-1698504425
28+
if (Platform.isIOS) '.AppleSystemUIFont' else 'sans-serif',
29+
'Noto Color Emoji',
30+
],
2531
useMaterial3: false, // TODO(#225) fix things and switch to true
2632
// This applies Material 3's color system to produce a palette of
2733
// appropriately matching and contrasting colors for use in a UI.

0 commit comments

Comments
 (0)