Fintasys / emoji_picker_flutter

A Flutter package that provides an Emoji picker widget with 1500+ emojis in 8 categories.
MIT License
154 stars 114 forks source link

Specify platform specific font family & fallback font families #172

Closed emesterhazy closed 5 months ago

emesterhazy commented 7 months ago

This change helps resolve emoji rendering issues which have been reported by several different users across platforms. I filed two "canonical" issues for this problem, but others have been reported.

This change helps address this problem by setting a default font family on iOS, MacOS, and Android. On iOS this is 'Apple Color Emoji', and on Android it is 'NotoColorEmoji'. We also specify several common fallback emoji font families which Flutter will use if the specified font family is unavailable. This is useful in case the user specifies an unavailable font family.

On iOS this actually resolves the rendering issue for U+2639, which you can see in the description of #170. Unfortunately this change does not seem to resolve the issue on Android when I tested it in the emulator, but it may help for some configurations of Android where Flutter can access the 'NotoColorEmoji' font.

FIXED=#170 BUG=#171,#163

emesterhazy commented 6 months ago

Thanks for the feedback and sorry for the delay on my end! Please take a look at my replies when you have a chance :)

Fintasys commented 6 months ago

@emesterhazy I tried to apply your suggestions in version 2.0 I'm working on. If you have time would be nice if you could check how it works for you. https://pub.dev/packages/emoji_picker_flutter/versions/2.0.0-dev.2 🙏

emesterhazy commented 6 months ago

Cool! Looking at the version-2.0 branch, it looks like you have the fallback font family logic bug not aren't setting a platform default font. This might fix issue #170, but I am not completely sure. Did you happen to test on iOS to see if it's resolved?

As far as this full request, it seems like I should probably close it since you're making these changes in the version 2 branch. What do you think? By the way, any idea when version 2 will be published?

Fintasys commented 6 months ago

Hopefully soon, I'm still working on some issues with SkinTone selection in search view. But v2 is already on pub.dev as dev version and should be stable for most parts.

Setting the platform default font has an issue when you combine text + emoji (spaces become huge as example). I ended up improving the EmojiTextEditingController to just apply fallback font's on emoji glyth.

I also found that you are using NotoColorEmoji in your PR which didn't work for me, I used 'Noto Color Emoji' which then started to work with GoogleFonts. Not sure where you got your name from 🤔 But it also didn't solve the appearance on Pixel devices.

emesterhazy commented 5 months ago

I don't remember where I got the no-spaces name NotoColorEmoji, but I remember I settled on it after seeing it used in various other places, including the official Github repo.

What do you mean it started working with Google fonts? Do you mean using the package via GoogleFonts.getFont('Noto Color Emoji')?

Regardless, if the version with spaces is working, that must be the right one to use.

Fintasys commented 5 months ago

I can find multiple variants in the GoogleFonts package. But I tried all variants I found as fontFamily, but none of them worked without the GoogleFonts package loading the font.

(1) fontFamily: 'NotoColorEmoji_regular',
(2) fontFamily: 'NotoColorEmoji',
(3) fontFamily: 'Noto Color Emoji'

What do you mean it started working with Google fonts? Do you mean using the package via GoogleFonts.getFont('Noto Color Emoji')?

Yes, that's what I meant

Fintasys commented 5 months ago

Included in version 2.0 release 👍 Thanks !