cairomm  1.16.2
Public Types | Public Member Functions | Protected Attributes | List of all members
Cairo::FontOptions Class Reference

The font options specify how fonts should be rendered. More...

#include <cairomm/fontoptions.h>

Public Types

enum class  HintStyle {
  DEFAULT = CAIRO_HINT_STYLE_DEFAULT ,
  NONE = CAIRO_HINT_STYLE_NONE ,
  SLIGHT = CAIRO_HINT_STYLE_SLIGHT ,
  MEDIUM = CAIRO_HINT_STYLE_MEDIUM ,
  FULL = CAIRO_HINT_STYLE_FULL
}
 Specifies the type of hinting to do on font outlines. More...
 
enum class  HintMetrics {
  DEFAULT = CAIRO_HINT_METRICS_DEFAULT ,
  OFF = CAIRO_HINT_METRICS_OFF ,
  ON = CAIRO_HINT_METRICS_ON
}
 Specifies whether to hint font metrics; hinting font metrics means quantizing them so that they are integer values in device space. More...
 
typedef cairo_font_options_t cobject
 

Public Member Functions

 FontOptions ()
 
 FontOptions (cairo_font_options_t *cobject, bool take_ownership=false)
 
 FontOptions (const FontOptions & src)
 
virtual ~FontOptions ()
 
FontOptionsoperator= (const FontOptions & src)
 
bool operator== (const FontOptions & src) const
 
void merge (const FontOptions & other)
 Merges non-default options from other into this, replacing existing values. More...
 
unsigned long hash () const
 Compute a hash for the font options object; this value will be useful when storing an object containing a FontOptions in a hash table. More...
 
void set_antialias (Antialias antialias)
 Sets the antialiasing mode for the font options object. More...
 
Antialias get_antialias () const
 Gets the antialiasing mode for the font options object. More...
 
void set_subpixel_order (SubpixelOrder subpixel_order)
 Sets the subpixel order for the font options object. More...
 
SubpixelOrder get_subpixel_order () const
 Gets the subpixel order for the font options object. More...
 
void set_hint_style (HintStyle hint_style)
 Sets the hint style for font outlines for the font options object. More...
 
HintStyle get_hint_style () const
 Gets the hint style for font outlines for the font options object. More...
 
void set_hint_metrics (HintMetrics hint_metrics)
 Sets the metrics hinting mode for the font options object. More...
 
HintMetrics get_hint_metrics () const
 Gets the metrics hinting mode for the font options object. More...
 
cobjectcobj ()
 
const cobjectcobj () const
 

Protected Attributes

cobjectm_cobject
 

Detailed Description

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.

Member Typedef Documentation

◆ cobject

typedef cairo_font_options_t Cairo::FontOptions::cobject

Member Enumeration Documentation

◆ HintMetrics

Specifies whether to hint font metrics; hinting font metrics means quantizing them so that they are integer values in device space.

Doing this improves the consistency of letter and line spacing, however it also means that text will be laid out differently at different zoom factors.

Enumerator
DEFAULT 

Hint metrics in the default manner for the font backend and target device.

OFF 

Do not hint font metrics.

ON 

Hint font metrics.

◆ HintStyle

Specifies the type of hinting to do on font outlines.

Hinting is the process of fitting outlines to the pixel grid in order to improve the appearance of the result. Since hinting outlines involves distorting them, it also reduces the faithfulness to the original outline shapes. Not all of the outline hinting styles are supported by all font backends.

New entries may be added in future versions.

Enumerator
DEFAULT 

Use the default hint style for font backend and target device.

NONE 

Do not hint outlines.

SLIGHT 

Hint outlines slightly to improve contrast while retaining food fidelity to the original shapes.

MEDIUM 

Hint outlines with medium strength giving a compromise between fidelity to the original shapes and contrast.

FULL 

Hint outlines to maximize contrast.

Constructor & Destructor Documentation

◆ FontOptions() [1/3]

Cairo::FontOptions::FontOptions ( )

◆ FontOptions() [2/3]

Cairo::FontOptions::FontOptions ( cairo_font_options_t *  cobject,
bool  take_ownership = false 
)
explicit

◆ FontOptions() [3/3]

Cairo::FontOptions::FontOptions ( const FontOptions src)

◆ ~FontOptions()

virtual Cairo::FontOptions::~FontOptions ( )
virtual

Member Function Documentation

◆ cobj() [1/2]

cobject* Cairo::FontOptions::cobj ( )
inline

◆ cobj() [2/2]

const cobject* Cairo::FontOptions::cobj ( ) const
inline

◆ get_antialias()

Antialias Cairo::FontOptions::get_antialias ( ) const

Gets the antialiasing mode for the font options object.

Returns
the antialiasing mode

◆ get_hint_metrics()

HintMetrics Cairo::FontOptions::get_hint_metrics ( ) const

Gets the metrics hinting mode for the font options object.

See the documentation for HintMetrics for full details.

Return value: the metrics hinting mode for the font options object.

◆ get_hint_style()

HintStyle Cairo::FontOptions::get_hint_style ( ) const

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.

◆ get_subpixel_order()

SubpixelOrder Cairo::FontOptions::get_subpixel_order ( ) const

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.

◆ hash()

unsigned long Cairo::FontOptions::hash ( ) const

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.

◆ merge()

void Cairo::FontOptions::merge ( const FontOptions other)

Merges non-default options from other into this, replacing existing values.

This operation can be thought of as somewhat similar to compositing other onto this with the operation of OPERATION_OVER.

Parameters
otheranother FontOptions

◆ operator=()

FontOptions& Cairo::FontOptions::operator= ( const FontOptions src)

◆ operator==()

bool Cairo::FontOptions::operator== ( const FontOptions src) const

◆ set_antialias()

void Cairo::FontOptions::set_antialias ( Antialias  antialias)

Sets the antialiasing mode for the font options object.

This specifies the type of antialiasing to do when rendering text.

Parameters
antialiasthe new antialiasing mode.

◆ set_hint_metrics()

void Cairo::FontOptions::set_hint_metrics ( HintMetrics  hint_metrics)

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_metricsthe new metrics hinting mode.

◆ set_hint_style()

void Cairo::FontOptions::set_hint_style ( HintStyle  hint_style)

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_stylethe new hint style.

◆ set_subpixel_order()

void Cairo::FontOptions::set_subpixel_order ( SubpixelOrder  subpixel_order)

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 Cairo::ANTIALIAS_SUBPIXEL. See the documentation for SubpixelOrder for full details.

Parameters
subpixel_orderthe new subpixel order.

Member Data Documentation

◆ m_cobject

cobject* Cairo::FontOptions::m_cobject
protected

The documentation for this class was generated from the following file: