Skip to content
This repository has been archived by the owner on Jul 23, 2019. It is now read-only.

Override default emojis with emojione TTF on iOS app #363

Open
KieranLafferty opened this issue Sep 23, 2016 · 21 comments
Open

Override default emojis with emojione TTF on iOS app #363

KieranLafferty opened this issue Sep 23, 2016 · 21 comments
Labels

Comments

@KieranLafferty
Copy link

KieranLafferty commented Sep 23, 2016

Hello,

I have been trying to add the TTF font for iOS/Mac to my app without any success. I am trying to have it override the system emojis within app to use the emojione assets instead of the apple default ones.

I've tried adding AppleColorEmoji@2x.ttf to my project and explicitly setting the font to "AppleColorEmoji" for the particular label. Despite many different attempts emojis always show with the Apple default behavior. Is it possible to have set the font such that any emoji chars are rendered with the emojione assets?

Thank you in advance for your help!

@KieranLafferty KieranLafferty changed the title Installing on iOS app Override Apple emojis with emojione TTF on iOS app Sep 23, 2016
@KieranLafferty KieranLafferty changed the title Override Apple emojis with emojione TTF on iOS app Override default emojis with emojione TTF on iOS app Sep 23, 2016
@Tmason1
Copy link

Tmason1 commented Sep 25, 2016

I'm having the exact same issue and I don't know how to stop if from getting rid of the original emojis.

@caseyahenson
Copy link
Contributor

Hi @KieranLafferty, could you take a look at this tutorial?

http://codewithchris.com/common-mistakes-with-adding-custom-fonts-to-your-ios-app/

Let me know if this is helpful in getting the font to work in your app.

@Tmason1
Copy link

Tmason1 commented Oct 1, 2016

It didn't help sorry. I'm trying to change the file name because it
overwrites the original emoji font.

On 29 September 2016 at 22:09, Casey A Henson notifications@github.com
wrote:

Hi @KieranLafferty https://github.com/KieranLafferty, could you take a
look at this tutorial?

http://codewithchris.com/common-mistakes-with-adding-
custom-fonts-to-your-ios-app/

Let me know if this is helpful in getting the font to work in your app.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#363 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AVZJIdinSSMdZRNidrmcLq9t1jEkQupjks5qvCkkgaJpZM4KFfRE
.

@KieranLafferty
Copy link
Author

KieranLafferty commented Oct 3, 2016

Thanks for the suggestion @caseyahenson. As @Tmason1 mentioned there is a naming conflict with the original AppleColorEmoji font family name which UIFont use the system font instead of the custom ttf.

Not sure if renaming the font family to something like EmojioneColorEmoji would allow for this to be loaded properly using UIFont.

I've tried renaming the font using FontForge (ttf editing software) but with my limited experience creating/editing fonts wasn't able to get it working properly (system detected that the font was created incorrectly, wasn't clear what the solution was).

@Tmason1
Copy link

Tmason1 commented Oct 3, 2016

Even if I change the file name nothing happens. The system font name stays
the same. I've changed it using font forge but none of the characters load
once I've opened it up in the program. When I export it, the name has
changed but all the characters are removed.

On 3 October 2016 at 05:13, Laff notifications@github.com wrote:

Thanks for the suggestion @caseyahenson https://github.com/caseyahenson.
As @Tmason1 https://github.com/Tmason1 mentioned there is a naming
conflict with the original AppleColorEmoji font family name which UIFont
use the system font instead of the custom ttf.

Not sure if renaming the font family to something like EmojioneColorEmoji
would allow for this to be loaded properly using UIFont.

I've tried renaming the font using FontForge (ttf editing software) but
with my limited experience creating/editing fonts wasn't able to get it
working properly.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#363 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AVZJIbs16ZkTE91n2al6bYHi9VdAEp-eks5qwIDzgaJpZM4KFfRE
.

@KieranLafferty
Copy link
Author

Yea its not about the file name you actually have to edit the font at the data level. Open up your renamed font in Font Book and it will still say AppleColorEmoji (which is the font family name) this needs to be edited using a program like FontForge to change the font data

@Tmason1
Copy link

Tmason1 commented Oct 4, 2016

yeah I've changed it in font forge already but it removes the emoji
characters once I've opened it up in font forge.

On 3 October 2016 at 19:43, Laff notifications@github.com wrote:

Yea its not about the file name you actually have to edit the font at the
data level. Open up your renamed font in Font Book and it will still say
AppleColorEmoji (which is the font family name) this needs to be edited
using a program like FontForge to change the font data


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#363 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AVZJIZFZFiSAHSBWAXDQ-lT2zsU_-VSgks5qwUzHgaJpZM4KFfRE
.

@xoudini
Copy link

xoudini commented Dec 6, 2016

@KieranLafferty @Tmason1
If you're interested, I've recently created a framework in Swift with which you can replace all the standard emoji in strings: https://github.com/xoudini/emojica

It's out-of-the-box compatible with EmojiOne, although you'll just get fallbacks for some zero-width joiner sequences since they're not implemented into EmojiOne as of yet.

@ManuelOrtega
Copy link

Any luck by doing this? I'm struggling trying to integrate Emoji One font in iOS...

@xoudini
Copy link

xoudini commented Apr 18, 2017

@ManuelOrtega – the fonts won't really work as intended in iOS apps, likely because the AppleColorEmoji font overrides any other font when encountering emoji.

However, if you're willing to settle for an image-based solution to replace the standard emoji with EmojiOne, see my above answer. The framework is quite lightweight, and works on UILabel and UITextView. You can check out the provided example app for usage and how it performs.

@Tmason1
Copy link

Tmason1 commented Apr 23, 2017 via email

@ranesr
Copy link

ranesr commented May 9, 2017

@KieranLafferty @Tmason1 I found this and then I used TTFEdit to rename the font to this font name - "AppleColorEmojiOne".

And now I can use this new ttf file and include in the project. I did this to use it and it works fine -

let font = UIFont(name: "AppleColorEmojiOne", size: 20)

@caseyahenson I will be happy to make PR to include this file with new font name while keeping the original one in fonts.

@Tmason1
Copy link

Tmason1 commented May 9, 2017 via email

@ranesr
Copy link

ranesr commented May 9, 2017

Using this link.

@Tmason1
Copy link

Tmason1 commented May 9, 2017 via email

@Tmason1
Copy link

Tmason1 commented May 9, 2017 via email

@ranesr
Copy link

ranesr commented May 9, 2017

You just have to open ttfedit.jar after you unzip the downloaded file. Then open emojione-apple.ttf that you may have already downloaded using ttfedit. It will show you cmap (Check the image below). You will also find name tab vertically on the left side of the window (purple line), click on it and you will able to update the family/font names. After that save it as any name you want.

ttfedit

After I tried to check all the icons using this new ttf file with new font name, many icons do not show up in the simulator. (almost all flag icons, and icons with different tones, etc.)

@ranesr
Copy link

ranesr commented May 12, 2017

@KieranLafferty @Tmason1
I have created EmojiOne. It currently supports UIImageView, UILabel and UIButton.

Until we figure out how to change font name without affecting emoji icons, we can use this library.

@chriswill0w
Copy link

Is this ever going to be fixed?

@czgarrett
Copy link

I think all we need is for EmojiOne to post a new .ttf with a different postscript name. I was able to get it partially working by opening the font with Glyphs, changing the postscript name and exporting, but then some of the zero width joiner sequences stopped working in my app. I don't know how to fix them. I didn't have any luck with FontForge or TTX either.

I think all we need is a .ttf file that is exactly the same as what's on the download page, with the name changed.

@czgarrett
Copy link

I got it working! (slightly hacky, but...)

I opened the .ttf file with TextEdit, find/replaced "Emoji" with "Emoj2". The trick if you edit the binary file directly is that you have to change the font family and postscript name, but keep the names the same length so you don't mess up the file.

If you do that, then you can add the .ttf file to your app in the usual way, and then use "AppleColorEmoj2" as your font name when you look it up with UIFont.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

8 participants