Initializes the library.
Unless noted otherwise, this must be called before any other part of the library is used.
You may call this multiple times.
:: a typeCtrl KGHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05
Modulesdl2-ttf-2.1.3Haskell2010
Bindings to the SDL2_ttf library
http://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf.html
which itself is a wrapper around the FreeType library.
The bindings should allow you to load fonts and
render Text in various styles to an SDL Surface.
You can safely assume that any monadic function listed here is capable of throwing an SDLException in case it encounters an error.
Initializes the library.
Unless noted otherwise, this must be called before any other part of the library is used.
You may call this multiple times.
Gets the major, minor, patch versions of the linked SDL2_ttf library.
You may call this without initializing the library with initialize.
Cleans up any resources still in use by the library.
If called, you must call initialize again before using any other parts of the library.
Use the following functions to load TTF and FON file formats.
Point size (based on 72DPI) to load font as. Translates to pixel height.
Designates a font face, the default and first one being 0.
Same as load, but accepts a ByteString containing a font instead.
Same as loadIndex, but accepts a ByteString containing a font instead.
Frees a loaded Font.
Use the following functions to render text to a Surface.
The methods available are described in more detail in the original
SDL2_ttf documentation
here.
Color as an RGBA byte vector.
Renders Text using the quick and dirty method.
Is the fastest of the rendering methods, but results in text that isn't as smooth.
Possible styles that can be applied to a Font.
Bounded StyleDefined in sdl2-ttf-2.1.3 · SDL.FontEnum StyleDefined in sdl2-ttf-2.1.3 · SDL.FontEq StyleDefined in sdl2-ttf-2.1.3 · SDL.FontOrd StyleDefined in sdl2-ttf-2.1.3 · SDL.FontRead StyleDefined in sdl2-ttf-2.1.3 · SDL.FontShow StyleDefined in sdl2-ttf-2.1.3 · SDL.FontGeneric StyleDefined in sdl2-ttf-2.1.3 · SDL.Fonttype Rep Style = D1 ('MetaData "Style"
"SDL.Font"
"sdl2-ttf-2.1.3-LKPm5rVEmrWDcU2xyMvdGw"
'False) ((C1 ('MetaCons "Bold"
'PrefixI 'False) U1 :+: C1 ('MetaCons "Italic"
'PrefixI 'False) U1) :+: (C1 ('MetaCons "Underline"
'PrefixI 'False) U1 :+: C1 ('MetaCons "Strikethrough"
'PrefixI 'False) U1))Defined in sdl2-ttf-2.1.3 · SDL.FontGets the rendering styles of a given Font.
If none were ever set, this will be an empty list.
Sets the rendering style of a Font.
Use an empty list to reset the style.
The size of the Font outline, in pixels.
Use 0 to turn off outlining.
Gets the current outline size of a given Font.
Sets the outline size for a given Font.
Use 0 to turn off outlining.
Bounded HintingDefined in sdl2-ttf-2.1.3 · SDL.FontEnum HintingDefined in sdl2-ttf-2.1.3 · SDL.FontEq HintingDefined in sdl2-ttf-2.1.3 · SDL.FontOrd HintingDefined in sdl2-ttf-2.1.3 · SDL.FontRead HintingDefined in sdl2-ttf-2.1.3 · SDL.FontShow HintingDefined in sdl2-ttf-2.1.3 · SDL.FontGeneric HintingDefined in sdl2-ttf-2.1.3 · SDL.Fonttype Rep Hinting = D1 ('MetaData "Hinting"
"SDL.Font"
"sdl2-ttf-2.1.3-LKPm5rVEmrWDcU2xyMvdGw"
'False) ((C1 ('MetaCons "Normal"
'PrefixI 'False) U1 :+: C1 ('MetaCons "Light"
'PrefixI 'False) U1) :+: (C1 ('MetaCons "Mono"
'PrefixI 'False) U1 :+: C1 ('MetaCons "None"
'PrefixI 'False) U1))Defined in sdl2-ttf-2.1.3 · SDL.FontGets the hinting setting of a given Font.
Sets the hinting setting of a font.
Whether kerning is enabled or not.
The default for a newly-loaded Font is enabled.
Gets the current kerning setting of a given Font.
Tests whether the current face of a Font is a fixed width font or not.
Gets the current font face family name, if any.
Gets the current font face style name, if any.
Gets the maximum pixel height of all glyphs of a given Font.
Gets the maximum pixel ascent of all glyphs of a given Font.
This can be interpreted as the distance from the top of the font to the baseline.
Gets the maximum pixel descent of all glyphs of a given Font.
Also interpreted as the distance from the baseline to the bottom of the font.
From a given Font get the kerning size of two glyphs.
Functions that work with individual glyphs.
Does a Font provide a certain unicode character?
Same as glyphProvided, but returns an index of the glyph for the given character instead, if one is provided.
Get glyph metrics for a given unicode character. The values returned are:
minimum x offset
maximum x offset
minimum y offset
maximum y offset
advance offset
You can see more information about these values in the original SDL2_ttf
documentation
here.
Same as solid, but renders a single glyph instead.
Same as shaded, but renders a single glyph instead.
Same as blended, but renders a single glyph instead.
Same as blended, but renders across multiple lines. Text is wrapped to multiple lines on line endings and on word boundaries if it extends beyond wrapLength in pixels.