gi-pango-1.0.30: Pango bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | None
Language | Haskell2010

GI.Pango.Structs.FontDescription

Contents

- Exported types
- Methods
  - betterMatch
  - copy
  - copyStatic
  - equal
  - free
  - fromString
  - getColor
  - getFamily
  - getFeatures
  - getGravity
  - getSetFields
  - getSize
  - getSizeIsAbsolute
  - getStretch
  - getStyle
  - getVariant
  - getVariations
  - getWeight
  - hash
  - merge
  - mergeStatic
  - new
  - setAbsoluteSize
  - setColor
  - setFamily
  - setFamilyStatic
  - setFeatures
  - setFeaturesStatic
  - setGravity
  - setSize
  - setStretch
  - setStyle
  - setVariant
  - setVariations
  - setVariationsStatic
  - setWeight
  - toFilename
  - toString
  - unsetFields

Description

A `PangoFontDescription` describes a font in an implementation-independent manner.

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

Synopsis

- newtype FontDescription = FontDescription (ManagedPtr FontDescription)
- fontDescriptionBetterMatch :: (HasCallStack, MonadIO m) => FontDescription -> Maybe FontDescription -> FontDescription -> m Bool
- fontDescriptionCopy :: (HasCallStack, MonadIO m) => Maybe FontDescription -> m (Maybe FontDescription)
- fontDescriptionCopyStatic :: (HasCallStack, MonadIO m) => Maybe FontDescription -> m (Maybe FontDescription)
- fontDescriptionEqual :: (HasCallStack, MonadIO m) => FontDescription -> FontDescription -> m Bool
- fontDescriptionFree :: (HasCallStack, MonadIO m) => Maybe FontDescription -> m ()
- fontDescriptionFromString :: (HasCallStack, MonadIO m) => Text -> m FontDescription
- fontDescriptionGetColor :: (HasCallStack, MonadIO m) => FontDescription -> m FontColor
- fontDescriptionGetFamily :: (HasCallStack, MonadIO m) => FontDescription -> m (Maybe Text)
- fontDescriptionGetFeatures :: (HasCallStack, MonadIO m) => FontDescription -> m (Maybe Text)
- fontDescriptionGetGravity :: (HasCallStack, MonadIO m) => FontDescription -> m Gravity
- fontDescriptionGetSetFields :: (HasCallStack, MonadIO m) => FontDescription -> m [FontMask]
- fontDescriptionGetSize :: (HasCallStack, MonadIO m) => FontDescription -> m Int32
- fontDescriptionGetSizeIsAbsolute :: (HasCallStack, MonadIO m) => FontDescription -> m Bool
- fontDescriptionGetStretch :: (HasCallStack, MonadIO m) => FontDescription -> m Stretch
- fontDescriptionGetStyle :: (HasCallStack, MonadIO m) => FontDescription -> m Style
- fontDescriptionGetVariant :: (HasCallStack, MonadIO m) => FontDescription -> m Variant
- fontDescriptionGetVariations :: (HasCallStack, MonadIO m) => FontDescription -> m (Maybe Text)
- fontDescriptionGetWeight :: (HasCallStack, MonadIO m) => FontDescription -> m Weight
- fontDescriptionHash :: (HasCallStack, MonadIO m) => FontDescription -> m Word32
- fontDescriptionMerge :: (HasCallStack, MonadIO m) => FontDescription -> Maybe FontDescription -> Bool -> m ()
- fontDescriptionMergeStatic :: (HasCallStack, MonadIO m) => FontDescription -> FontDescription -> Bool -> m ()
- fontDescriptionNew :: (HasCallStack, MonadIO m) => m FontDescription
- fontDescriptionSetAbsoluteSize :: (HasCallStack, MonadIO m) => FontDescription -> Double -> m ()
- fontDescriptionSetColor :: (HasCallStack, MonadIO m) => FontDescription -> FontColor -> m ()
- fontDescriptionSetFamily :: (HasCallStack, MonadIO m) => FontDescription -> Text -> m ()
- fontDescriptionSetFamilyStatic :: (HasCallStack, MonadIO m) => FontDescription -> Text -> m ()
- fontDescriptionSetFeatures :: (HasCallStack, MonadIO m) => FontDescription -> Maybe Text -> m ()
- fontDescriptionSetFeaturesStatic :: (HasCallStack, MonadIO m) => FontDescription -> Text -> m ()
- fontDescriptionSetGravity :: (HasCallStack, MonadIO m) => FontDescription -> Gravity -> m ()
- fontDescriptionSetSize :: (HasCallStack, MonadIO m) => FontDescription -> Int32 -> m ()
- fontDescriptionSetStretch :: (HasCallStack, MonadIO m) => FontDescription -> Stretch -> m ()
- fontDescriptionSetStyle :: (HasCallStack, MonadIO m) => FontDescription -> Style -> m ()
- fontDescriptionSetVariant :: (HasCallStack, MonadIO m) => FontDescription -> Variant -> m ()
- fontDescriptionSetVariations :: (HasCallStack, MonadIO m) => FontDescription -> Maybe Text -> m ()
- fontDescriptionSetVariationsStatic :: (HasCallStack, MonadIO m) => FontDescription -> Text -> m ()
- fontDescriptionSetWeight :: (HasCallStack, MonadIO m) => FontDescription -> Weight -> m ()
- fontDescriptionToFilename :: (HasCallStack, MonadIO m) => FontDescription -> m (Maybe Text)
- fontDescriptionToString :: (HasCallStack, MonadIO m) => FontDescription -> m Text
- fontDescriptionUnsetFields :: (HasCallStack, MonadIO m) => FontDescription -> [FontMask] -> m ()

# Exported types

newtype FontDescription Source #

Memory-managed wrapper type.

Constructors

FontDescription (ManagedPtr FontDescription) |

#### Instances

Instances details

Eq FontDescription Source # |
Instance details Defined in GI.Pango.Structs.FontDescription Methods (==) :: FontDescription -> FontDescription -> Bool Source # (/=) :: FontDescription -> FontDescription -> Bool Source #
GBoxed FontDescription Source # |
Instance details Defined in GI.Pango.Structs.FontDescription
ManagedPtrNewtype FontDescription Source # |
Instance details Defined in GI.Pango.Structs.FontDescription Methods toManagedPtr :: FontDescription -> ManagedPtr FontDescription Source #
TypedObject FontDescription Source # |
Instance details Defined in GI.Pango.Structs.FontDescription Methods glibType :: IO GType Source #
HasParentTypes FontDescription Source # |
Instance details Defined in GI.Pango.Structs.FontDescription
IsGValue (Maybe FontDescription) Source # | Convert `FontDescription` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Pango.Structs.FontDescription Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe FontDescription -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe FontDescription) Source #
type ParentTypes FontDescription Source # |
Instance details Defined in GI.Pango.Structs.FontDescription type ParentTypes FontDescription = '[] :: [Type]

# Methods

### Click to display all available methods, including inherited ones

Expand

#### Methods

betterMatch, copy, copyStatic, equal, free, hash, merge, mergeStatic, toFilename, toString, unsetFields.

#### Getters

getColor, getFamily, getFeatures, getGravity, getSetFields, getSize, getSizeIsAbsolute, getStretch, getStyle, getVariant, getVariations, getWeight.

#### Setters

setAbsoluteSize, setColor, setFamily, setFamilyStatic, setFeatures, setFeaturesStatic, setGravity, setSize, setStretch, setStyle, setVariant, setVariations, setVariationsStatic, setWeight.

## betterMatch

fontDescriptionBetterMatch Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontDescription | `desc`: a `PangoFontDescription`
-> Maybe FontDescription | `oldMatch`: a `PangoFontDescription`, or `Nothing`
-> FontDescription | `newMatch`: a `PangoFontDescription`
-> m Bool | Returns: `True` if `newMatch` is a better match

Determines if the style attributes of `newMatch` are a closer match for `desc` than those of `oldMatch` are, or if `oldMatch` is `Nothing`, determines if `newMatch` 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 `StyleOblique` and `StyleItalic` as matches, but not as good a match as when the styles are equal.

Note that `oldMatch` must match `desc`.

## copy

fontDescriptionCopy Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Maybe FontDescription | `desc`: a `PangoFontDescription`, may be `Nothing`
-> m (Maybe FontDescription) | Returns: the newly allocated `PangoFontDescription`, which should be freed with `fontDescriptionFree`, or `Nothing` if `desc` was `Nothing`.

Make a copy of a `PangoFontDescription`.

## copyStatic

fontDescriptionCopyStatic Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Maybe FontDescription | `desc`: a `PangoFontDescription`, may be `Nothing`
-> m (Maybe FontDescription) | Returns: the newly allocated `PangoFontDescription`, which should be freed with `fontDescriptionFree`, or `Nothing` if `desc` was `Nothing`.

Make a copy of a `PangoFontDescription`, but don't duplicate allocated fields.

This is like `fontDescriptionCopy`, 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

fontDescriptionEqual Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontDescription | `desc1`: a `PangoFontDescription`
-> FontDescription | `desc2`: another `PangoFontDescription`
-> m Bool | Returns: `True` if the two font descriptions are identical, `False` otherwise.

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

fontDescriptionFree Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Maybe FontDescription | `desc`: a `PangoFontDescription`, may be `Nothing`
-> m () |

Frees a font description.

## fromString

fontDescriptionFromString Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Text | `str`: string representation of a font description.
-> m FontDescription | Returns: a new `PangoFontDescription`.

Creates a new font description from a string representation.

The string must have the form

FAMILY-LIST
  [STYLE-OPTIONS] [SIZE] [VARIATIONS] [FEATURES]

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.

The following words are understood as styles: "Normal", "Roman", "Oblique", "Italic".

The following words are understood as variants: "Small-Caps", "All-Small-Caps", "Petite-Caps", "All-Petite-Caps", "Unicase", "Title-Caps".

The following words are understood as weights: "Thin", "Ultra-Light", "Extra-Light", "Light", "Semi-Light", "Demi-Light", "Book", "Regular", "Medium", "Semi-Bold", "Demi-Bold", "Bold", "Ultra-Bold", "Extra-Bold", "Heavy", "Black", "Ultra-Black", "Extra-Black".

The following words are understood as stretch values: "Ultra-Condensed", "Extra-Condensed", "Condensed", "Semi-Condensed", "Semi-Expanded", "Expanded", "Extra-Expanded", "Ultra-Expanded".

The following words are understood as gravity values: "Not-Rotated", "South", "Upside-Down", "North", "Rotated-Left", "East", "Rotated-Right", "West".

The following words are understood as color values: "With-Color", "Without-Color".

VARIATIONS is a comma-separated list of font variations of the form @‍axis1=value,axis2=value,...

FEATURES is a comma-separated list of font features of the form #‍feature1=value,feature2=value,... The =value part can be ommitted if the value is 1.

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 `Nothing`. 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.

A typical example:

Cantarell Italic Light 15 @‍wght=200 #‍tnum=1

## getColor

fontDescriptionGetColor Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontDescription | `desc`: a `PangoFontDescription`
-> m FontColor |

Returns the color field of the font description.

This field determines whether the font description should match fonts that have color glyphs, or fonts that don't.

Since: 1.57

## getFamily

fontDescriptionGetFamily Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontDescription | `desc`: a `PangoFontDescription`.
-> m (Maybe Text) | Returns: the family name field for the font description, or `Nothing` if not previously set. This has the same life-time as the font description itself and should not be freed.

Gets the family name field of a font description.

See `fontDescriptionSetFamily`.

## getFeatures

fontDescriptionGetFeatures Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontDescription | `desc`: a `PangoFontDescription`
-> m (Maybe Text) | Returns: the features field for the font description, or `Nothing` if not previously set. This has the same life-time as the font description itself and should not be freed.

Gets the features field of a font description.

See `fontDescriptionSetFeatures`.

Since: 1.56

## getGravity

fontDescriptionGetGravity Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontDescription | `desc`: a `PangoFontDescription`
-> m Gravity | Returns: the gravity field for the font description. Use `fontDescriptionGetSetFields` to find out if the field was explicitly set or not.

Gets the gravity field of a font description.

See `fontDescriptionSetGravity`.

Since: 1.16

## getSetFields

fontDescriptionGetSetFields Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontDescription | `desc`: a `PangoFontDescription`
-> m [FontMask] | Returns: a bitmask with bits set corresponding to the fields in `desc` that have been set.

Determines which fields in a font description have been set.

## getSize

fontDescriptionGetSize Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontDescription | `desc`: a `PangoFontDescription`
-> m Int32 | Returns: the size field for the font description in points or device units. You must call `fontDescriptionGetSizeIsAbsolute` to find out which is the case. Returns 0 if the size field has not previously been set or it has been set to 0 explicitly. Use `fontDescriptionGetSetFields` to find out if the field was explicitly set or not.

Gets the size field of a font description.

See `fontDescriptionSetSize`.

## getSizeIsAbsolute

fontDescriptionGetSizeIsAbsolute Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontDescription | `desc`: a `PangoFontDescription`
-> m Bool | Returns: whether the size for the font description is in points or device units. Use `fontDescriptionGetSetFields` to find out if the size field of the font description was explicitly set or not.

Determines whether the size of the font is in points (not absolute) or device units (absolute).

See `fontDescriptionSetSize` and `fontDescriptionSetAbsoluteSize`.

Since: 1.8

## getStretch

fontDescriptionGetStretch Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontDescription | `desc`: a `PangoFontDescription`.
-> m Stretch | Returns: the stretch field for the font description. Use `fontDescriptionGetSetFields` to find out if the field was explicitly set or not.

Gets the stretch field of a font description.

See `fontDescriptionSetStretch`.

## getStyle

fontDescriptionGetStyle Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontDescription | `desc`: a `PangoFontDescription`
-> m Style | Returns: the style field for the font description. Use `fontDescriptionGetSetFields` to find out if the field was explicitly set or not.

Gets the style field of a `PangoFontDescription`.

See `fontDescriptionSetStyle`.

## getVariant

fontDescriptionGetVariant Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontDescription | `desc`: a `PangoFontDescription`.
-> m Variant | Returns: the variant field for the font description. Use `fontDescriptionGetSetFields` to find out if the field was explicitly set or not.

Gets the variant field of a `PangoFontDescription`.

See `fontDescriptionSetVariant`.

## getVariations

fontDescriptionGetVariations Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontDescription | `desc`: a `PangoFontDescription`
-> m (Maybe Text) | Returns: the variations field for the font description, or `Nothing` if not previously set. This has the same life-time as the font description itself and should not be freed.

Gets the variations field of a font description.

See `fontDescriptionSetVariations`.

Since: 1.42

## getWeight

fontDescriptionGetWeight Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontDescription | `desc`: a `PangoFontDescription`
-> m Weight | Returns: the weight field for the font description. Use `fontDescriptionGetSetFields` to find out if the field was explicitly set or not.

Gets the weight field of a font description.

See `fontDescriptionSetWeight`.

## hash

fontDescriptionHash Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontDescription | `desc`: a `PangoFontDescription`
-> m Word32 | Returns: the hash value.

Computes a hash of a `PangoFontDescription` structure.

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

## merge

fontDescriptionMerge Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontDescription | `desc`: a `PangoFontDescription`
-> Maybe FontDescription | `descToMerge`: the `PangoFontDescription` to merge from, or `Nothing`
-> Bool | `replaceExisting`: if `True`, replace fields in `desc` with the corresponding values from `descToMerge`, even if they are already exist.
-> m () |

Merges the fields that are set in `descToMerge` into the fields in `desc`.

If `replaceExisting` 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 `descToMerge` is `Nothing`, this function performs nothing.

## mergeStatic

fontDescriptionMergeStatic Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontDescription | `desc`: a `PangoFontDescription`
-> FontDescription | `descToMerge`: the `PangoFontDescription` to merge from
-> Bool | `replaceExisting`: if `True`, replace fields in `desc` with the corresponding values from `descToMerge`, even if they are already exist.
-> m () |

Merges the fields that are set in `descToMerge` into the fields in `desc`, without copying allocated fields.

This is like `fontDescriptionMerge`, but only a shallow copy is made of the family name and other allocated fields. `desc` can only be used until `descToMerge` is modified or freed. This is meant to be used when the merged font description is only needed temporarily.

## new

fontDescriptionNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m FontDescription | Returns: the newly allocated `PangoFontDescription`, which should be freed using `fontDescriptionFree`.

Creates a new font description structure with all fields unset.

## setAbsoluteSize

fontDescriptionSetAbsoluteSize Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontDescription | `desc`: a `PangoFontDescription`
-> Double | `size`: the new size, in Pango units. There are `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.
-> m () |

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

This is mutually exclusive with `fontDescriptionSetSize` which sets the font size in points.

Since: 1.8

## setColor

fontDescriptionSetColor Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontDescription | `desc`: a `PangoFontDescription`.
-> FontColor | `color`: the `PangoFontColor` value
-> m () |

Sets the color field of a font description.

This field determines whether the font description should match fonts that have color glyphs, or fonts that don't.

Since: 1.57

## setFamily

fontDescriptionSetFamily Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontDescription | `desc`: a `PangoFontDescription`.
-> Text | `family`: a string representing the family name.
-> m () |

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

fontDescriptionSetFamilyStatic Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontDescription | `desc`: a `PangoFontDescription`
-> Text | `family`: a string representing the family name
-> m () |

Sets the family name field of a font description, without copying the string.

This is like `fontDescriptionSetFamily`, 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.

## setFeatures

fontDescriptionSetFeatures Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontDescription | `desc`: a `PangoFontDescription`.
-> Maybe Text | `features`: a string representing the features
-> m () |

Sets the features field of a font description.

OpenType font features allow to enable or disable certain optional features of a font, such as tabular numbers.

The format of the features string is comma-separated list of feature assignments, with each assignment being one of these forms:

FEATURE=n

where FEATURE must be a 4 character tag that identifies and OpenType feature, and n an integer (depending on the feature, the allowed values may be 0, 1 or bigger numbers). Unknown features are ignored.

Note that font features set in this way are enabled for the entire text that is using the font, which is not appropriate for all OpenType features. The intended use case is to select character variations (features cv01 - c99), style sets (ss01 - ss20) and the like.

Pango does not currently have a way to find supported OpenType features of a font. Both harfbuzz and freetype have API for this. See for example hb_ot_layout_table_get_feature_tags.

Features that are not supported by the font are silently ignored.

Since: 1.56

## setFeaturesStatic

fontDescriptionSetFeaturesStatic Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontDescription | `desc`: a `PangoFontDescription`
-> Text | `features`: a string representing the features
-> m () |

Sets the features field of a font description.

This is like `fontDescriptionSetFeatures`, except that no copy of `featuresis` 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 `features` is a static string such as a C string literal, or if `desc` is only needed temporarily.

Since: 1.56

## setGravity

fontDescriptionSetGravity Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontDescription | `desc`: a `PangoFontDescription`
-> Gravity | `gravity`: the gravity for the font description.
-> m () |

Sets the gravity field of a font description.

The gravity field specifies how the glyphs should be rotated. If `gravity` is `GravityAuto`, 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

fontDescriptionSetSize Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontDescription | `desc`: a `PangoFontDescription`

-> Int32

`size`: the size of the font in points, scaled by `SCALE`. (That is, 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 `fontDescriptionSetAbsoluteSize` if you need a particular size in device units.

-> m () |

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

This is mutually exclusive with `fontDescriptionSetAbsoluteSize`.

## setStretch

fontDescriptionSetStretch Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontDescription | `desc`: a `PangoFontDescription`
-> Stretch | `stretch`: the stretch for the font description
-> m () |

Sets the stretch field of a font description.

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

## setStyle

fontDescriptionSetStyle Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontDescription | `desc`: a `PangoFontDescription`
-> Style | `style`: the style for the font description
-> m () |

Sets the style field of a `PangoFontDescription`.

The `Style` enumeration describes whether the font is slanted and the manner in which it is slanted; it can be either `StyleNormal`, `StyleItalic`, or `StyleOblique`.

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

fontDescriptionSetVariant Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontDescription | `desc`: a `PangoFontDescription`
-> Variant | `variant`: the variant type for the font description.
-> m () |

Sets the variant field of a font description.

The `Variant` can either be `VariantNormal` or `VariantSmallCaps`.

## setVariations

fontDescriptionSetVariations Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontDescription | `desc`: a `PangoFontDescription`.
-> Maybe Text | `variations`: a string representing the variations
-> m () |

Sets the variations field of a font description.

OpenType font variations allow to select a font instance by specifying values for a number of axes, such as width or weight.

The format of the variations string is

AXIS1=VALUE,AXIS2=VALUE...

with each AXIS a 4 character tag that identifies a font axis, and each VALUE a floating point number. Unknown axes are ignored, and values are clamped to their allowed range.

Pango does not currently have a way to find supported axes of a font. Both harfbuzz and freetype have API for this. See for example hb_ot_var_get_axis_infos.

Since: 1.42

## setVariationsStatic

fontDescriptionSetVariationsStatic Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontDescription | `desc`: a `PangoFontDescription`
-> Text | `variations`: a string representing the variations
-> m () |

Sets the variations field of a font description.

This is like `fontDescriptionSetVariations`, except that no copy of `variations` 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 `variations` is a static string such as a C string literal, or if `desc` is only needed temporarily.

Since: 1.42

## setWeight

fontDescriptionSetWeight Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontDescription | `desc`: a `PangoFontDescription`
-> Weight | `weight`: the weight for the font description.
-> m () |

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 `Weight` enumeration, other intermediate numeric values are possible.

## toFilename

fontDescriptionToFilename Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontDescription | `desc`: a `PangoFontDescription`
-> m (Maybe Text) | Returns: a new string that must be freed with `free`.

Creates a filename representation of a font description.

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

## toString

fontDescriptionToString Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontDescription | `desc`: a `PangoFontDescription`
-> m Text | Returns: a new string that must be freed with `free`.

Creates a string representation of a font description.

See `fontDescriptionFromString` 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

fontDescriptionUnsetFields Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontDescription | `desc`: a `PangoFontDescription`
-> [FontMask] | `toUnset`: bitmask of fields in the `desc` to unset.
-> m () |

Unsets some of the fields in a `PangoFontDescription`.

The unset fields will get back to their default values.