Android. How to display large emoji? (Font size too large to fit in cache)
Asked Answered
C

1

3

For moderators: I already found similar questions (one, two), but none of them solves my problem. Please do not mark as duplicate.

Problem: I have a device on Android 7 (API 25) on which I need to show a large emoji in TextView. If font size below 256 emojis are displayed without problems, but at a size above 256 emojis are not displayed:

ERROR/OpenGLRenderer: Font size to large to fit in cache.

What I tried:

  • Disabling the hardware acceleration for a specific Activity
  • Disabling the hardware acceleration for a specific TextView
  • Convert the emoji to an outline using Paint.getTextPath(...)

But nothing works. Even Paint.getTextPath does not return emojis outline (for plain text everything works).

In emulator (Android 9, API 28) all emojis are displayed, but on a real device (Android 7, API 25) - not. This is probably a bug of the android itself.

Are there any other ways to display large emojis?

Clime answered 8/8, 2019 at 14:20 Comment(2)
Maybe this emojis are not in Android 7.0Fewness
@Fewness if the emoji size is below 256 it is displayed, so that's not the problemClime
C
0

Having struggled with this for a long time yesterday myself, I will say that if you get desperate, you can go to the SVG section of Google's Noto Emoji font repo -- https://github.com/googlefonts/noto-emoji/tree/master/svg -- and download the SVG file for the emoji you want. Then in Android Studio do New/Vector Asset to convert the SVG file into an XML file, and use that at whatever size you like. It even looks sharper than going the text-emoji-at-a-very-large-font-size route.

Chronology answered 11/1, 2020 at 21:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.