Gjsify LogoGjsify Logo

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

record

Hierarchy

  • GlyphString

Index

Constructors

Properties

glyphs: GlyphInfo[]

array of glyph information

field
log_clusters: number

logical cluster info, indexed by the byte index within the text corresponding to the glyph string

field
num_glyphs: number

number of glyphs in this glyph string

field
name: string

Methods

  • Compute the logical and ink extents of a glyph string.

    See the documentation for [methodPango.Font.get_glyph_extents] for details about the interpretation of the rectangles.

    Examples of logical (red) and ink (green) rects:

    Parameters

    Returns [Pango.Rectangle, Pango.Rectangle]

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

    Parameters

    • start: number

      start index

    • end: number

      end index (the range is the set of bytes with indices such that start <= index < end)

    • font: Pango.Font

      a PangoFont

    Returns [Pango.Rectangle, Pango.Rectangle]

  • free(): void
  • get_logical_widths(text: string, length: number, embedding_level: number, logical_widths: number[]): void
  • Given a PangoGlyphString and corresponding text, determine the width corresponding to each character.

    When multiple characters compose a single cluster, the width of the entire cluster is divided equally among the characters.

    See also [methodPango.GlyphItem.get_logical_widths].

    Parameters

    • text: string

      the text corresponding to the glyphs

    • length: number

      the length of text, in bytes

    • embedding_level: number

      the embedding level of the string

    • logical_widths: number[]

      an array whose length is the number of characters in text (equal to g_utf8_strlen (text, length) unless text has NUL bytes) to be filled in with the resulting character widths.

    Returns void

  • get_width(): number
  • Computes the logical width of the glyph string.

    This can also be computed using [methodPango.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.

    Returns number

  • index_to_x(text: string, length: number, analysis: Analysis, index_: number, trailing: boolean): number
  • Converts 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.

    Glyph positions

    Parameters

    • text: string

      the text for the run

    • length: number

      the number of bytes (not characters) in text.

    • analysis: Analysis

      the analysis information return from [funcitemize]

    • index_: number

      the byte index within text

    • trailing: boolean

      whether we should compute the result for the beginning (%FALSE) or end (%TRUE) of the character.

    Returns number

  • index_to_x_full(text: string, length: number, analysis: Analysis, attrs: LogAttr, index_: number, trailing: boolean): number
  • Converts from character position to x position.

    This variant of [methodPango.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.

    Parameters

    • text: string

      the text for the run

    • length: number

      the number of bytes (not characters) in text.

    • analysis: Analysis

      the analysis information return from [funcitemize]

    • attrs: LogAttr

      PangoLogAttr array for text

    • index_: number

      the byte index within text

    • trailing: boolean

      whether we should compute the result for the beginning (%FALSE) or end (%TRUE) of the character.

    Returns number

  • set_size(new_len: number): void
  • Resize a glyph string to the given length.

    Parameters

    • new_len: number

      the new length of the string

    Returns void

  • x_to_index(text: string, length: number, analysis: Analysis, x_pos: number): [number, number]
  • Convert 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.

    Parameters

    • text: string

      the text for the run

    • length: number

      the number of bytes (not characters) in text.

    • analysis: Analysis

      the analysis information return from [funcitemize]

    • x_pos: number

      the x offset (in Pango units)

    Returns [number, number]

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method