package cairo2

  1. Overview
  2. Docs

Cairo.Font_face.t represents a particular font at a particular weight, slant, and other characteristic but no size, transformation, or size.

type 'a t

A Cairo.Font_face.t specifies all aspects of a font other than the size or font matrix (a font matrix is used to distort a font by sheering it or scaling it unequally in the two directions). A font face can be set on a Cairo.context by using Cairo.Font_face.set; the size and font matrix are set with Cairo.set_font_size and Cairo.set_font_matrix.

Font faces are created using font-backend-specific constructors, or implicitly using the toy text API by way of Cairo.select_font_face.

There are various types of font faces, depending on the font backend they use. The type of a font face can be queried using Cairo.Font_face.get_type.

val set : context -> _ t -> unit

Replaces the current Cairo.Font_face.t object in the Cairo.context with font_face.

val get : context -> font_type t

Gets the current font face for a Cairo.context.

val get_type : 'a t -> font_type

This function returns the type of the backend used to create a font face. See Cairo.font_type for available types. If 'a contains a single variant, it will be the returned value.

val create : ?family:string -> slant -> weight -> [ `Toy ] t

create family slant weight creates a font face from a triplet of family, slant, and weight. These font faces are used in implementation of the the cairo "toy" font API.

If family is not given or is the zero-length string "", the platform-specific default family is assumed. The default family then can be queried using Cairo.Font_face.get_family.

The Cairo.select_font_face function uses this to create font faces. See that function for limitations of toy font faces.

val get_family : [ `Toy ] t -> string

Gets the familly name of a toy font.

val get_slant : [ `Toy ] t -> slant

Gets the slant a toy font.

val get_weight : [ `Toy ] t -> weight

Gets the weight a toy font.

OCaml

Innovation. Community. Security.