ttfGetGlyphImageForIndex function ttf

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

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. \param image_type a pointer filled in with the glyph image type, may be NULL. \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, TTF_ImageType *image_type)

Implementation

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