class Cairo::FontOptions

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.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(font_options : LibCairo::PFontOptionsT) #

[View source]
def self.new #

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.


[View source]

Instance Method Detail

def antialias : Antialias #

Gets the antialiasing mode for the font options object.

###Returns The antialiasing mode.


[View source]
def antialias=(antialias : Antialias) #

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

[View source]
def dup : FontOptions #

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.


[View source]
def equals(other : FontOptions) : Bool #

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.


[View source]
def finalize #

Destroys a FontOptions object created with FontOptions#initialize or FontOptions#dup.


[View source]
def 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.

###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.


[View source]
def hint_metrics : HintMetrics #

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.


[View source]
def hint_metrics=(hint_metrics : HintMetrics) #

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

[View source]
def hint_style : HintStyle #

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.


[View source]
def hint_style=(hint_style : HintStyle) #

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

[View source]
def merge(other : FontOptions) #

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


[View source]
def status : Status #

Checks whether an error has previously occurred for this font options object.

###Returns Status::Success or Status::NoMemory.


[View source]
def subpixel_order : SubpixelOrder #

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.


[View source]
def subpixel_order=(subpixel_order : SubpixelOrder) #

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

[View source]
def to_unsafe : LibCairo::PFontOptionsT #

[View source]
def variations : String #

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=.


[View source]
def variations=(variation : String) #

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

[View source]