Various under-the-hood fixes for emoji display.
This framework is an intermediate layer between text display and text representation in iOS. It mainly handles character sets of such supported fonts, including emoji.
Emoji character set is cached in bitmap format and retrievable from CreateCharacterSetForFont()
. The set changes from version to version of iOS. We override this with the latest character set. To get the character set needed, we dump one from libGSFontCache.dylib
which is what EmojiCategory does. Without this override, emojis can be all shadowed (black out).
As of iOS 11, a weird function IsDefaultEmojiPresentation()
seems to determine which emojis are really supported by the system before showing them. The said representation is an array of emoji strings that can be easily overridden.
This framework handles display emojis in most native (UIKit) applications. CFStringGetRangeOfCharacterClusterAtIndex()
consults the cached emoji character set to determine the index of the given character, taking into account that it can be one of the characters (cluster) of one single emoji. We as well override the character set. Without this workaround, unsupported emojis will be rendered as blank or "?" icon.
This framework does a lot of things to displaying content in websites, including displaying emojis in web pages. Until at some point in the past, Apple hardcoded all emoji unicodes in here for iteration through characters in a webpage to apply a compatible (emoji) font for them. For present days, read ICU section below. Without this hack, emojis will be displayed as blank rectangles.
-[NSString(TIExtras) _containsEmoji]
involves opening the emoji bitmap file TIUserDictionaryEmojiCharacterSet.bitmap
residing in /System/Library/Frameworks/TextInput.framework
. It simply needs to be replaced by the most recent bitmap so that such applications that perform checking emoji substrings will perform correctly.
Apple has transitioned to be relying more on ICU API when it has to deal with emojis. Instead of hardcoding emoji codepoints in CoreFoundation
framework, it directly consults ICU which already has similar information. At a high level, ICU embeds "props" data related to emojis inside libicucore.A.dylib
. EmojiAttributes flexes its best to redirect readings of those data to be from its own.
Remove WebCore/CoreText emoji size restriction. See here.