ttfGetGlyphImageForIndex function

Pointer<SdlSurface> ttfGetGlyphImageForIndex(
  1. Pointer<TtfFont> font,
  2. int glyphIndex
)

Get the pixel image for a character index.

This is useful for text engine implementations, which can call this with the glyph_index in a TTF_CopyOperation

\param font the font to query. \param glyph_index the index of the glyph to return. \returns an SDL_Surface containing the glyph, or NULL on failure; call SDL_GetError() for more information.

\threadsafety This function should be called on the thread that created the font.

\since This function is available since SDL_ttf 3.0.0.

extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_GetGlyphImageForIndex(TTF_Font *font, Uint32 glyph_index)

Implementation

Pointer<SdlSurface> ttfGetGlyphImageForIndex(
    Pointer<TtfFont> font, int glyphIndex) {
  final ttfGetGlyphImageForIndexLookupFunction = libSdl3Ttf.lookupFunction<
      Pointer<SdlSurface> Function(Pointer<TtfFont> font, Uint32 glyphIndex),
      Pointer<SdlSurface> Function(
          Pointer<TtfFont> font, int glyphIndex)>('TTF_GetGlyphImageForIndex');
  return ttfGetGlyphImageForIndexLookupFunction(font, glyphIndex);
}