Skip to content

Commit b10296f

Browse files
chrisbobbegnprice
authored andcommitted
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 Source 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 #294. Fixes: #289
1 parent 9064b8f commit b10296f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/widgets/app.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ class ZulipApp extends StatelessWidget {
2121
// Note that specifiying only "Noto Color Emoji" in the fallback list,
2222
// Flutter tries to use it to draw even the non emoji characters
2323
// which leads to broken text rendering.
24-
fontFamilyFallback: const <String>['sans-serif', 'Noto Color Emoji'],
24+
fontFamilyFallback: [
25+
// …since apparently iOS doesn't support 'sans-serif', use this instead:
26+
// https://github.com/flutter/flutter/issues/63507#issuecomment-1698504425
27+
if (Theme.of(context).platform == TargetPlatform.iOS) '.AppleSystemUIFont' else 'sans-serif',
28+
'Noto Color Emoji',
29+
],
2530
useMaterial3: false, // TODO(#225) fix things and switch to true
2631
// This applies Material 3's color system to produce a palette of
2732
// appropriately matching and contrasting colors for use in a UI.

0 commit comments

Comments
 (0)