package ocgtk
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=4e50fdb5093136a10fc8ffbe388e44cbcb70d52f8afdd48863ec7e22580ff054
doc/ocgtk.pango/Ocgtk_pango/Pango/Wrappers/Glyph_string/index.html
Module Wrappers.Glyph_string
type t = [ `glyph_string ] Gobject.objA `PangoGlyphString` is used to store strings of glyphs with geometry and visual attribute information.
The storage for the glyph information is owned by the structure which simplifies memory management.
val new_ : unit -> tCreate a new GlyphString
val x_to_index :
t ->
string ->
int ->
[ `analysis ] Gobject.obj ->
int ->
int * intConvert from x offset to character position.
Character positions are computed by dividing up each cluster into equal portions. In scripts where positioning within a cluster is not allowed (such as Thai), the returned value may not be a valid cursor position; the caller must combine the result with the logical attributes for the text to compute the valid cursor position.
val set_size : t -> int -> unitResize a glyph string to the given length.
val index_to_x_full :
t ->
string ->
int ->
[ `analysis ] Gobject.obj ->
[ `log_attr ] Gobject.obj option ->
int ->
bool ->
intConverts from character position to x position.
This variant of method@Pango.GlyphString.index_to_x additionally accepts a `PangoLogAttr` array. The grapheme boundary information in it can be used to disambiguate positioning inside some complex clusters.
val index_to_x :
t ->
string ->
int ->
[ `analysis ] Gobject.obj ->
int ->
bool ->
intConverts from character position to x position.
The X position is measured from the left edge of the run. Character positions are obtained using font metrics for ligatures where available, and computed by dividing up each cluster into equal portions, otherwise.
<picture> <source srcset="glyphstring-positions-dark.png" media="(prefers-color-scheme: dark)"> <img alt="Glyph positions" src="glyphstring-positions-light.png"> </picture>
val get_width : t -> intComputes the logical width of the glyph string.
This can also be computed using method@Pango.GlyphString.extents. However, since this only computes the width, it's much faster. This is in fact only a convenience function that computes the sum of @geometry.width for each glyph in the @glyphs.
val extents_range :
t ->
int ->
int ->
[ `font | `object_ ] Gobject.obj ->
[ `rectangle ] Gobject.obj * [ `rectangle ] Gobject.objComputes the extents of a sub-portion of a glyph string.
The extents are relative to the start of the glyph string range (the origin of their coordinate system is at the start of the range, not at the start of the entire glyph string).
val extents :
t ->
[ `font | `object_ ] Gobject.obj ->
[ `rectangle ] Gobject.obj * [ `rectangle ] Gobject.objCompute the logical and ink extents of a glyph string.
See the documentation for method@Pango.Font.get_glyph_extents for details about the interpretation of the rectangles.
Examples of logical (red) and ink (green) rects:
!(rects1.png) !(rects2.png)
val get_type : unit -> Gobject.Type.t