chickadee » sdl2-ttf » open-font

open-font filepath ptsize #!optional indexprocedure
open-font* filepath ptsize #!optional indexprocedure

Attempts to load the TTF or FON font file at the given filepath (a string). See TTF_OpenFontIndex.

ptsize is the point size (based on 72DPI) to load the font as. This basically translates to pixel height.

index allows you to choose a font face from a file containing multiple font faces. It defaults to 0, the first face.

Returns a ttf:font with the font data. Signals an exception of kind (exn sdl2) if the font could not be loaded.

  • open-font returns a managed ttf:font.
  • open-font* returns an unmanaged ttf:font, which must be closed with close-font! when you are done with it.