Class OcsfmlGraphics.const_font

class const_font : [ `Copy of < rep__sf_Font : Font.t; .. > | `None ] -> object .. end
Class for loading and manipulating character fonts.

Fonts can be loaded from a file, from memory or from a custom stream, and supports the most common types of fonts.

See the load_from_file function for the complete list of supported formats.

Once it is loaded, a font instance provides three types of informations about the font:

Fonts alone are not very useful: they hold the font data but cannot make anything useful of it. To do so you need to use the text class, which is able to properly output text with several options such as character size, style, color, position, rotation, etc. This separation allows more flexibility and better performances: indeed a font is a heavy resource, and any operation on it is slow (often too slow for real-time applications). On the other side, a text is a lightweight object which can combine the glyphs data and metrics of a font to display any text on a render target. Note that it is also possible to bind several text instances to the same font.

It is important to note that the text instance doesn't copy the font that it uses, it only keeps a reference to it. Thus, a font must not be destructed while it is used by a text (i.e. never write a function that uses a local font instance for creating a text).

method destroy : unit
method get_glyph : int -> int -> bool -> Glyph.t
method get_kerning : int -> int -> int -> int
method get_line_spacing : int -> int
method get_texture : int -> const_texture reference