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/Layout_line/index.html

Module Wrappers.Layout_line

type t = [ `layout_line ] Gobject.obj

A `PangoLayoutLine` represents one of the lines resulting from laying out a paragraph via `PangoLayout`.

`PangoLayoutLine` structures are obtained by calling method@Pango.Layout.get_line and are only valid until the text, attributes, or settings of the parent `PangoLayout` are modified.

val x_to_index : t -> int -> bool * int * int

Converts from x offset to the byte index of the corresponding character within the text of the layout.

If @x_pos is outside the line, @index_ and @trailing will point to the very first or very last position in the line. This determination is based on the resolved direction of the paragraph; for example, if the resolved direction is right-to-left, then an X position to the right of the line (after it) results in 0 being stored in @index_ and @trailing. An X position to the left of the line results in @index_ pointing to the (logical) last grapheme in the line and @trailing being set to the number of characters in that grapheme. The reverse is true for a left-to-right line.

val ref : t -> t option

Increase the reference count of a `PangoLayoutLine` by one.

val is_paragraph_start : t -> bool

Returns whether this is the first line of the paragraph.

val index_to_x : t -> int -> bool -> int

Converts an index within a line to a X position.

val get_x_ranges : t -> int -> int -> int array * int

Gets a list of visual ranges corresponding to a given logical range.

This list is not necessarily minimal - there may be consecutive ranges which are adjacent. The ranges will be sorted from left to right. The ranges are with respect to the left edge of the entire layout, not with respect to the line.

val get_start_index : t -> int

Returns the start index of the line, as byte index into the text of the layout.

val get_resolved_direction : t -> Pango_enums.direction

Returns the resolved direction of the line.

val get_pixel_extents : t -> [ `rectangle ] Gobject.obj * [ `rectangle ] Gobject.obj

Computes the logical and ink extents of @layout_line in device units.

This function just calls method@Pango.LayoutLine.get_extents followed by two func@extents_to_pixels calls, rounding @ink_rect and @logical_rect such that the rounded rectangles fully contain the unrounded one (that is, passes them as first argument to func@extents_to_pixels).

val get_length : t -> int

Returns the length of the line, in bytes.

val get_height : t -> int

Computes the height of the line, as the maximum of the heights of fonts used in this line.

Note that the actual baseline-to-baseline distance between lines of text is influenced by other factors, such as method@Pango.Layout.set_spacing and method@Pango.Layout.set_line_spacing.

val get_extents : t -> [ `rectangle ] Gobject.obj * [ `rectangle ] Gobject.obj

Computes the logical and ink extents of a layout line.

See method@Pango.Font.get_glyph_extents for details about the interpretation of the rectangles.

val get_type : unit -> Gobject.Type.t