Next: , Previous: Scaled Fonts, Up: Top


9 Font Options

How a font should be rendered

9.1 Overview

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.

9.2 Usage

— Function: cairo-font-options-create ⇒  (ret <cairo-font-options-t >)

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

ret
a newly allocated <cairo-font-options-t>. Free with cairo-font-options-destroy. This function always returns a valid pointer; if memory cannot be allocated, then a special error object is returned where all operations on the object do nothing. You can check for this with cairo-font-options-status.
— Function: cairo-font-options-copy (original <cairo-font-options-t>) ⇒  (ret <cairo-font-options-t >)

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

original
a <cairo-font-options-t>
ret
a newly allocated <cairo-font-options-t>. Free with cairo-font-options-destroy. This function always returns a valid pointer; if memory cannot be allocated, then a special error object is returned where all operations on the object do nothing. You can check for this with cairo-font-options-status.
— Function: cairo-font-options-merge (options <cairo-font-options-t>) (other <cairo-font-options-t>)

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 ‘CAIRO_OPERATION_OVER’.

options
a <cairo-font-options-t>
other
another <cairo-font-options-t>
— Function: cairo-font-options-hash (options <cairo-font-options-t>) ⇒  (ret <unsigned long>)

Compute a hash for the font options object; this value will be useful when storing an object containing a <cairo-font-options-t> in a hash table.

options
a <cairo-font-options-t>
ret
the hash value for the font options object. The return value can be cast to a 32-bit type if a 32-bit hash value is needed.
— Function: cairo-font-options-set-antialias (options <cairo-font-options-t>) (antialias <cairo-antialias-t>)

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

options
a <cairo-font-options-t>
antialias
the new antialiasing mode
— Function: cairo-font-options-get-antialias (options <cairo-font-options-t>) ⇒  (ret <cairo-antialias-t>)

Gets the antialiasing mode for the font options object.

options
a <cairo-font-options-t>
ret
the antialiasing mode
— Function: cairo-font-options-set-hint-style (options <cairo-font-options-t>) (hint-style <cairo-hint-style-t>)

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-t> for full details.

options
a <cairo-font-options-t>
hint-style
the new hint style
— Function: cairo-font-options-get-hint-style (options <cairo-font-options-t>) ⇒  (ret <cairo-hint-style-t>)

Gets the hint style for font outlines for the font options object. See the documentation for <cairo-hint-style-t> for full details.

options
a <cairo-font-options-t>
ret
the hint style for the font options object
— Function: cairo-font-options-set-hint-metrics (options <cairo-font-options-t>) (hint-metrics <cairo-hint-metrics-t>)

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-t> for full details.

options
a <cairo-font-options-t>
hint-metrics
the new metrics hinting mode