package ocgtk

  1. Overview
  2. Docs
OCaml bindings for GTK 4

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v0.1-preview2.tar.gz
sha256=4e50fdb5093136a10fc8ffbe388e44cbcb70d52f8afdd48863ec7e22580ff054

doc/ocgtk.pango/Ocgtk_pango/Pango/Wrappers/Context/index.html

Module Wrappers.Context

type t = [ `context | `object_ ] Gobject.obj
val new_ : unit -> t

Create a new Context

val set_round_glyph_positions : t -> bool -> unit

Sets whether font rendering with this context should round glyph positions and widths to integral positions, in device units.

This is useful when the renderer can't handle subpixel positioning of glyphs.

The default value is to round glyph positions, to remain compatible with previous Pango behavior.

val set_matrix : t -> [ `matrix ] Gobject.obj option -> unit

Sets the transformation matrix that will be applied when rendering with this context.

Note that reported metrics are in the user space coordinates before the application of the matrix, not device-space coordinates after the application of the matrix. So, they don't scale with the matrix, though they may change slightly for different matrices, depending on how the text is fit to the pixel grid.

val set_language : t -> [ `language ] Gobject.obj option -> unit

Sets the global language tag for the context.

The default language for the locale of the running process can be found using func@Pango.Language.get_default.

val set_gravity_hint : t -> Pango_enums.gravityhint -> unit

Sets the gravity hint for the context.

The gravity hint is used in laying vertical text out, and is only relevant if gravity of the context as returned by method@Pango.Context.get_gravity is set to %PANGO_GRAVITY_EAST or %PANGO_GRAVITY_WEST.

val set_font_map : t -> [ `font_map | `object_ ] Gobject.obj option -> unit

Sets the font map to be searched when fonts are looked-up in this context.

This is only for internal use by Pango backends, a `PangoContext` obtained via one of the recommended methods should already have a suitable font map.

val set_font_description : t -> [ `font_description ] Gobject.obj option -> unit

Set the default font description for the context

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

Sets the base gravity for the context.

The base gravity is used in laying vertical text out.

val set_base_dir : t -> Pango_enums.direction -> unit

Sets the base direction for the context.

The base direction is used in applying the Unicode bidirectional algorithm; if the @direction is %PANGO_DIRECTION_LTR or %PANGO_DIRECTION_RTL, then the value will be used as the paragraph direction in the Unicode bidirectional algorithm. A value of %PANGO_DIRECTION_WEAK_LTR or %PANGO_DIRECTION_WEAK_RTL is used only for paragraphs that do not contain any strong characters themselves.

val load_fontset : t -> [ `font_description ] Gobject.obj -> [ `language ] Gobject.obj -> [ `fontset | `object_ ] Gobject.obj option

Load a set of fonts in the context that can be used to render a font matching @desc.

val load_font : t -> [ `font_description ] Gobject.obj -> [ `font | `object_ ] Gobject.obj option

Loads the font in one of the fontmaps in the context that is the closest match for @desc.

val list_families : t -> [ `font_family | `object_ ] Gobject.obj array * int

List all families for a context.

val get_serial : t -> int

Returns the current serial number of @context.

The serial number is initialized to an small number larger than zero when a new context is created and is increased whenever the context is changed using any of the setter functions, or the `PangoFontMap` it uses to find fonts has changed. The serial may wrap, but will never have the value 0. Since it can wrap, never compare it with "less than", always use "not equals".

This can be used to automatically detect changes to a `PangoContext`, and is only useful when implementing objects that need update when their `PangoContext` changes, like `PangoLayout`.

val get_round_glyph_positions : t -> bool

Returns whether font rendering with this context should round glyph positions and widths.

val get_metrics : t -> [ `font_description ] Gobject.obj option -> [ `language ] Gobject.obj option -> [ `font_metrics ] Gobject.obj

Get overall metric information for a particular font description.

Since the metrics may be substantially different for different scripts, a language tag can be provided to indicate that the metrics should be retrieved that correspond to the script(s) used by that language.

The `PangoFontDescription` is interpreted in the same way as by func@itemize, and the family name may be a comma separated list of names. If characters from multiple of these families would be used to render the string, then the returned fonts would be a composite of the metrics for the fonts loaded for the individual families.

val get_matrix : t -> [ `matrix ] Gobject.obj option

Gets the transformation matrix that will be applied when rendering with this context.

See method@Pango.Context.set_matrix.

val get_language : t -> [ `language ] Gobject.obj

Retrieves the global language tag for the context.

val get_gravity_hint : t -> Pango_enums.gravityhint

Retrieves the gravity hint for the context.

See method@Pango.Context.set_gravity_hint for details.

val get_gravity : t -> Pango_enums.gravity

Retrieves the gravity for the context.

This is similar to method@Pango.Context.get_base_gravity, except for when the base gravity is %PANGO_GRAVITY_AUTO for which func@Pango.Gravity.get_for_matrix is used to return the gravity from the current context matrix.

val get_font_map : t -> [ `font_map | `object_ ] Gobject.obj option

Gets the `PangoFontMap` used to look up fonts for this context.

val get_font_description : t -> [ `font_description ] Gobject.obj option

Retrieve the default font description for the context.

val get_base_gravity : t -> Pango_enums.gravity

Retrieves the base gravity for the context.

See method@Pango.Context.set_base_gravity.

val get_base_dir : t -> Pango_enums.direction

Retrieves the base direction for the context.

See method@Pango.Context.set_base_dir.

val changed : t -> unit

Forces a change in the context, which will cause any `PangoLayout` using this context to re-layout.

This function is only useful when implementing a new backend for Pango, something applications won't do. Backends should call this function if they have attached extra data to the context and such data is changed.