我可以检查 Unicode 代码点是否可以在 Android 下显示吗?

Can I check if a Unicode codepoint will be displayable under Android?

我当前的项目使用了一些在许多字体中都没有的符号。到目前为止,我发现一些 iOS 渲染为一个盒子,所以我希望迟早能找到一个 Android 也无法渲染的盒子,尽管到目前为止它比 iOS 在这方面。

有没有办法以编程方式检查给定的 Unicode 代码点是否会在屏幕上正确显示而不是显示为空方框等?

如果我能检测到某个符号无法呈现,我可以为其实施解决方法,而不是显示一个丑陋的框。

使用 Emoji Compat, all current Unicode characters are supported back to API 19. It can be used with Downloadable Fonts,确保随着更多 Unicode 字符的标准化,您的应用会自动支持它们。

您可以确认 Emoji Compat 是否支持特定字符 hasEmojiGlyph():

EmojiCompat.get().hasEmojiGlyph(charSequence);

Note: you must have initialized Emoji Compat before calling this.

EmojiCompat DevByte video 显示了使事情正常进行的最少步骤集。

对于通用的 unicode 字符,您可以使用 PaintCompat.hasGlyph

您仍应使用 ianhanniballake 的回答中提到的 EmojiCompat 才能正确呈现表情符号。