Google

logo top
Main Page   Widgets   Namespaces   Book  

Pango::FontDescription Class Reference

A Pango::FontDescription represents the description of an ideal font. More...

List of all members.

Public Methods

 FontDescription ()
 FontDescription (PangoFontDescription* gobject, bool make_a_copy=true)
 FontDescription (const FontDescription& other)
FontDescription& operator= (const FontDescription& other)
 ~FontDescription ()
void swap (FontDescription& other)
PangoFontDescription* gobj ()
const PangoFontDescription* gobj () const
PangoFontDescription* gobj_copy () const
 FontDescription (const Glib::ustring& font_name)
 Constructs a font description from a string representation.

guint hash () const
 Computes a hash of a Pango::FontDescription structure suitable to be used, for example, as an argument to Glib::hash_table_new().

void set_family (const Glib::ustring& family)
 Sets the family name field of a font description.

Glib::ustring get_family () const
 Gets the family name field of a font description.

void set_style (Style style)
 Sets the style field of a Pango::FontDescription.

Style get_style () const
 Gets the style field of a Pango::FontDescription.

void set_variant (Variant variant)
 Sets the variant field of a font description.

Variant get_variant () const
 Gets the variant field of a Pango::FontDescription.

void set_weight (Weight weight)
 Sets the weight field of a font description.

Weight get_weight () const
 Gets the weight field of a font description.

void set_stretch (Stretch stretch)
 Sets the stretch field of a font description.

Stretch get_stretch () const
 Gets the stretch field of a font description.

void set_size (int size)
 Sets the size field of a font description.

int get_size () const
 Gets the size field of a font description.

FontMask get_set_fields () const
 Determines which fields in a font description have been set.

void unset_fields (FontMask to_unset)
 Unsets some of the fields in a Pango::FontDescription.

void merge (const FontDescription& desc_to_merge, bool replace_existing)
 Merges the fields that are set in desc_to_merge into the fields in desc .

bool better_match (const FontDescription& old_match, const FontDescription& new_match) const
 Determines if the style attributes of new_match are a closer match for desc than old_match , or if old_match is 0, determines if new_match is a match at all.

Glib::ustring to_string () const
 Creates a string representation of a font description.

Glib::ustring to_filename () const
 Creates a filename representation of a font description.


Protected Attributes

PangoFontDescription* gobject_

Related Functions

(Note that these are not member functions.)

bool operator== (const FontDescription& lhs, const FontDescription& rhs)
bool operator!= (const FontDescription& lhs, const FontDescription& rhs)
void swap (FontDescription& lhs, FontDescription& rhs)
Pango::FontDescription wrap (PangoFontDescription* object, bool take_copy=false)


Detailed Description

A Pango::FontDescription represents the description of an ideal font.

It is used both to list what fonts are available on the system and also for specifying the characteristics of a font to load.


Constructor & Destructor Documentation

Pango::FontDescription::FontDescription (  
 

Pango::FontDescription::FontDescription ( PangoFontDescription*    gobject,
bool    make_a_copy = true
[explicit]
 

Pango::FontDescription::FontDescription ( const FontDescription&    other
 

Pango::FontDescription::~FontDescription (  
 

Pango::FontDescription::FontDescription ( const Glib::ustring   font_name [explicit]
 

Constructs a font description from a string representation.

font_name must have 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 0. 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.

Parameters:
font_name String representation of a font description.


Member Function Documentation

bool Pango::FontDescription::better_match ( const FontDescription&    old_match,
const FontDescription&    new_match
const
 

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

Approximate matching is done for weight and style; other attributes must match exactly.

Parameters:
old_match A Pango::FontDescription, or 0.
new_match A Pango::FontDescription.
Returns:
true if new_match is a better match.

Glib::ustring Pango::FontDescription::get_family (   const
 

Gets the family name field of a font description.

See pango_font_description_set_family().

Returns:
The family name field. (Will be 0 if not previously set.).

FontMask Pango::FontDescription::get_set_fields (   const
 

Determines which fields in a font description have been set.

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

int Pango::FontDescription::get_size (   const
 

Gets the size field of a font description.

See pango_font_description_get_size().

Returns:
The size field for the font description in pango units. (There are Pango::SCALE pango units in one device unit —for fonts, font points are the device unit.) Returns 0 if the stretch field has not previously been set. pango_font_description_get_set_fields() to find out if the field was explicitely set or not.

Stretch Pango::FontDescription::get_stretch (   const
 

Gets the stretch field of a font description.

See pango_font_description_set_stretch().

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

Style Pango::FontDescription::get_style (   const
 

Gets the style field of a Pango::FontDescription.

See pango_font_description_set_style().

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

Variant Pango::FontDescription::get_variant (   const
 

Gets the variant field of a Pango::FontDescription.

See pango_font_description_set_variant().

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

Weight Pango::FontDescription::get_weight (   const
 

Gets the weight field of a font description.

See pango_font_description_set_weight().

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

const PangoFontDescription* Pango::FontDescription::gobj (   const [inline]
 

PangoFontDescription* Pango::FontDescription::gobj (   [inline]
 

PangoFontDescription* Pango::FontDescription::gobj_copy (   const
 

guint Pango::FontDescription::hash (   const
 

Computes a hash of a Pango::FontDescription structure suitable to be used, for example, as an argument to Glib::hash_table_new().

Returns:
The hash value.

void 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 desc .

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.

Parameters:
desc_to_merge The Pango::FontDescription to merge from.
replace_existing If true, replace fields in desc with the corresponding values from desc_to_merge , even if they are already exist.

FontDescription& Pango::FontDescription::operator= ( const FontDescription&    other
 

void Pango::FontDescription::set_family ( const Glib::ustring   family
 

Sets the family name field of a font description.

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

Parameters:
family A string representing the family name.

void Pango::FontDescription::set_size ( int    size
 

Sets the size field of a font description.

Parameters:
size The size for the font description in pango units. There are Pango::SCALE Pango units in one device unit (device unit is a point, for font sizes).

void Pango::FontDescription::set_stretch ( Stretch    stretch
 

Sets the stretch field of a font description.

The stretch field specifies how narrow or wide the font should be.

Parameters:
stretch The stretch for the font description.

void Pango::FontDescription::set_style ( Style    style
 

Sets the style field of a Pango::FontDescription.

The Pango::Style enumeration describes whether the font is slanted and the manner in which it is slanted; it can be either Pango::STYLE_NORMAL, Pango::STYLE_ITALIC, or Pango::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.

Parameters:
style The style for the font description.

void Pango::FontDescription::set_variant ( Variant    variant
 

Sets the variant field of a font description.

The Pango::Variant can either be Pango::VARIANT_NORMAL or Pango::VARIANT_SMALL_CAPS.

Parameters:
variant The variant type for the font description.

void Pango::FontDescription::set_weight ( Weight    weight
 

Sets the weight field of a 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.

Parameters:
weight The weight for the font description.

void Pango::FontDescription::swap ( FontDescription&    other
 

Glib::ustring Pango::FontDescription::to_filename (   const
 

Creates a filename representation of a font description.

The filename is identical to the result from calling pango_font_description_to_string(), but with underscores instead of characters that are untypical in filenames, and in lower case only.

Returns:
A new string that must be freed with Glib::free().

Glib::ustring Pango::FontDescription::to_string (   const
 

Creates a string representation of a font description.

See description_from_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.

Returns:
A new string that must be freed with Glib::free().

void Pango::FontDescription::unset_fields ( FontMask    to_unset
 

Unsets some of the fields in a Pango::FontDescription.

Note that this merely marks the fields cleared, it does not clear the settings for those fields, to clear a family name set with pango_font_description_set_family_static() so that it won't be returned by subsequent calls to pango_font_description_get_family(), you must actually call pango_font_description_set_family (desc, 0);

Parameters:
to_unset Bitmask of fields in the desc to unset.


Friends And Related Function Documentation

bool operator!= ( const FontDescription&    lhs,
const FontDescription&    rhs
[related]
 

bool operator== ( const FontDescription&    lhs,
const FontDescription&    rhs
[related]
 

void swap ( FontDescription&    lhs,
FontDescription&    rhs
[related]
 

Pango::FontDescription wrap ( PangoFontDescription*    object,
bool    take_copy = false
[related]
 


Member Data Documentation

PangoFontDescription* Pango::FontDescription::gobject_ [protected]
 


The documentation for this class was generated from the following file:
Generated for gtkmm by Doxygen 1.3-rc1 © 1997-2001