package ocgtk

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Wrappers.Font_description

type t = [ `font_description ] Gobject.obj

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.

val new_ : unit -> t

Create a new FontDescription

val unset_fields : t -> Pango_enums.fontmask -> unit

Unsets some of the fields in a `PangoFontDescription`.

The unset fields will get back to their default values.

val to_string : t -> string

Creates a string representation of a font description.

See func@Pango.FontDescription.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.

val to_filename : t -> string option

Creates a filename representation of a font description.

The filename is identical to the result from calling method@Pango.FontDescription.to_string, but with underscores instead of characters that are untypical in filenames, and in lower case only.

val set_weight : t -> Pango_enums.weight -> unit

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

val set_variations_static : t -> string -> unit

Sets the variations field of a font description.

This is like method@Pango.FontDescription.set_variations, 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.

val set_variations : t -> string option -> unit

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(https://harfbuzz.github.io/harfbuzz-hb-ot-var.html#hb-ot-var-get-axis-infos).

val set_variant : t -> Pango_enums.variant -> unit

Sets the variant field of a font description.

The enum@Pango.Variant can either be %PANGO_VARIANT_NORMAL or %PANGO_VARIANT_SMALL_CAPS.

val set_style : t -> Pango_enums.style -> unit

Sets the style field of a `PangoFontDescription`.

The enum@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.

val set_stretch : t -> Pango_enums.stretch -> unit

Sets the stretch field of a font description.

The enum@Pango.Stretch field specifies how narrow or wide the font should be.

val set_size : t -> int -> unit

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

This is mutually exclusive with method@Pango.FontDescription.set_absolute_size.

val set_gravity : t -> Pango_enums.gravity -> unit

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

val set_family_static : t -> string -> unit

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

This is like method@Pango.FontDescription.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.

val set_family : t -> string -> unit

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.

val set_absolute_size : t -> float -> unit

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

This is mutually exclusive with method@Pango.FontDescription.set_size which sets the font size in points.

val merge_static : t -> t -> bool -> unit

Merges the fields that are set in @desc_to_merge into the fields in @desc, without copying allocated fields.

This is like method@Pango.FontDescription.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.

val merge : t -> t option -> bool -> unit

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.

val hash : t -> int

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.

val get_weight : t -> Pango_enums.weight

Gets the weight field of a font description.

See method@Pango.FontDescription.set_weight.

val get_variations : t -> string option

Gets the variations field of a font description.

See method@Pango.FontDescription.set_variations.

val get_variant : t -> Pango_enums.variant

Gets the variant field of a `PangoFontDescription`.

See method@Pango.FontDescription.set_variant.

val get_style : t -> Pango_enums.style

Gets the style field of a `PangoFontDescription`.

See method@Pango.FontDescription.set_style.

val get_stretch : t -> Pango_enums.stretch

Gets the stretch field of a font description.

See method@Pango.FontDescription.set_stretch.

val get_size_is_absolute : t -> bool

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

See method@Pango.FontDescription.set_size and method@Pango.FontDescription.set_absolute_size.

val get_size : t -> int

Gets the size field of a font description.

See method@Pango.FontDescription.set_size.

val get_set_fields : t -> Pango_enums.fontmask

Determines which fields in a font description have been set.

val get_gravity : t -> Pango_enums.gravity

Gets the gravity field of a font description.

See method@Pango.FontDescription.set_gravity.

val get_family : t -> string option

Gets the family name field of a font description.

See method@Pango.FontDescription.set_family.

val equal : t -> t -> bool

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.)

val copy_static : t -> t option

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

This is like method@Pango.FontDescription.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.

val better_match : t -> t option -> t -> bool

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.

val get_type : unit -> Gobject.Type.t