chickadee » sdl2-ttf » open-font-rw*

open-font-rw rwops close? ptsize #!optional indexprocedure
open-font-rw* rwops close? ptsize #!optional indexprocedure

Attempts a TTF or FON font from an sdl2:rwops. This procedure allows you to load a font from a variety of sources, such as a blob, string, memory pointer, or file. See TTF_OpenFontIndexRW.

If close? is #t, the sdl2:rwops will be automatically closed after the font is loaded. See rw-close! in the sdl2 egg. If close? is #f (the default), the sdl2:rwops will not be closed.

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-rw returns a managed ttf:font.
  • open-font-rw* returns an unmanaged ttf:font, which must be closed with close-font! when you are done with it.