Xfce Foundation Classes
Main Page  | IndexNamespace List  |  Alphabetical List  |  Class List  |  File List


Xfc::Pango::FontDescription Class Reference

A PangoFontDescription C++ wrapper class. More...

#include <xfc/pango/font.hh>

Inheritance diagram for Xfc::Pango::FontDescription:

Xfc::G::Boxed Xfc::Object Xfc::Trackable List of all members.

Constructors

Public Member Functions

Accessors
Methods

Detailed Description

A PangoFontDescription C++ wrapper class.

FontDescription represents the description of an ideal font. These objects are used both to list what fonts are available on the system and also for specifying the characteristics of a font to load.

Note: dynamically allocated objects must either be unreferenced or assigned to a smart pointer. Stack objects are automatically unreferenced when they go out of scope.


Constructor & Destructor Documentation

Xfc::Pango::FontDescription::FontDescription (  ) 

Construct a new font description with all fields unset.

The FontDescription is created with a reference count of 1 that the caller owns.

Xfc::Pango::FontDescription::FontDescription ( const String desc  ) 

Creates a new font description from a string representation.

Parameters:
desc A string representation of a font description.
See to_string() for a description of the format of the string representation. The family list in the string description will only have a terminating comma if the last word of the list is a valid style option.

The FontDescription is created with a reference count of 1 that the caller owns.

Xfc::Pango::FontDescription::FontDescription ( const String family,
int  size,
Style  style = STYLE_NORMAL,
Weight  weight = WEIGHT_NORMAL 
)

Construct a new font description with the specifed family, size, style and weight.

Parameters:
family A string representing the family name.
size The size for the font description in pango units (see set_size()).
style The style for the font description.
weight The weight for the font description.
The FontDescription is created with a reference count of 1 that the caller owns.

Xfc::Pango::FontDescription::FontDescription ( PangoFontDescription *  desc  ) 

Construct a new font description from an existing PangoFontDescription.

Parameters:
desc A pointer to a PangoFontDescription.
The desc can be a newly created PangoFontDescription or an existing PangoFontDescription. The font description object created is a temporary object. It doesn't take over the ownership of PangoFontDescription and PangoFontDescription is not freed by the destructor.

The FontDescription is created with a reference count of 1 that the caller owns.

Xfc::Pango::FontDescription::FontDescription ( PangoFontDescription *  desc,
bool  copy 
)

Construct a new font description from an existing PangoFontDescription.

Parameters:
desc A pointer to a PangoFontDescription.
copy Whether the FontDescription object should make a copy of PangoFontDescription or not.
The desc can be a newly created PangoFontDescription or an existing PangoFontDescription. If copy is true FontDescription will make a copy of PangoFontDescription. If copy is false FontDescription wont make a copy but instead takes over the ownership of PangoFontDescription. Either way, the destructor will free PangoFontDescription when the FontDescription object is destroyed. This constructor is used by G::Boxed::wrap() to wrap PangoFontDescription objects in a C++ wrapper.

The FontDescription is created with a reference count of 1 that the caller owns.

Xfc::Pango::FontDescription::FontDescription ( const FontDescription src  ) 

Copy constructor.

Parameters:
src The source FontDescription.


Member Function Documentation

FontDescription& Xfc::Pango::FontDescription::operator= ( const FontDescription src  ) 

Assignment operator.

Parameters:
src The source FontDescription.

String Xfc::Pango::FontDescription::get_family (  )  const

Gets the family name field of a font description (see set_family()).

Returns:
The family name field, or null if not previously set.

Style Xfc::Pango::FontDescription::get_style (  )  const

Gets the style field of a font description (see set_style()).

Returns:
The style field for the font description.
Use get_set_fields() to find out if the field was explicitely set or not.

Variant Xfc::Pango::FontDescription::get_variant (  )  const

Gets the variant field of a font description (see set_variant()).

Returns:
The variant field for the font description.
Use get_set_fields() to find out if the field was explicitely set or not.

Weight Xfc::Pango::FontDescription::get_weight (  )  const

Gets the weight field of a font description (see set_weight()).

Returns:
The weight field for the font description.
Use get_set_fields() to find out if the field was explicitely set or not.

Stretch Xfc::Pango::FontDescription::get_stretch (  )  const

Gets the stretch field of a font description (see set_stretch()).

Returns:
The stretch field for the font description.
Use get_set_fields() to find out if the field was explicitely set or not.

int Xfc::Pango::FontDescription::get_size (  )  const

Gets the size field of a font description.

Returns:
The size field for the font description in points or device units.
You must call get_size_is_absolute() to find out which is the case. This method returns 0 if the size field has not previously been set. You can use get_set_fields() to find out if the field was explicitely set or not.

bool Xfc::Pango::FontDescription::get_size_is_absolute (  )  const

Determines whether the size of the font is in points or device units (see set_size() and set_absolute_size().

Returns:
Whether the the size for the font description is in points or device units.
Use get_set_fields() to find out if the size field of the font description was explicitely set or not.

FontMaskField Xfc::Pango::FontDescription::get_set_fields (  )  const

Determines which fields in a font description have been set.

Returns:
A bitmask with Pango::FontMask bits set corresponding to the fields in desc that have been set.

bool Xfc::Pango::FontDescription::equal ( const FontDescription other  )  const

Compares this font description with other for equality.

Parameters:
other,: Another FontDescription.
Returns:
true if the two font descriptions are proveably identical.
Two font descriptions may result in identical fonts being loaded, but still compare false.

bool Xfc::Pango::FontDescription::operator== ( const FontDescription other  )  const

Equality operator; compares this font description with other for equality.

Parameters:
other,: Another FontDescription.
Returns:
true if the two font descriptions are proveably identical.
Two font descriptions may result in identical fonts being loaded, but still compare false.

bool Xfc::Pango::FontDescription::operator!= ( const FontDescription other  )  const

Inequality operator; compares this font description with other for inequality.

Parameters:
other,: Another FontDescription.
Returns:
true if the two font descriptions are not identical.
Two font descriptions may result in identical fonts being loaded, but still compare false.

unsigned int Xfc::Pango::FontDescription::hash (  )  const

Computes a hash of a font description object suitable to be used, for example, as an argument to g_hash_table_new().

Returns:
The hash value.

String Xfc::Pango::FontDescription::to_string (  )  const

Creates a string representation of the font description.

Returns:
The string representation.
The string representation is in the form "[FAMILY-LIST] [STYLE-OPTIONS] [SIZE]", where FAMILY-LIST is a comma separated list of families optionally terminated by a comma, STYLE_OPTIONS is a whitespace separated list of words where each WORD describes one of style, variant, weight, or stretch, and SIZE is an decimal number (size in points). Any one of the options may be absent. If FAMILY-LIST is absent, then the family_name field of the resulting font description will be initialized to null. If STYLE-OPTIONS is missing, then all style options will be set to the default values. If SIZE is missing, the size in the resulting font description will be set to 0.

String Xfc::Pango::FontDescription::to_filename (  )  const

Creates a filename representation of a font description.

Returns:
A string that can be used as a filename.
The filename is identical to the result from calling to_string(), but with underscores instead of characters that are untypical in filenames, and in lower case only.

void Xfc::Pango::FontDescription::set_family ( const String family  ) 

Sets the family name field of a font description.

Parameters:
family A string representing the family name.
The family name represents a family of related font styles, and will resolve to a particular FontFamily. In some uses of FontDescription, it is also possible to use a comma separated list of family names for this field.

void Xfc::Pango::FontDescription::set_style ( Style  style  ) 

Sets the style field of a font description.

Parameters:
style The style for the font description.
The Pango::Style enumeration describes whether the font is slanted and the manner in which it is slanted; it can be either STYLE_NORMAL, STYLE_ITALIC, or STYLE_OBLIQUE. Most fonts will either have a italic style or an oblique style, but not both, and font matching in Pango will match italic specifications with oblique fonts and vice-versa if an exact match is not found.

void Xfc::Pango::FontDescription::set_variant ( Variant  variant  ) 

Sets the variant field of a font description.

Parameters:
variant The variant type for the font description.
The Variant can either be VARIANT_NORMAL or VARIANT_SMALL_CAPS.

void Xfc::Pango::FontDescription::set_weight ( Weight  weight  ) 

Sets the weight field of a font description.

Parameters:
weight The weight for the font description.
The weight field specifies how bold or light the font should be. In addition to the values of the Pango::Weight enumeration, other intermediate numeric values are possible.

void Xfc::Pango::FontDescription::set_stretch ( Stretch  stretch  ) 

Sets the stretch field of a font description.

Parameters:
stretch The stretch for the font description.
The stretch field specifies how narrow or wide the font should be.

void Xfc::Pango::FontDescription::set_size ( int  size  ) 

Sets the size field of a font description in fractional points.

Parameters:
size The size for the font description in points, scaled by PANGO_SCALE.
This is mutually exclusive with set_absolute_size(). As an example, a size value of 10 * PANGO_SCALE is a 10 point font. The conversion factor between points and device units depends on system configuration and the output device. For screen display, a logical DPI of 96 is common, in which case a 10 point font corresponds to a 10 * (96 / 72) = 13.3 pixel font. Use set_absolute_size() if you need a particular size in device units.

void Xfc::Pango::FontDescription::set_absolute_size ( double  size  ) 

Sets the size field of a font description, in device units.

Parameters:
size The new size, in pango units.
This is mutually exclusive with set_size(). There are PANGO_SCALE Pango units in one device unit. For an output backend where a device unit is a pixel, a size value of 10 * PANGO_SCALE gives a 10 pixel font.

void Xfc::Pango::FontDescription::unset_fields ( FontMaskField  to_unset  ) 

Unsets some of the fields in a font description.

Parameters:
to_unset The bitmask of Pango::FontMask fields in the desc to unset.
Note that this merely marks the fields cleared, it does not clear the settings for those fields.

void Xfc::Pango::FontDescription::merge ( const FontDescription desc_to_merge,
bool  replace_existing 
)

Merges the fields that are set in desc_to_merge into the fields in the font description.

Parameters:
desc_to_merge The font description to merge from.
replace_existing If true, replace fields in the font description with the corresponding values from desc_to_merge, even if they are already exist.
If replace_existing is false, only fields in desc that are not already set are affected. If true, then fields that are already set will be replaced as well.

bool Xfc::Pango::FontDescription::better_match ( const FontDescription new_match,
const FontDescription old_match = 0 
) const

Determines if the style attributes of new_match are a closer match for the font description than old_match, or if old_match is null, determines if new_match is a match at all.

Parameters:
new_match A FontDescription.
old_match A FontDescription, or null.
Approximate matching is done for weight and style; other attributes must match exactly.


The documentation for this class was generated from the following file: Xfce Foundation Classes
Copyright © 2004-2005 The XFC Development Team XFC 4.3