PgFontDescription

Description Pango supports a flexible architecture where a particular rendering architecture can supply an implementation of fonts. The PangoFont structure represents an abstract rendering-system-independent font. Pango provides routines to list available fonts, and to load a font of a given description.

Constructors

this
this(PangoFontDescription* pangoFontDescription)

Sets our main struct and passes it to the parent class

this
this(string family, int size)

Creates a nwe font description and set the family nd the size

this
this()

Creates a new font description structure with all fields unset.

Members

Functions

betterMatch
int betterMatch(PgFontDescription oldMatch, PgFontDescription newMatch)

Determines if the style attributes of new_match are a closer match for desc than those of old_match are, or if old_match is NULL, determines if new_match is a match at all. Approximate matching is done for weight and style; other style attributes must match exactly. Style attributes are all attributes other than family and size-related attributes. Approximate matching for style considers PANGO_STYLE_OBLIQUE and PANGO_STYLE_ITALIC as matches, but not as good a match as when the styles are equal. Note that old_match must match desc.

copy
PgFontDescription copy()

Make a copy of a PangoFontDescription.

copyStatic
PgFontDescription copyStatic()

Like pango_font_description_copy(), but only a shallow copy is made of the family name and other allocated fields. The result can only be used until desc is modified or freed. This is meant to be used when the copy is only needed temporarily.

equal
int equal(PgFontDescription desc2)

Compares two font descriptions for equality. Two font descriptions are considered equal if the fonts they describe are provably identical. This means that their masks do not have to match, as long as other fields are all the same. (Two font descriptions may result in identical fonts being loaded, but still compare FALSE.)

free
void free()

Frees a font description.

getFamily
string getFamily()

Gets the family name field of a font description. See pango_font_description_set_family().

getGravity
PangoGravity getGravity()

Gets the gravity field of a font description. See pango_font_description_set_gravity(). Since 1.16

getPgFontDescriptionStruct
PangoFontDescription* getPgFontDescriptionStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
getSetFields
PangoFontMask getSetFields()

Determines which fields in a font description have been set.

getSize
int getSize()

Gets the size field of a font description. See pango_font_description_set_size().

getSizeIsAbsolute
int getSizeIsAbsolute()

Determines whether the size of the font is in points (not absolute) or device units (absolute). See pango_font_description_set_size() and pango_font_description_set_absolute_size(). Since 1.8

getStretch
PangoStretch getStretch()

Gets the stretch field of a font description. See pango_font_description_set_stretch().

getStruct
void* getStruct()

the main Gtk struct as a void*

getStyle
PangoStyle getStyle()

Gets the style field of a PangoFontDescription. See pango_font_description_set_style().

getVariant
PangoVariant getVariant()

Gets the variant field of a PangoFontDescription. See pango_font_description_set_variant().

getWeight
PangoWeight getWeight()

Gets the weight field of a font description. See pango_font_description_set_weight().

hash
uint hash()

Computes a hash of a PangoFontDescription structure suitable to be used, for example, as an argument to g_hash_table_new(). The hash value is independent of desc->mask.

merge
void merge(PgFontDescription descToMerge, int replaceExisting)

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. If desc_to_merge is NULL, this function performs nothing.

mergeStatic
void mergeStatic(PgFontDescription descToMerge, int replaceExisting)

Like pango_font_description_merge(), but only a shallow copy is made of the family name and other allocated fields. desc can only be used until desc_to_merge is modified or freed. This is meant to be used when the merged font description is only needed temporarily.

setAbsoluteSize
void setAbsoluteSize(double size)

Sets the size field of a font description, in device units. This is mutually exclusive with pango_font_description_set_size() which sets the font size in points. Since 1.8

setFamily
void setFamily(string 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 PangoFontFamily. In some uses of PangoFontDescription, it is also possible to use a comma separated list of family names for this field.

setFamilyStatic
void setFamilyStatic(string family)

Like pango_font_description_set_family(), except that no copy of family is made. The caller must make sure that the string passed in stays around until desc has been freed or the name is set again. This function can be used if family is a static string such as a C string literal, or if desc is only needed temporarily.

setGravity
void setGravity(PangoGravity gravity)

Sets the gravity field of a font description. The gravity field specifies how the glyphs should be rotated. If gravity is PANGO_GRAVITY_AUTO, this actually unsets the gravity mask on the font description. This function is seldom useful to the user. Gravity should normally be set on a PangoContext. Since 1.16

setSize
void setSize(int size)

Sets the size field of a font description in fractional points. This is mutually exclusive with pango_font_description_set_absolute_size().

setStretch
void setStretch(PangoStretch stretch)

Sets the stretch field of a font description. The stretch field specifies how narrow or wide the font should be.

setStyle
void setStyle(PangoStyle style)

Sets the style field of a PangoFontDescription. The PangoStyle 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.

setVariant
void setVariant(PangoVariant variant)

Sets the variant field of a font description. The PangoVariant can either be PANGO_VARIANT_NORMAL or PANGO_VARIANT_SMALL_CAPS.

setWeight
void setWeight(PangoWeight 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 PangoWeight enumeration, other intermediate numeric values are possible.

toFilename
string toFilename()

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.

toString
string toString()

Creates a string representation of a font description. See pango_font_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.

unsetFields
void unsetFields(PangoFontMask toUnset)

Unsets some of the fields in a PangoFontDescription. The unset fields will get back to their default values.

Static functions

fromString
PgFontDescription fromString(string str)

Creates a new font description from a string representation 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, stretch, or gravity, and SIZE is a decimal number (size in points) or optionally followed by the unit modifier "px" for absolute size. 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.

Variables

pangoFontDescription
PangoFontDescription* pangoFontDescription;

the main Gtk struct

Meta