Module Cairo.Font_options

The font options specify how fonts should be rendered. Most of the time the font options implied by a surface are just right and do not need any changes, but for pixel-based targets tweaking font options may result in superior output on a particular display.

type t

An opaque type holding all options that are used when rendering fonts.

Individual features of a Cairo.Font_options.t can be set or accessed using functions below, like Cairo.Font_options.set_antialias and Cairo.Font_options.get_antialias.

New features may be added to a font_options in the future. For this reason, Cairo.Font_options.copy and Cairo.Font_options.merge should be used to copy or merge of Cairo.Font_options.t values.

val set : context -> t -> unit

set_font_options cr opt sets a set of custom font rendering options for cr. Rendering options are derived by merging these options with the options derived from underlying surface; if the value in options has a default value (like ANTIALIAS_DEFAULT), then the value from the surface is used.

val get : context -> t

Retrieves font rendering options set via Cairo.Font_options.set. Note that the returned options do not include any options derived from the underlying surface; they are literally the options passed to Cairo.Font_options.set.

val create : unit -> t

Allocates a new font options object with all options initialized to default values.

val make : ?⁠antialias:antialias -> ?⁠subpixel_order:subpixel_order -> ?⁠hint_style:hint_style -> ?⁠hint_metrics:hint_metrics -> unit -> t

Convenience function to create an options object with properties set.

parameter antialias

default: ANTIALIAS_DEFAULT

parameter subpixel_order

default: SUBPIXEL_ORDER_DEFAULT

parameter hint_style

default: HINT_STYLE_DEFAULT

parameter hint_metrics

default: HINT_METRICS_DEFAULT

val copy : t -> t

copy original allocates a new font options object copying the option values from original.

val merge : t -> t -> unit

merge options other merges non-default options from other into options, replacing existing values. This operation can be thought of as somewhat similar to compositing other onto options with the operation of OVER (see Cairo.operator).

val set_antialias : t -> antialias -> unit

Sets the antialiasing mode for the font options object. This specifies the type of antialiasing to do when rendering text.

val get_antialias : t -> antialias

Gets the antialiasing mode for the font options object.

val set_subpixel_order : t -> subpixel_order -> unit

Sets the subpixel order for the font options object. The subpixel order specifies the order of color elements within each pixel on the display device when rendering with an antialiasing mode of ANTIALIAS_SUBPIXEL (see Cairo.antialias). See the documentation for Cairo.subpixel_order for full details.

val get_subpixel_order : t -> subpixel_order

Gets the subpixel order for the font options object. See the documentation for Cairo.subpixel_order for full details.

val set_hint_style : t -> hint_style -> unit

Sets the hint style for font outlines for the font options object. This controls whether to fit font outlines to the pixel grid, and if so, whether to optimize for fidelity or contrast. See the documentation for Cairo.hint_style for full details.

val get_hint_style : t -> hint_style

Gets the hint style for font outlines for the font options object. See the documentation for Cairo.hint_style for full details.

val set_hint_metrics : t -> hint_metrics -> unit

Sets the metrics hinting mode for the font options object. This controls whether metrics are quantized to integer values in device units. See the documentation for Cairo.hint_metrics for full details.

val get_hint_metrics : t -> hint_metrics

Gets the metrics hinting mode for the font options object. See the documentation for Cairo.hint_metrics for full details.