Skip to content

Commit 3efe038

Browse files
emoji: Use "Apple Color Emoji" font on iOS/macOS for UnicodeEmojiWidget
Some unicode characters, like U+2764 (❤) or U+00AE (®) can have glyphs in non-Emoji fonts, resulting in incorrect rendering of such characters, where we specifically want an emoji to be displayed. So, explicitly mention "Apple Color Emoji" to be the font used on iOS/macOS for displaying the unicode emoji.
1 parent 904067c commit 3efe038

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/widgets/emoji.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ class UnicodeEmojiWidget extends StatelessWidget {
5050

5151
case TargetPlatform.iOS:
5252
case TargetPlatform.macOS:
53-
// We expect the font "Apple Color Emoji" to be used. There are some
54-
// surprises in how Flutter ends up rendering emojis in this font:
53+
// We use the font "Apple Color Emoji". There are some surprises in how
54+
// Flutter ends up rendering emojis in this font:
5555
// - With a font size of 17px, the emoji visually seems to be about 17px
5656
// square. (Unlike on Android, with Noto Color Emoji, where a 14.5px font
5757
// size gives an emoji that looks 17px square.) See:
@@ -71,7 +71,9 @@ class UnicodeEmojiWidget extends StatelessWidget {
7171
SizedBox(height: boxSize, width: boxSize),
7272
PositionedDirectional(start: 0, child: Text(
7373
textScaler: textScaler,
74-
style: TextStyle(fontSize: size),
74+
style: TextStyle(
75+
fontFamily: 'Apple Color Emoji',
76+
fontSize: size),
7577
strutStyle: StrutStyle(fontSize: size, forceStrutHeight: true),
7678
emojiDisplay.emojiUnicode)),
7779
]);

0 commit comments

Comments
 (0)