Description
Audit supplied integer UTF-16 glyph cluster positions for bounds and decreasing order separately; decreasing clusters may be valid RTL shaping, not automatically corruption.
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.
Audit supplied integer UTF-16 glyph cluster positions for bounds and decreasing order separately; decreasing clusters may be valid RTL shaping, not automatically corruption.
When to use this tool
Use this tool to audit supplied integer UTF-16 glyph cluster positions for bounds and decreasing order separately; decreasing clusters may be valid RTL shaping, not automatically corruption.
How to use the tool and how it works
- Enter clusters, sourceLength using the input definitions below.
- Run the operation. Resolve malformed-input errors before interpreting the result.
- Read result.outOfBounds, result.decreasing. Interpret signs, units, ordering and null values using the rules below.
Return indexes of cluster positions below zero or above sourceLength. Separately report each later glyph index whose cluster is less than its predecessor’s. Equality with sourceLength is accepted.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| clusters | Integer 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. |
| sourceLength | Source length in UTF-16 code units, integer 0–8192. | Finite safe integer satisfying the stated bounds. |
| Output field | Interpretation |
|---|---|
| result | Object containing the fields below. |
| result.outOfBounds | Original indexes whose cluster is below zero or above sourceLength. |
| result.decreasing | Later glyph indexes where the cluster decreases from its predecessor. |
{
"input": {
"clusters": [
0,
2,
1,
5
],
"sourceLength": 4
},
"output": {
"result": {
"outOfBounds": [
3
],
"decreasing": [
2
]
}
}
} Limitations and assumptions
- A decreasing sequence can reflect right-to-left shaping; the audit does not identify grapheme boundaries or prove invalid shaping.
- 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
Similar or alternative tools
- 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.
- 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.