class Cairo::FontOptions
- Cairo::FontOptions
- Reference
- Object
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.
Defined in:
cairo/font_options.crConstructors
- .new(font_options : LibCairo::PFontOptionsT)
-
.new
Allocates a new font options object with all options initialized to default values.
Instance Method Summary
-
#antialias : Antialias
Gets the antialiasing mode for the font options object.
-
#antialias=(antialias : Antialias)
Sets the antialiasing mode for the font options object.
-
#dup : FontOptions
Allocates a new font options object copying the option values from original.
-
#equals(other : FontOptions) : Bool
Compares two font options objects for equality.
-
#finalize
Destroys a
FontOptions
object created withFontOptions#initialize
orFontOptions#dup
. -
#hash : UInt64
Compute a hash for the font options object; this value will be useful when storing an object containing a
FontOptions
in a hash table. -
#hint_metrics : HintMetrics
Gets the metrics hinting mode for the font options object.
-
#hint_metrics=(hint_metrics : HintMetrics)
Sets the metrics hinting mode for the font options object.
-
#hint_style : HintStyle
Gets the hint style for font outlines for the font options object.
-
#hint_style=(hint_style : HintStyle)
Sets the hint style for font outlines for the font options object.
-
#merge(other : FontOptions)
Merges non-default options from other into options, replacing existing values.
-
#status : Status
Checks whether an error has previously occurred for this font options object.
-
#subpixel_order : SubpixelOrder
Gets the subpixel order for the font options object.
-
#subpixel_order=(subpixel_order : SubpixelOrder)
Sets the subpixel order for the font options object.
- #to_unsafe : LibCairo::PFontOptionsT
-
#variations : String
Gets the OpenType font variations for the font options object.
-
#variations=(variation : String)
Sets the OpenType font variations for the font options object.
Constructor Detail
Allocates a new font options object with all options initialized to default values.
###Returns
A newly allocated FontOptions
. Free with FontOptions#finalize
.
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 FontOptions#status
.
Instance Method Detail
Gets the antialiasing mode for the font options object.
###Returns The antialiasing mode.
Sets the antialiasing mode for the font options object. This specifies the type of antialiasing to do when rendering text.
###Parameters
- antialias the new antialiasing mode
Allocates a new font options object copying the option values from original.
###Returns
A newly allocated FontOptions
. Free with FontOptions#finalize
.
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 FontOptions#status
.
Compares two font options objects for equality.
###Parameters
- other another
FontOptinos
###Returns
true
if all fields of the two font options objects match. Note that this function will return false
if either object is in error.
Destroys a FontOptions
object created with FontOptions#initialize
or FontOptions#dup
.
Compute a hash for the font options object;
this value will be useful when storing an object containing a FontOptions
in a hash table.
###Returns 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.
Gets the metrics hinting mode for the font options object.
See the documentation for HintMetrics
for full details.
###Returns The metrics hinting mode for the font options object.
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 HintMetrics
for full details.
###Parameters
- hint_metrics the new metrics hinting mode
Gets the hint style for font outlines for the font options object.
See the documentation for HintStyle
for full details.
###Returns The hint style for the font options object.
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 HintStyle
for full details.
###Parameters
- hint_style the new hint style
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 Operator::Over
.
###Parameters
- other another
FontOptions
Checks whether an error has previously occurred for this font options object.
###Returns
Status::Success
or Status::NoMemory
.
Gets the subpixel order for the font options object.
See the documentation for SubpixelOrder
for full details.
###Returns The subpixel order for the font options object.
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 the documentation for SubpixelOrder
for full details.
###Parameters
- subpixel_order the new subpixel order
Gets the OpenType font variations for the font options object.
See FontOptions#variations
= for details about the string format.
###Returns
The font variations for the font options object.
The returned string belongs to the options and must not be modified.
It is valid until either the font options object is destroyed or the font variations in this object
is modified with FontOptions#variations=
.
Sets the OpenType font variations for the font options object. Font variations are specified as a string with a format that is similar to the CSS font-variation-settings. The string contains a comma-separated list of axis assignments, which each assignment consists of a 4-character axis name and a value, separated by whitespace and optional equals sign.
###Parameters
- variations the new font variations