Skip to content

Main content

Glyph Cluster Source Span Table

Derive cluster source spans from the next greater distinct supplied UTF-16 cluster index, supporting repeated and reverse-ordered glyph clusters; does not infer graphemes.

Loading tool…

Description

Derive cluster source spans from the next greater distinct supplied UTF-16 cluster index, supporting repeated and reverse-ordered glyph clusters; does not infer graphemes.

A glyph’s advance moves the next placement origin; its ink box describes visible bounds relative to that origin. Ink can overhang the advance, and an unknown box differs from a known empty box. These tools use caller-supplied glyph IDs and metrics, placing a horizontal run by cumulative advances without shaping text.

Derive cluster source spans from the next greater distinct supplied UTF-16 cluster index, supporting repeated and reverse-ordered glyph clusters; does not infer graphemes.

When to use this tool

Use this tool to derive cluster source spans from the next greater distinct supplied UTF-16 cluster index, supporting repeated and reverse-ordered glyph clusters; does not infer graphemes.

How to use the tool and how it works

  1. Enter clusters, sourceLength using the input definitions below.
  2. Run the operation. Resolve malformed-input errors before interpreting the result.
  3. Read result.spans. Interpret signs, units, ordering and null values using the rules below.

Validate cluster indexes from 0 through sourceLength, sort their distinct values, and map each original cluster to [start,next greater distinct cluster). The last distinct cluster ends at sourceLength.1

Input fieldMeaning and unitsAccepted input
clustersInteger UTF-16 source offsets in glyph order, with the operation’s stated accepted bounds.Dense list of at most 128 finite numbers, subject to the stated integer/shape rules.
sourceLengthSource length in UTF-16 code units, integer 0–8192.Finite safe integer satisfying the stated bounds.
Output fieldInterpretation
resultObject containing the fields below.
result.spansInput-order half-open {start,end} UTF-16 cluster spans.
json
{
  "input": {
    "clusters": [
      2,
      0,
      2
    ],
    "sourceLength": 4
  },
  "output": {
    "result": {
      "spans": [
        {
          "start": 2,
          "end": 4
        },
        {
          "start": 0,
          "end": 2
        },
        {
          "start": 2,
          "end": 4
        }
      ]
    }
  }
}

Limitations and assumptions

  • Spans use UTF-16 offsets; repeated or decreasing clusters are preserved, and missing earlier coverage or grapheme boundaries are not inferred.
  • All advances, box coordinates, shifts and positional tolerances must share caller-defined metric units. Signed advances are accepted. Glyph records contain id, advance, integer cluster 0–8192 and box = null or [minX,minY,maxX,maxY] with ordered bounds.
  • Every declared top-level input is required and unknown fields are rejected. Ordinary strings are limited to 8,192 UTF-16 code units and lists to 128 entries, with tighter operation-specific bounds where stated. JSON text has bounded nesting and node counts.
  • Numeric outputs must be finite and within the absolute safe-integer magnitude; exact larger integers use decimal text. Source positions are zero-based UTF-16 offsets and span ends are exclusive unless a different convention is explicitly stated.

Alternative or Complementary methods

Obtain metrics and cluster mappings from the intended font/shaping system, then inspect the supplied observations. Use actual rendering when hinting, fallback choice or visible pixel extents matter.

References

  1. Tool behavior and example: Glyph Cluster Source Span Table — tool.io

Similar or alternative tools

  • Glyph Cluster Index Audit

    Audit supplied integer UTF-16 glyph cluster positions for bounds and decreasing order separately; decreasing clusters may be valid RTL shaping, not automatically corruption.

  • Glyph Advance Run Tab Stop Placement

    Place glyph-run tab positions at the next strictly greater explicit stop, then repeat a supplied positive interval after the last stop; no text shaping.