ttfSetFontSdf function

int ttfSetFontSdf(
  1. Pointer<TtfFont> font,
  2. bool onOff
)

Enable Signed Distance Field rendering for a font.

This works with the Blended APIs. SDF is a technique that helps fonts look sharp even when scaling and rotating.

This clears already-generated glyphs, if any, from the cache.

\param font the font to set SDF support on. \param on_off SDL_TRUE to enable SDF, SDL_FALSE to disable.

\returns 0 on success, -1 on error.

\since This function is available since SDL_ttf 2.0.18.

\sa TTF_GetFontSDF

extern DECLSPEC int TTF_SetFontSDF(TTF_Font *font, SDL_bool on_off)

Implementation

int ttfSetFontSdf(Pointer<TtfFont> font, bool onOff) {
  final ttfSetFontSdfLookupFunction = libSdl2Ttf.lookupFunction<
      Int32 Function(Pointer<TtfFont> font, Int32 onOff),
      int Function(Pointer<TtfFont> font, int onOff)>('TTF_SetFontSDF');
  return ttfSetFontSdfLookupFunction(font, onOff ? 1 : 0);
}