TypefaceEmojiRasterizer


@AnyThread
@RequiresApi(value = 19)
public class TypefaceEmojiRasterizer


Information about a single emoji. To draw this emoji on a canvas using use draw. To draw this emoji using custom code, use getCodepointAt and getTypeface to access the underlying emoji font and look up the glyph.

Summary

Public methods

void
draw(@NonNull Canvas canvas, float x, float y, @NonNull Paint paint)

Draws the emoji onto a canvas with origin at (x,y), using the specified paint.

int
getCodepointAt(int index)
int
int
@NonNull Typeface
int
boolean
boolean

If the platform requested that this emoji not be rendered using emojicompat.

@NonNull String

Public methods

draw

Added in 1.3.0
public void draw(@NonNull Canvas canvas, float x, float y, @NonNull Paint paint)

Draws the emoji onto a canvas with origin at (x,y), using the specified paint.

Parameters
@NonNull Canvas canvas

Canvas to be drawn

float x

x-coordinate of the origin of the emoji being drawn

float y

y-coordinate of the baseline of the emoji being drawn

@NonNull Paint paint

Paint used for the text (e.g. color, size, style)

getCodepointAt

Added in 1.3.0
public int getCodepointAt(int index)
Parameters
int index

index of the codepoint

Returns
int

the codepoint at index

getCodepointsLength

Added in 1.3.0
public int getCodepointsLength()
Returns
int

the length of the codepoints for this emoji

getHeight

Added in 1.3.0
public int getHeight()
Returns
int

height of the emoji image

getTypeface

Added in 1.3.0
public @NonNull Typeface getTypeface()
Returns
@NonNull Typeface

return typeface to be used to render

getWidth

Added in 1.3.0
public int getWidth()
Returns
int

width of the emoji image

isDefaultEmoji

Added in 1.3.0
public boolean isDefaultEmoji()
Returns
boolean

whether the emoji is in Emoji Presentation by default (without emoji style selector 0xFE0F)

isPreferredSystemRender

Added in 1.3.0
public boolean isPreferredSystemRender()

If the platform requested that this emoji not be rendered using emojicompat.

Returns
boolean

true if this emoji should be drawn by the system instead of this renderer

toString

public @NonNull String toString()