Skip to content

Commit

Permalink
Added additional emoji support in SDL_ttf, contributed by Arthur Danskin
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Sep 3, 2019
1 parent 4d6e08a commit 3d265e0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
11 changes: 11 additions & 0 deletions SDL_ttf.c
Expand Up @@ -2417,8 +2417,19 @@ int TTF_GlyphIsProvided(TTF_Font *font, Uint16 ch)
return (int)get_char_index(font, ch);
}

int TTF_GlyphIsProvided32(TTF_Font *font, Uint32 ch)
{
return (int)get_char_index(font, ch);
}

int TTF_GlyphMetrics(TTF_Font *font, Uint16 ch,
int *minx, int *maxx, int *miny, int *maxy, int *advance)
{
return TTF_GlyphMetrics32(font, ch, minx, maxx, miny, maxy, advance);
}

int TTF_GlyphMetrics32(TTF_Font *font, Uint32 ch,
int *minx, int *maxx, int *miny, int *maxy, int *advance)
{
c_glyph *glyph;

Expand Down
4 changes: 4 additions & 0 deletions SDL_ttf.h
Expand Up @@ -162,6 +162,7 @@ extern DECLSPEC char * SDLCALL TTF_FontFaceStyleName(const TTF_Font *font);

/* Check wether a glyph is provided by the font or not */
extern DECLSPEC int SDLCALL TTF_GlyphIsProvided(TTF_Font *font, Uint16 ch);
extern DECLSPEC int SDLCALL TTF_GlyphIsProvided32(TTF_Font *font, Uint32 ch);

/* Get the metrics (dimensions) of a glyph
To understand what these metrics mean, here is a useful link:
Expand All @@ -170,6 +171,9 @@ extern DECLSPEC int SDLCALL TTF_GlyphIsProvided(TTF_Font *font, Uint16 ch);
extern DECLSPEC int SDLCALL TTF_GlyphMetrics(TTF_Font *font, Uint16 ch,
int *minx, int *maxx,
int *miny, int *maxy, int *advance);
extern DECLSPEC int SDLCALL TTF_GlyphMetrics32(TTF_Font *font, Uint32 ch,
int *minx, int *maxx,
int *miny, int *maxy, int *advance);

/* Get the dimensions of a rendered string of text */
extern DECLSPEC int SDLCALL TTF_SizeText(TTF_Font *font, const char *text, int *w, int *h);
Expand Down

0 comments on commit 3d265e0

Please sign in to comment.