Stk.FontSourceFonts.
This module provides functions to use fonts through Tsdl_ttf.Ttf.
Tsdl_ttf.Ttf.fonts are accessed through font descriptions font_desc. A caching mecanism avoids loading a SDL font each time a it is required.
type font_metrics = {font_height : int;font_ascent : int;font_descent : int;font_line_skip : int;font_is_fixed_width : int;}Font metrics, to gather information from Tsdl_ttf.
Get all font metrics from the given font.
type font_desc = {size : int;italic : bool;bold : bool;family : string;underline : bool;strikethrough : bool;kerning : bool;outline : int;}A font description describes a font: family, size, style, ...
val font_desc :
?size:int ->
?italic:bool ->
?bold:bool ->
?underline:bool ->
?strikethrough:bool ->
?kerning:bool ->
?outline:int ->
string ->
font_descConvenient function to create a font_desc. Default value for optional arguments are:
size: !default_font_size,italic: false,bold: false,strikethrough: false,kerning: true,outline: 0.Get a fallback font family associated to given unicode codepoint.
add_fallback_font start stop family adds a font family to use as fallback font for the given range (start..stop) of unicode codepoints.
Font file extensions. Use when looking for font files in directories. Default is [".ttf"].
Font directories where to look for fonts, in the form (directory, rec-flag) where rec-flag indicates whether this directory should be inspected recursively when looking for fonts. App.init will call load_fonts which uses font_dirs to look for available fonts, so additional directories must be set before initializing application. Default value is [ Filename.current_dir_name, false ; "/usr/share/fonts/truetype", true ].
load_fonts () looks for available fonts. Optional arguments are:
size: size used to load a font; default is default_font_size.dirs: directories to inspect. Default is font_dirs.load_fonts_from_dir dir looks for available fonts in the given directory. Optional arguments are:
size: size used to load a font; default is default_font_size.recur: whether to look recursively in sub directories; default is true.Close open fonts unused since some time. A font file remains open because of our caching system.
Returns whether a font from the given family is available.
Available fonts. The available fonts are added by calls to load_fonts.
These functions correspond to those of Tsdl_ttf.Ttf, but using font value.
val render_utf8_blended :
font ->
string ->
Tsdl.Sdl.color ->
Tsdl.Sdl.surface Tsdl.Sdl.result